how to successfully install pyproj and geopandas?

雨燕双飞 提交于 2019-11-27 01:20:31

问题


I have tried to install geopandas via I python by running !pip install geopandas, but this fails with "python setup.py egg_info" failed with error code 1 and then Path to long directory. I read online that pyproj is required for geopandas and also tried to install it however no luck, similar error. Would anyone be able to point me in the right direction? Thank you.

Oh by the way, if this helps, I was able to install shapely, fiona, and Descartes using this method.


回答1:


Getting to work geopandas is unfortuntaly not easy, the problem is that the dependencies are partly not working and you have to use older versions of Fiona and GDAL. The following packages work stable together:

GDAL: 1.11.2
Fiona: 1.6.0
Geopandas: 0.1.0.dev-

To install on ubuntu:

sudo apt-get install build-essential python-all-dev
wget http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz
tar xvfz gdal-1.11.2.tar.gz
cd gdal-1.11.2
./configure --with-python
make
sudo make install

In addition, some Linux distributions require the shared library cache to be updated after install:

sudo ldconfig

Fiona and geopandas can be installed classic by:

sudo pip install Fiona==1.6.0
sudo pip install geopandas

Under windows

As @Marcus Williams states:

Download Fiona and GDAL Windows Binaries corresponding your python environment (32, 64bit and 2.7 3.3 etc. (from http://www.lfd.uci.edu/~gohlke/pythonlibs/) and go in cmd with cd to directory where downloaded files are and install the .whl files using the command

pip install filename.whl

Finally:

pip install geopandas



回答2:


Thanks to the conda-forge community, geopandas is actually pretty easy to install on all platforms using the conda package manager (or: its dependencies, as this is the difficulty).

If you have conda, it is just:

conda install -c conda-forge geopandas

To install conda, you can install the Anaconda python distribution or miniconda: http://conda.pydata.org/docs/download.html




回答3:


After hours of failure (with WinError 126, "not a supported wheel on this platform" error, etc.), I've successfully installed pyproj and geopandas, and this is what I did:

  • Install descartes, pandas, fiona, shapely, pyproj first as they're required for geopandas.

  • For descartes and pandas, installation could be done directly with 'pip install descartes' or 'pip install pandas' from command line.

  • For fiona, shapely, pyproj:

    • Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/

    • Download the corresponding .whl for your python version (e.g. Fiona-1.7.8-cp34-cp34m-win32.whl for Python 3.4). Important: download win32 version only, as win_amd64 version did not work (God knows why)

    • Install each package with 'pip install <path to download folder>Fiona-1.7.8-cp34-cp34m-win32.whl'
  • For geopandas:
    • Download its .whl file from https://pypi.python.org/pypi/geopandas/0.2.1
    • Install geopandas using the same command line as with fiona, shapely, pyproj.



回答4:


On Windows, I download (from http://www.lfd.uci.edu/~gohlke/pythonlibs/) and install the .whl files for GDAL, Fiona, pyproj, Shapely and Rtree using the command

pip install filename.whl

for each .whl file.

As a final step I run

pip install https://github.com/geopandas/geopandas/archive/master.zip

because I want the dev version of geopandas. The conda w/ ioos method looks easier - but I haven't tried it yet.




回答5:


I recently destroyed my Anaconda 5.2 distribution by trying to upgrade from Geopandas 0.3.0 to 0.4.0. I didn't notice, that command conda install -c conda-forge geopandas wanted to upgrade a bunch of packages, downgrade others and remove Anaconda 5.2.

Anyway, after reinstalling Anaconda 5.2 I ran into several Command "python setup.py egg_info" failed with error code 1 in <filepath> errors with no ways around it. I even tried installing Anaconda 5.2 on a different computer, still same error message.

I then stumbled on this website Geoff Boeing: Using geopandas on Windows. It did the trick for me. In case this link stops functioning at some point, I'll just copy-paste the contents below.

My notes: I installed cp36-versions from Gohlke as Anaconda 5.2 comes with Python 3.6.5. My Anaconda installation was installed by default to C:\Users\<Username>\AppData\Local\Continuum\anaconda3\Lib\site-packages so I used that as the environment variable.

Installing geopandas and its dependencies manually

  1. First and most important: do not try to directly pip install or conda install any of the dependencies – if you do, they will fail in some way later, often silently or obscurely, making troubleshooting difficult. If any are already installed, uninstall them now.
  2. Download the wheels for GDAL, Fiona, pyproj, rtree, and shapely from Gohlke. Make sure you choose the wheel files that match your architecture (64-bit) and Python version (2.7 or 3.5). If Gohlke mentions any prerequisites in his descriptions of those 5 packages, install the prerequisites now (there might be a C++ redistributable or something similar listed there)
  3. If OSGeo4W, GDAL, Fiona, pyproj, rtree, or shapely is already installed, uninstall it now. The GDAL wheel contains a complete GDAL installation – don’t use it alongside OSGeo4W or other distributions.
  4. Open a command prompt and change directories to the folder where you downloaded these 5 wheels.
  5. pip install the GDAL wheel file you downloaded. Your actual command will be something like: pip install GDAL-1.11.2-cp27-none-win_amd64.whl
  6. Add the new GDAL path to the windows PATH environment variable, something like C:\Anaconda\Lib\site-packages\osgeo
  7. pip install your Fiona wheel file, then your pyproj wheel file, then rtree, and then shapely.
  8. Now that GDAL and geopandas’s dependencies are all installed, you can just pip install geopandas from the command prompt



回答6:


I'm using Window 10 and only had to reinstall Visual C++ 2015. Then i had to install fiona manually from here. After that i installed geopandas successfully.




回答7:


problem(Windows 10 x64, Python 3.4+):

1.Install Visual C++ 2010 Express (download). (Do not install Microsoft Visual Studio 2010 Service Pack 1 )

2.Remove all the Microsoft Visual C++ 2010 Redistributable packages from Control Panel\Programs and Features. If you don't do those then the install is going to fail with an obscure "Fatal error during installation" error.

then: pip install pyproj



来源:https://stackoverflow.com/questions/34427788/how-to-successfully-install-pyproj-and-geopandas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!