kungphil
kungphil

Reputation: 1839

installing geopandas with conda, can't find dependencies libgcc-ng

I am trying to install geopandas with conda.

I have created a fresh environment

conda create --name gp python=2 

Then tried to install geopandas

conda install geopandas

Which returns

Error: Could not find some dependencies for geopandas: rtree, libspatialindex >=1.9.0,<1.10.0a0, libgcc-ng >=7.3.0, matplotlib-base

Did you mean one of these?

geopandas, pandas, biopandas

Did you mean one of these?

rtree, r-tree, r-htree

Did you mean one of these?

matplotlib-base, matplotlib-venn, matplotlib

So I have installed libgcc-ng:

conda install -c anaconda libgcc-ng 

Then tried to install libspatialindex:

conda install -c conda-forge libspatialindex 

But this returns:

Error: Could not find some dependencies for libspatialindex: libgcc-ng >=7.3.0

Upvotes: 1

Views: 975

Answers (1)

merv
merv

Reputation: 77100

If the point of the new env is to have geopandas in it, then let Conda know that right from the start and it can solve the dependencies upfront:

conda create -n gp python=2 geopandas

However, as @martinfleis points out, you may still have channel priority issues. Testing on a linux-64 platform, I was able to install geopandas=0.4.0 from anaconda channel alone, but to install geopandas=0.5.0 required both anaconda and conda-forge, and could be provided in either priority. In @martinfleis's testing, only giving conda-forge priority worked. Hence,

conda create -n gp -c conda-forge -c defaults --override-channels python=2 geopandas

would be the consensus command.


Note on Channel Priorities

It is possible to change channel priorities at the configuration level, as in @martinfleis's comment to OP, and in this case would make it so that the first command above works exactly like the second. However, one should only make such a change of it really coincides with your channel preferences - not to achieve a particular installation.

The alternative, as demonstrated in the second command above, is to temporarily specify channel priorities in a create or install command. In that command, -c conda-forge coming first gives it priority over -c defaults. The --override-channels flag disables whatever other channels you might have in permanent configuration settings.

Additionally, one can still specify individual packages to come from a particular channel by prefixing <channel>:: to the package name. For example, if in the second command, I still wanted to source Python from defaults, it would be defaults::python=2.

If you have more than a couple of exceptions that you want to specify, then it's probably time to consider installing from a YAML.

Upvotes: 1

Related Questions