Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geopandas cannot be installed on M1 #1816

Closed
jjcfrancisco opened this issue Feb 6, 2021 · 25 comments
Closed

Geopandas cannot be installed on M1 #1816

jjcfrancisco opened this issue Feb 6, 2021 · 25 comments
Labels
installation Issues related to get a working installation

Comments

@jjcfrancisco
Copy link


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,<3.9.0a0|>=3.9,<3.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 ~ %

@jjcfrancisco jjcfrancisco added the installation Issues related to get a working installation label Feb 6, 2021
@martinfleis
Copy link
Member

Hmm, I don't really have a way to debug this. It is not surprising though. Have you tried specifying conda-forge channel (-c conda-forge)? My guess would be that it may be the only way to make it work at the moment.

To find out what the issue is, (if conda-forge won't solve it) I would need you to try installing dependencies one by one to figure out which one causes trouble (but based on the error, channels may resolve it).

@jjcfrancisco
Copy link
Author

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 ~ %

@jjcfrancisco
Copy link
Author

Just checked: I cannot install Shapely, Fiona or Pyproj.

@martinfleis
Copy link
Member

Thanks. I guess that this needs to be resolved in the upstream then. My sense is that C dependencies of these libraries are not yet built for Apple silicon. Something like docker under rosetta2 may work in the meantime (just guessing)?

A relevant issue on shapely side shapely/shapely#1080.

@jjcfrancisco
Copy link
Author

Something like docker under rosetta2 may work in the meantime

Good idea. Will try whilst something comes up. Thanks.

@chourmo
Copy link

chourmo commented Feb 7, 2021

I am using GeoPandas (+pygeos) with a M1 MacBook Air, under rosetta 2 and miniforge without problems.

@tommylees112
Copy link

How do you install python using Rosetta2 with miniforge?

@chourmo
Copy link

chourmo commented Feb 9, 2021

This is kinda out of topic, but I installed everything the normal way (including geopandas), but you have to use a rosetta Terminal to ensure that everything is runned as x86.

See https://www.youtube.com/watch?v=PnxlHfGdihI for how to do it.

@jjcfrancisco
Copy link
Author

This is kinda out of topic, but I installed everything the normal way (including geopandas), but you have to use a rosetta Terminal to ensure that everything is runned as x86.

See https://www.youtube.com/watch?v=PnxlHfGdihI for how to do it.

Does this work fine? I am wondering what will happen once these libraries are supported on the apple chip... will this mess things up?

@fabge
Copy link

fabge commented Jul 19, 2021

Any updates on getting it to work natively (without Rosetta)?
I can install pandas, fiona, shapely and pyproj separately.
It seems like rtree seems to be the culprit, this one cannot be found as conda package compiled for ARM...

@martinfleis
Copy link
Member

@fabge it is a bit out of our hands now. GeoPandas itself is pure Python and we need our dependencies to be compiled. pygoes should be available. Can you try installing that instead of rtree? With pygeos in your environment, rtree is not used.

@fabge
Copy link

fabge commented Jul 20, 2021

Thanks for the quick reply! Unfortunately this didn't help, the installation still fails.
What's weird is that there is no information given on what exactly fails. Below is the error when pygeos is pre-installed.

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

This one is the error in a vanilla conda env:

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:

@martinfleis
Copy link
Member

This is indeed strange. I don't have access to the M1 machine so can't really help much I am afraid.

@fabge
Copy link

fabge commented Jul 20, 2021

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.

With pygeos in your environment, rtree is not used.

The important difference (from @martinfleis) is to conda install pygeos instead of rtree, as rtree is not available natively on M1 macs.

@mauriciodinamarca
Copy link

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.

With pygeos in your environment, rtree is not used.

The important difference (from @martinfleis) is to conda install pygeos instead of rtree, as rtree is not available natively on M1 macs.

Could you add a simple procedure for trying? Did the same thing as you said and it didnt work 😢
conda install pandas fiona shapely pyproj pygeos
conda install 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
`
``

@FelipeRocha
Copy link

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.

With pygeos in your environment, rtree is not used.

The important difference (from @martinfleis) is to conda install pygeos instead of rtree, as rtree is not available natively on M1 macs.

Could you add a simple procedure for trying? Did the same thing as you said and it didnt work 😢
conda install pandas fiona shapely pyproj pygeos
conda install 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
`
``

try pip install git+git://github.com/geopandas/geopandas.git instead of conda install geopandas

@martinfleis
Copy link
Member

If you have all required dependencies installed and working, then pip install is a safe option. Even pip install geopandas may work. I'd assume there is no need for installing from git.

@fabge
Copy link

fabge commented Jul 21, 2021

Exactly, try to install geopandas with pip install @mauriciodinamarca.
The complete installation process would then look like:

conda install pandas fiona shapely pyproj rtree
pip install geopandas

(or pip install git+git://github.com/geopandas/geopandas.git - both should work)

@LiamBui
Copy link

LiamBui commented Sep 1, 2021

I was having trouble running the above steps. What worked for me was to brew install gdal proj and then run
pip install geopandas
Hope this may help someone later on.

@themrcesi
Copy link

I was having trouble running the above steps. What worked for me was to brew install gdal proj and then run
pip install geopandas
Hope this may help someone later on.

This has also worked for me!

@givemetarte
Copy link

I was having trouble running the above steps. What worked for me was to brew install gdal proj and then run
pip install geopandas
Hope this may help someone later on.

This worked for me, too! Thanks 😘

@jreakin
Copy link

jreakin commented Dec 29, 2021

I was having trouble running the above steps. What worked for me was to brew install gdal proj and then run pip install geopandas Hope this may help someone later on.

You're a lifesaver! Worked perfectly.

@martinfleis
Copy link
Member

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 than pip. 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.

conda install -c conda-forge geopandas pygeos

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:

brew install geos
export DYLD_LIBRARY_PATH=/opt/homebrew/opt/geos/lib/
pip install shapely

DYLD_LIBRARY_PATH is needed for shapely to find GEOS installation.

Install fiona:

brew install gdal
pip install fiona

Install pyproj:

brew install proj
pip install pyproj

Install geopandas and pygeos for speedups:

pip install pygeos
pip install geopandas

With all that, I am going to close the issue.

@stevenlis
Copy link

@martinfleis
It doesn't seem like geopandas has a osx-arm64 label on conda-forge. Am I missing something?
https://anaconda.org/conda-forge/geopandas
image

@m-richards
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation Issues related to get a working installation
Projects
None yet
Development

No branches or pull requests