Skip to content

Instantly share code, notes, and snippets.

@ghing ghing/
Created Oct 8, 2019

What would you like to do?
Installing landsat-util on MacOS with Python 3.7

Installing landsat-util on MacOS with Python 3.7

Last updated October 8, 2019.

Or don't

If you have expereince with Docker, running the Dockerized landsat-util is probably the easiest way to avoid all these dependency issues.

The problem

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.

The current 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.

There's hope

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)
  • Homebrew
  • 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:

. ./venv/bin/activate

Install the fork of landsat-util with the updated dependencies:

pip install git+`

Fix pycurl:

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.