Installing Cartopy on Ubuntu 14.04 (or Travis-CI)
I'm becoming increasingly convinced that using GitHub to share projects, even in work-in-progress (WIP) state is quite beneficial. For one, someone can quickly point out that such project exists or suggest a tool which would simplify some operations. What's more, with tools like Travis-CI or CodeCov it's easy to follow whether the project is actually buildable or whether updates broke functionally of other features. Real convenience! Although, there is some price to pay for these goods.
One of the projects I'm currently working on is MapViz. Its aim is to provide easy to use visualization and summary for country and other administrative units data, mainly EuroStat dataset. This project heavily depends on Cartopy library - a great tool for handling geographical data, however, not so great when it comes to installing. It comes with many dependencies, some of which have to be installed separately. For example, the newest version of Cartopy requires Proj.4 lib in version 4.9, which is not available for Ubuntu older than 16.04. This is unfortunate, because Travis allows to use Ubuntu in versions 12.04 (precise) or 14.04 (trusty). For these only Proj.4 in version 4.8 is available and that's not enough. Once these are obtained, installing Cartopy with
pip is easy, it's just:
$ pip install cartopy
but the trick is to install all dependencies.
The workaround is dirty, but it works. One can directly download and install Proj.4 and its dependencies (libproj9) from 16.04 (xenial) repo. For exact links go to libproj9 and libproj-dev, select your architecture and then click on any mirror link. (Just a note that by default Travis-CI uses amd64.) So, download it with wget and then install with dpkg. Here's an example:
$ wget http://es.archive.ubuntu.com/ubuntu/pool/universe/p/proj/libproj9_4.9.2-2_amd64.deb $ sudo dpkg -i libproj9_4.9.2-2_amd64.deb
For comparison, here is my whole .travis.yml file:
[code language="bash" highlight="12,13,14,15" title="MapViz/.travis.ml"] dist: trusty language: python python: - 2.7 - 3.4 - 3.5 before_install: - sudo apt-get -qq update - sudo apt-get install -y libproj-dev proj-bin proj-data - sudo apt-get install -y python-pyproj - sudo apt-get install -y libc6 - wget http://es.archive.ubuntu.com/ubuntu/pool/universe/p/proj/libproj9_4.9.2-2_amd64.deb - sudo dpkg -i libproj9_4.9.2-2_amd64.deb - wget http://es.archive.ubuntu.com/ubuntu/pool/universe/p/proj/libproj-dev_4.9.2-2_amd64.deb - sudo dpkg -i libproj-dev_4.9.2-2_amd64.deb install: - pip install -r requirements.txt script: - python setup.py install