1

When trying to import SkewT into my python3 code on a Mac (Mojave 10.14.6):

from metpy.plots import SkewT

I get the error:

ModuleNotFoundError: No module named 'cartopy'

pip3 install cartopy gives the output

Collecting cartopy
  Downloading https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz (8.9MB)
     |████████████████████████████████| 8.9MB 616kB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Complete output from command /usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpj50b1vfe:
  ERROR: 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.
  ----------------------------------------
ERROR: Command "/usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpj50b1vfe" failed with error code 1 in /private/tmp/pip-install-b5cu8485/cartopy

To start, I tried to install Proj and geos, but pip3 only lists version 0.1.0 for proj and 0.2.2 for geos. Before I get too far down this rabbit hole, I thought I'd see if anyone else has encountered this problem. Thanks!

Janine
  • 13
  • 2
  • 7

3 Answers3

0

Do you use Conda? The easiest way to remedy this problem is to install CartoPy (or MetPy for that manner) via conda, so that all of the right dependencies are also downloaded: conda install -c conda-forge cartopy or conda install -c conda-forge metpy. Pip doesn't bring all of them together, so that leads to this problem being raised.

zbruick
  • 316
  • 1
  • 9
0

Thanks. Without conda, I was also able to complete this (more painful) installation:

    - brew install geos
    - brew install proj
    - pip3 install cython
    - pip3 install git+https://github.com/SciTools/cartopy.git@master 
(see http://louistiao.me/posts/installing-cartopy-on-mac-osx-1011/)
Janine
  • 13
  • 2
  • 7
0

So it looks like MetPy 0.10 accidentally picked up a hard dependency on CartoPy, which we did not really plan. You can track our resolution of that here.

CartoPy depends on a lot of compiled libraries that are not pip-installable unfortunately. Your best bet is to look at CartoPy's install instructions. If you're using Anaconda or Canopy, those distributions have pre-built CartoPy packages available.

One option to work around this is to install MetPy 0.9:

pip install metpy==0.9
DopplerShift
  • 5,472
  • 1
  • 21
  • 20