Search code examples
python-3.7matplotlib-basemapgeopandasanaconda3

Installing geopandas uninstalls basemap & vice-versa


I need a Python environment with both basemap and geopandas, but installing one removes the other. Is there anyway to have both, or is there a reasonable way to switch between interpreters in the same script?

I know basemap is being depreciated for cartopy, but I'm working with basemap and it is what is for now.

Using Anaconda3, Python 3.7.6

Here are the steps I have taken, just using the base environment:

conda install -c conda-forge basemap
conda install geopandas

## I kept having issues with installing geopandas:
## Solving environment: failed with initial frozen solve. Retrying with flexible solve.

## So I followed the solution by "forskamse" here [https://github.com/conda/conda/issues/9367] 
conda activate base
conda config --set auto_update_conda False
conda install conda=4.6.14
conda install geopandas

This successfully installed geopandas, but it removed basemap:

The following packages will be REMOVED:

  anaconda-2020.02-py37_0
  basemap-1.3.0-py37h7cd9bad_2
  python_abi-3.7-1_cp37m

Also confirmed basemap is removed by conda list inspection.

I have also tried a new environment as suggested on the geopandas install page, but I get a bunch of Solving environment errors installing joblib and scikit-learn... and maybe other libraries, I stopped trying at that point.


Solution

  • Different conda channels offer different compatibility and you should always try to stick to a single channel, either defaults or (preferably) conda-forge. Installing geopandas and basemap both from conda-forge should resolve the compatibility issue and allow you to instal both.

    conda install -c conda-forge geopandas basemap
    

    General advice for Python geospatial stack is stick to conda-forge.