1

How to install geopandas, I really tried everything and I still has error: ModuleNotFoundError: No module named 'geopandas'. I have the latest version of Python 3.9.6. I use Windows 10, I use Anaconda Prompt, I have only one version of Python.

I do not want to create other environment, I want to install it as any other package, how to do it? I tried:

pip install geopandas 

conda install --channel conda-forge geopandas

!conda install geopandas

I checked also this page: https://geopandas.readthedocs.io/en/latest/getting_started/install.html to find solution but I still do not have this package. But package folium was installed correctly by pip install folium.

Help me because I try to do in second day in a row ;/

9
  • 3
    We need way more information. What base env are you running? Do you have multiple versions of python installed? Are you on windows, linux, mac, etc.? Are in installing in the terminal or Anaconda Prompt? Commented Aug 18, 2021 at 19:35
  • I use Windows 10, I use Anaconda Prompt, I have only one version of Python and it is 2.9.6 (the latest) :) Commented Aug 18, 2021 at 19:37
  • From a cell in a notebook what do these two lines of code return? import sys and then !{sys.executable} -m pip install --user geopandas Commented Aug 18, 2021 at 19:43
  • Can you try !pip install geopandas? Commented Aug 18, 2021 at 19:43
  • MDR your two liner returned error: ERROR: Command errored out with exit status 1: it is really long error Commented Aug 18, 2021 at 19:53

3 Answers 3

2

I will transcribe here the solution I found; all glory goes to Mr. Tanish Gupta, long life to him. Source here :). I hope it helps!

I did this in my win10 PC, I have Anaconda 2.1.4 and only the Python version which comes with it (3.7 I believe). I use Anaconda Prompt, I have only that one version of Python ('cause I had the latest Py ver, but outside Anaconda, and tried this. It worked, but for that 3.10 Python version, not for the Jupyter Py ver, if that makes sense).

To my understanding, probably there is some incompatibility between the libraries installed in the base environment, so we'll be creating a new one.

  1. In the Anaconda command prompt, create a new environment variable: conda create -n geo_env

  2. Activate this environment “geo_env”, then add and set conda-forge channel:

    conda create -n geo_env

    conda config --env --add channels conda-forge

    conda config --env --set channel_priority strict

  3. Install Geopandas in the environment just created: conda install geopandas

  4. Next install Jupyter notebook in this environment: conda install jupyter notebook

    Note: If the above command doesn’t work for you, try conda install notebook.

  5. Now add our environment to Jupyter notebook: python -m ipykernel install --name geo_env

  6. Change to our new environment in the AnacondaNavigator. Enjoy :D

In my case, then I had issues with seaborn and wordcloud in this environment, so I tried installing C++, 'cause it said in the error output, you know, I just wanted more headaches (it didn't work). Finally I installed them in the same way explained before and everything ran smoothly.

Sign up to request clarification or add additional context in comments.

Comments

1

If I'm not mistaken you're either having a conflict between channels or you forgot to install geopandas packages when doing it with pip.

First of all, in an anaconda prompt, start by cleaning your environment by removing the packages that got installed by pip. To do so just pip uninstall geopandas fiona pyproj rtree shapely. Once you're done with that, run a conda install --channel conda-forge geopandas (normally should work).

Comments

0

Use this code if you are using jupyter notebook. pip install geopandas

1 Comment

How is this different than advice already covered in the comments? And, probably more importantly for this case, the OP admitted Anaconda/conda was involved and so your advice can lead to problematic environments. As Anaconda/conda is the primary package manager, users need to stick with that for installations to have robust and portable environments. Only resorting to pip for packages that have no conda recipe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.