geopandas: Geopandas cannot be installed on M1
-
[Yes] I have read the documentation on installation and followed the instructions provided.
-
[Yes] I have looked through issues labeled “installation” in the geopandas repo.
-
If your issue is related to installation using the
conda-forge
channel, please open an issue in geopandas-feedstock repository instead.
System information
[what operating system do you have and what package management system are you using]
MacOS BigSur on Apple chip M1
Environment details
I followed the installation steps from Geopandas docs, but got an error on last step (see below):
(gds) frankjimenez@franks-mbp ~ % conda install python=3 geopandas 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. This can take several minutes. Press CTRL-C to abort. failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package python conflicts for: geopandas -> pandas[version=‘>=0.23’] -> python[version=‘>=3.6|>=3.7|>=3.8,❤️.9.0a0|>=3.9,❤️.10.0a0’] geopandas -> python[version=‘>=3.5’] python=3 Note that strict channel priority may have removed packages required for satisfiability.
(gds) frankjimenez@franks-mbp ~ %
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (7 by maintainers)
I was having trouble running the above steps. What worked for me was to
brew install gdal proj
and then runpip install geopandas
Hope this may help someone later on.At the moment, installing geopandas on M1 macs is no longer an issue and can be achieved via conda or pip+homebrew. See the summary below. Keep in mind that a lot of comments from the thread above are no longer true.
GeoPandas itself is written in pure Python, so there is no issue running that on any architecture. However, it depends on other libraries that are written in other languages (C, C++) that need to be compiled specifically for M1 chips. While you could compile it yourself, I am not going to cover this option as it is not user friendly.
There are three possible sources of required libraries - pip wheels, conda-forge, and Homebrew.
When a Python package requires C dependency, it can create wheels with the dependency compiled for each system and chip architecture. See for example pygeos - https://pypi.org/project/pygeos/#files. What you need is
*macosx_11_0_arm64.whl
. If your package doesn’t offer it, you have to find another way of installing thanpip
. Since GeoPandas requires shapely and fiona (among others) that do not have these wheels, you should look elsewhere - either on conda-forge or Homebrew. Below are both options tested as of today.Conda and conda-forge way (recommended)
Conda-forge currently has all packages geopandas needs
Install M1 version of miniforge or mambaforge. It can be downloaded from here - https://github.com/conda-forge/miniforge.
Note: if you install x86 (Intel) version of conda, it will run under Rosetta2 and install all packages using x86 architecture, meaning that everything will run under emulation. Try to avoid that.
Pip and Homebrew way
Homebrew can install C libraries compiled for M1. Python packages will find and use them.
Using an environment with Python 3.9
Install shapely:
DYLD_LIBRARY_PATH
is needed for shapely to find GEOS installation.Install fiona:
Install pyproj:
Install geopandas and pygeos for speedups:
With all that, I am going to close the issue.
Quick update: I made it work by installing from source. After installing the necessary packages with conda and installing
geopandas
with pip, the package can be used.The important difference (from @martinfleis) is to conda install
pygeos
instead ofrtree
, asrtree
is not available natively on M1 macs.This has also worked for me!
Just checked: I cannot install Shapely, Fiona or Pyproj.
@StevenLi-DS (I’m not across the M1 packaging situation particularly closely) I think the noarch install is all you need - geopandas itself is pure python, it just has compiled dependencies, note that the linux/ windows / osx specific architecture versions are for v0.3 which is well out of date.
This worked for me, too! Thanks 😘
I am using GeoPandas (+pygeos) with a M1 MacBook Air, under rosetta 2 and miniforge without problems.
I get the same issue with conda-forge channel:
(gds) frankjimenez@franks-mbp ~ % conda install -c conda-forge geopandas
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. This can take several minutes. Press CTRL-C to abort. failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions Note that strict channel priority may have removed packages required for satisfiability.
(gds) frankjimenez@franks-mbp ~ %