Installing landsat-util on MacOS with Python 3.7
Last updated October 8, 2019.
If you have expereince with Docker, running the Dockerized landsat-util is probably the easiest way to avoid all these dependency issues.
The current version of landsat-util on PyPi is 0.13.1 and was released on January 19, 2017. It has a hard dependency on
numpy==1.10.4, which seems to have trouble building with Python 3.7. Numpy issue #10687 has more information on troubles building older versions of numpy with Python 3.7. That issue is fixed in newer versions of numpy.
develop (the default) branch of
landsat-util on GitHub doesn't have that dependency on numpy, but does depend on an outdated version of rasterio (
rasterio~=0.36). Matching versions of rasterio also have trouble being installed using Python 3.7. Also, the current version of rasterio at the time of writing this is 1.1.0, a completely different major version. This is pointed out in landsat-util issue #261.
Finally, one of landsat-util's dependencies itself depends on the pycurl package. Pycurl has some issues with recent versions of Mac OS due to OpenSSL no longer being installed system-wide without Homebrew.
GitHub user alex-sever-h made a fork of landsat-util modified to have updated dependencies (and fixes for things moving around in rasterio) that works with Python 3.7. They submitted a pull request to landsat-util, but it hasn't been merged.
- Mac OS X (I did this on 10.13.6)
- Python 3.7 (I used Python 3.7.3 installed with pyenv)
- OpenSSL installed via Homebrew
- You have all the system libraries needed to install recent versions of numpy, matplotlib, etc.
Let's do it
Create a virtualenv to isolate the dependencies:
mkdir landsat-env python -m venv ./venv
Activate this virtual environment:
Install the fork of landsat-util with the updated dependencies:
pip install git+https://github.com/alex-sever-h/landsat-util.git`
pip uninstall pycurl PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" pip install --no-cache-dir pycurl==7.43.0