Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using pip install to install Cartopy but missing Proj version at least 4.9.0

Tags:

It seems that I cannot get pip to install Cartopy on my computer. I work straight from the windows command line (no Anaconda or other proxy programs).

When I try "pip install cartopy" I get the expected:

C:\Users\Justin\Documents\Python Programs>pip install cartopy Collecting cartopy   Using cached https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz   Installing build dependencies ... done     Complete output from command python setup.py egg_info:     C:\Users\Justin\AppData\Local\Temp\pip-install-cetb0vj7\cartopy\setup.py:171: UserWarning: Unable to determine GEOS version. Ensure you have 3.3.3 or later installed, or installation may fail.       '.'.join(str(v) for v in GEOS_MIN_VERSION), ))     Proj 4.9.0 must be installed.      ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\Justin\AppData\Local\Temp\pip-install-cetb0vj7\cartopy\ 

I know that "pip install proj" does not actually get the correct module version so I went to https://proj4.org/install.html to download and install the OSGeo4W which I thought would solve my problem but has appeared not to (for reference I do still have this on my computer though).

So then I tried install the cartopy .whl directly from this https://www.lfd.uci.edu/~gohlke/pythonlibs/#cartopy website and tried using "pip install Cartopy-0.17.0-cp37-cp37m-win32.whl" (I use the the 32 bit version of Python3.7 so I am fairly certain this is the correct file). But I then get the error:

C:\Users\Justin\Documents\Python Programs>pip install Cartopy-0.17.0-cp37-cp37m-win32.whl     Processing c:\users\justin\documents\python programs\cartopy-0.17.0-cp37-cp37m-win32.whl         Requirement already satisfied: numpy>=1.10 in c:\users\justin\appdata\local\programs\python\python37\lib\site-packages (from Cartopy==0.17.0) (1.15.1)         Requirement already satisfied: setuptools>=0.7.2 in c:\users\justin\appdata\local\programs\python\python37\lib\site-packages (from Cartopy==0.17.0) (40.6.2)         Requirement already satisfied: six>=1.3.0 in c:\users\justin\appdata\local\programs\python\python37\lib\site-packages (from Cartopy==0.17.0) (1.11.0)         Collecting pyshp>=1.1.4 (from Cartopy==0.17.0)           Downloading https://files.pythonhosted.org/packages/08/3e/3bda7dfdbee0d7a22d38443f5cc8d154ff6d4701e615f4c07bf1ed003563/pyshp-2.0.1.tar.gz (214kB)             100% |████████████████████████████████| 215kB 1.4MB/s         Collecting shapely>=1.5.6 (from Cartopy==0.17.0)           Using cached https://files.pythonhosted.org/packages/a2/fb/7a7af9ef7a35d16fa23b127abee272cfc483ca89029b73e92e93cdf36e6b/Shapely-1.6.4.post2.tar.gz             Complete output from command python setup.py egg_info:             Traceback (most recent call last):               File "<string>", line 1, in <module>               File "C:\Users\Justin\AppData\Local\Temp\pip-install-sb4uyliy\shapely\setup.py", line 80, in <module>                 from shapely._buildcfg import geos_version_string, geos_version, \               File "C:\Users\Justin\AppData\Local\Temp\pip-install-sb4uyliy\shapely\shapely\_buildcfg.py", line 200, in <module>                 lgeos = CDLL("geos_c.dll")               File "c:\users\justin\appdata\local\programs\python\python37\lib\ctypes\__init__.py", line 356, in __init__                 self._handle = _dlopen(self._name, mode)             OSError: [WinError 126] The specified module could not be found 

So then I tried to download something called a tar.gz file, but this is where I lose myself. I am not familiar with tar.gz and I saw there you have to "./configure" the file path, but I was not sure how to do this nor was I sure where I should store said file. Any guidance around this issue would be so incredibly appreciated thank you.

like image 853
Justin Jones Avatar asked Dec 09 '18 23:12

Justin Jones


People also ask

How do you install Cartopy on Windows?

In order to install Cartopy, or to access its basic functionality, it will be necessary to first install GEOS, Shapely, and pyshp. Many of these packages can be installed using pip or other package managers such as apt-get (Linux) and brew (macOS).

How do I update my proj version?

Find “proj” under “Commandline_Utilities” and click the package in the “New” column until the version you want to install appears. Press next to install PROJ.


1 Answers

According to response to the corresponding Github issue, https://github.com/googlecolab/colabtools/issues/85#issuecomment-372532728, ubuntu users need to install some extra packages before installing Cartopy.

sudo apt-get install libproj-dev proj-data proj-bin   sudo apt-get install libgeos-dev   sudo pip install cython   sudo pip install cartopy   
like image 125
Chen Yazheng Avatar answered Sep 18 '22 13:09

Chen Yazheng