Can't install geopandas in Anaconda environment

Question:

I am trying to install the geopandas package with Anaconda Prompt, but after I use conda install geopandas an unexpected thing happened:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages

After this, it proceeds to search for conflicts, but hours pass without finishing. In the end, I still cannot use geopandas.

I have also tried installing geopandas in a different virtual environment and it works but I do not know how to use the environment in Jupyter Notebooks.

I would like to know, how can install geopandas without a separate environment?

Or, alternatively, how can I use geopandas in Jupyter Notebooks after install it in a separate environment?

Answers:

You can install geopandas with pip, however, geopandas requires other dependencies (such as pandas, fiona, shapely, pyproj, rtree). You need to make sure that they are properly installed. After that you should be able to use them in jupyter with a simple import geopandas.

Answered By: Sileo

Install it in a new env, and include ipykernel if you plan to use it in Jupyter:

conda create -n my_env geopandas ipykernel

Note, nb_conda_kernels should be installed install in your base env (i.e. where you launch Jupyter from). This enables Jupyter to automatically recognize other envs that are kernel-ready:

conda install -n base nb_conda_kernels
Answered By: merv

in my case, I installed geos firstly: pip install geos, then conda install geopandas and everything went through.

Answered By: Jason Q

If you want to install geopandas in an EXISTING environment, use conda-forge as follows:

conda install --channel conda-forge geopandas
Answered By: Ken T

I faced the same problem. As far as I understand, my mistake was to install geopandas or pyproj with pip instead of conda. When trying to fix the issue (uninstalling geopandas, pyproj) I completely crashed my env.

I fixed the issue by completely reinstalling anaconda and creating a new separate conda env with an older version of python (python=3.8 instead of 3.9). Then everything ran smoothly.

Answered By: neuhart
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.