Reputation: 4891
I understand some dependencies need to be satisfied before installing cartopy and basemap. I sorted out most of them using pip
(like numpy
etc.).
I found out there are some cartopy issues with Proj.4 and some basemap issues with GEOS.
I thought the python bindings to the Java project Proj.4 were enough and I am a bit lost with the C++ library GEOS (I think GDAL is enough for GEOS, I've linked it to the python world this way: pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version
).
I would prefer avoiding all those things like anaconda, canopy, etc.
If possible I would like to use only pip
on both Ubuntu (apt-get
, only if pip
is not enough) and Mac OSX (homebrew e.g. brew install <some_package>
, only if pip
is not enough).
cartopy gets stuck on a version of Proj.4 that is too old. The pip
output says: Proj4 version 4.8.0 is installed, but cartopy requires at least version 4.9.0.
.
I was assuming this pip
install of the python bindings was enough, but it does not solve the problem:
$ pip show pyproj
Name: pyproj
Version: 1.9.5.1
Summary: Python interface to PROJ.4 library
Home-page: https://github.com/jswhit/pyproj
Author: Jeff Whitaker
Author-email: [email protected]
License: OSI Approved
Location: /usr/local/lib/python2.7/dist-packages
Requires:
I don't get why the python bindings to Proj.4 are not enough, even if those bindings are the latest version available using pip
.
basemap is stuck in different ways:
pip2 install basemap
somehow I get Could not find a version that satisfies the requirement basemap (from versions: )
No matching distribution found for basemap
But then from the basemap documentation I found that library is not linked to the pip
repositories for some reason and needs to be installed from the source code. So I've run: pip2 install https://github.com/matplotlib/basemap/archive/v1.0.7rel.tar.gz
and I believe that a GEOS
compilation of the C++ code is triggered and after a while it stops with at the bottom this:
In file included from src/_geoslib.c:255:0:
/usr/include/geos_c.h:151:22: note: expected ‘GEOSMessageHandler’ but argument is of type ‘void (*)(char *, char *)’
extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function,
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/_geoslib.o -lgeos_c -lgeos -o build/lib.linux-x86_64-2.7/_geoslib.so
/usr/bin/ld: cannot find -lgeos
collect2: error: ld returned 1 exit status
/usr/bin/ld: cannot find -lgeos
collect2: error: ld returned 1 exit status
error: Command "x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/_geoslib.o -lgeos_c -lgeos -o build/lib.linux-x86_64-2.7/_geoslib.so" failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-QVrKRr-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-EgAOPT-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-QVrKRr-build/
I am not sure what I am doing wrong:
pip install
bindings)pip
? If that's not enough, then what should I do more? Perhaps some apt-get
of a GEOS pakcage that avoids triggering the GEOS compilation inside the basemap installation?I am a bit confused in this no mans land between Java binaries, C++ binaries and bindings to python packages.
Upvotes: 2
Views: 4526
Reputation: 1978
As you noticed cartopy
requires Proj.4
lib in version >=4.9. On Ubuntu (newer than 16.04) you can install it through sudo apt-get install libproj-dev
.
For older Ubuntu, e.g. 14.04, you could simply download newest package from 16.04 (xenial libproj-dev) and install it manually. Notice that it depends on libproj9 in version 4.9. Remember to remove older version before you update them with
sudo apt-get purge libproj-dev libproj9
Once you done that, open and download packages from links for appropriate architecture (from your log I understand that's amd64). Double click downloaded files in order librproj9
and libproj-dev
or use
sudo dpkg -i <path_to_file>
.
Upvotes: 1