Larry Field
Larry Field

Reputation: 63

Importing geopandas keeps failing for Mac - All reported solutions tried

Import geopandas gave me: ImportError: No module named 'geopandas' I researched and applied solutions:

!pip uninstall geopandas six pyproj fiona rtree shapely -y !conda install -c conda-forge fiona shapely rtree pyproj geopandas six !conda upgrade --all

The upgrade operation produced a bodacious list of files being updated and superseded. It concluded with the following message 8 times over, each with a different path:

CondaVerificationError: The package for gxx_impl_linux-64 located at /opt/conda/pkgs/gxx_impl_linux-64-7.2.0-hdf63c60_3 appears to be corrupted. The path 'bin/x86_64-conda_cos6-linux-gnu-g++' specified in the package manifest cannot be found.

When I then did the Import geopandas as gpd, I got the 'no module named geopandas' error message again.

I'm on a MacBook Pro using a Jupyter Notebook and I'm out of ideas. Anybody have another idea? Thanks.

Upvotes: 0

Views: 575

Answers (1)

lukaszKielar
lukaszKielar

Reputation: 541

I'd suggest you to create new conda environment with all necessary libraries. Before you do that check what channels you have in your conda settings.

$ conda config --get channels
--add channels 'defaults'   # lowest priority
--add channels 'conda-forge'   # highest priority

If you don't have anaconda and conda-forge you have to add them.

$ conda config --add channel conda-forge

Once it's done, create new environment. You don't need to pass six, fiona and other libraries because they will be installed along with geopandas. If you are using Jupyter I recommend you to install ipykernel which allow you to add your environment to list of Jupyter kernels.

conda create --name <name-of-your-env> python=3 geopandas=0.4.0 gdal ipykernel

Hit enter and wait for conda. When installation is finished, activate your environment, test it and if everything is fine register kernel.

conda activate <name-of-your-env>
python -m ipykernel --install --user --name <name-of-your-env> --display-name <name-to-be-displayed>

Enjoy your environment.

Upvotes: 1

Related Questions