I am unable to install cartopy 0.17.0 from pypi, but have no problem installing directly from the git using pip install git+https://github.com/SciTools/cartopy@master. Seems like some kind of issue with the version on pypi.
$ pip install cartopy
on MacOS X
$ pip install cartopy
Collecting cartopy
Using cached https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... error
Complete output from command /Users/chris/.pyenv/versions/3.7.1/envs/clue/bin/python3.7 /Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/tmpcbaxbjw_:
Traceback (most recent call last):
File "/Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
main()
File "/Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-build-env-4zgg2er_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 115, in get_requires_for_build_wheel
return _get_build_requires(config_settings, requirements=['wheel'])
File "/private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-build-env-4zgg2er_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 101, in _get_build_requires
_run_setup()
File "/private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-build-env-4zgg2er_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 85, in _run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 36, in <module>
import versioneer
ModuleNotFoundError: No module named 'versioneer'
----------------------------------------
Command "/Users/chris/.pyenv/versions/3.7.1/envs/clue/bin/python3.7 /Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/tmpcbaxbjw_" failed with error code 1 in /private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-install-89uiyomd/cartopy
I also tried installing versioneer first and get the same error as above:
$ pip install versioneer
Requirement already satisfied: versioneer in /Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages (0.18)
$ pip install cartopy
Collecting cartopy
Using cached https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... error
Complete output from command /Users/chris/.pyenv/versions/3.7.1/envs/clue/bin/python3.7 /Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/tmpcbaxbjw_:
Traceback (most recent call last):
File "/Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
main()
File "/Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-build-env-4zgg2er_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 115, in get_requires_for_build_wheel
return _get_build_requires(config_settings, requirements=['wheel'])
File "/private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-build-env-4zgg2er_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 101, in _get_build_requires
_run_setup()
File "/private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-build-env-4zgg2er_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 85, in _run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 36, in <module>
import versioneer
ModuleNotFoundError: No module named 'versioneer'
----------------------------------------
Command "/Users/chris/.pyenv/versions/3.7.1/envs/clue/bin/python3.7 /Users/chris/.pyenv/versions/3.7.1/envs/clue/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/tmpcbaxbjw_" failed with error code 1 in /private/var/folders/1t/mrcp_h8913378fwmsc5k01k80000gn/T/pip-install-89uiyomd/cartopy
OSX with Python 3.7.1
Mac OSX Mojave, Python 3.7.1
0.17.0
Not using conda.
appdirs==1.4.3
atomicwrites==1.2.1
attrs==18.2.0
cftime==1.0.3.4
cgen==2017.1
Click==7.0
Cython==0.29.3
decorator==4.3.0
Flask==1.0.2
Flask-Cors==3.0.7
imageio==2.4.1
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
more-itertools==5.0.0
netCDF4==1.4.2
numpy==1.16.0
pandas==0.23.4
Pillow==5.4.1
pluggy==0.8.1
progressbar==2.5
py==1.7.0
pymbolic==2018.1
pyshp==2.0.1
pytest==4.1.1
python-dateutil==2.7.5
pytools==2019.1
pytz==2018.9
PyYAML==3.13
scipy==1.2.0
Shapely==1.6.4.post2
six==1.12.0
versioneer==0.18
Werkzeug==0.14.1
xarray==0.11.2
Also, if I do pip install Cartopy==0.16.0 then everything installs properly, so seems like an issue with 0.17.0.
I think that the versioneer.py file from the project root may be missing from our source distribution, does that sound right @pelson @QuLogic?
It's already included:
$ wget https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz
--2019-01-23 17:46:05-- https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz
Resolving files.pythonhosted.org (files.pythonhosted.org)... 151.101.1.63, 151.101.65.63, 151.101.129.63, ...
Connecting to files.pythonhosted.org (files.pythonhosted.org)|151.101.1.63|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8887169 (8.5M) [binary/octet-stream]
Saving to: βCartopy-0.17.0.tar.gzβ
Cartopy-0.17.0.tar.gz 100%[=======================================================================>] 8.47M 2.24MB/s in 3.8s
2019-01-23 17:46:09 (2.23 MB/s) - βCartopy-0.17.0.tar.gzβ saved [8887169/8887169]
$Β tar tf Cartopy-0.17.0.tar.gz | grep versioneer
Cartopy-0.17.0/versioneer.py
I also created a venv and installed without issue, so I'm confused:
$ python3 -m venv /tmp/what
$ source /tmp/what/bin/activate
$ pip install cartopy
Collecting cartopy
Downloading https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz (8.9MB)
100% |ββββββββββββββββββββββββββββββββ| 8.9MB 1.9MB/s
Installing build dependencies ... done
Collecting numpy>=1.10 (from cartopy)
Using cached https://files.pythonhosted.org/packages/3d/10/62224c551acfd3a3583ad16d1e0f1c9e9c333e74479dc51977c31836119c/numpy-1.16.0-cp37-cp37m-manylinux1_x86_64.whl
Collecting shapely>=1.5.6 (from cartopy)
Downloading https://files.pythonhosted.org/packages/97/36/1af447160f713d72f35dd7e749788367b7a13285c4af2fbd675128aa4e99/Shapely-1.6.4.post2-cp37-cp37m-manylinux1_x86_64.whl (1.5MB)
100% |ββββββββββββββββββββββββββββββββ| 1.5MB 2.6MB/s
Collecting pyshp>=1.1.4 (from cartopy)
Downloading https://files.pythonhosted.org/packages/08/3e/3bda7dfdbee0d7a22d38443f5cc8d154ff6d4701e615f4c07bf1ed003563/pyshp-2.0.1.tar.gz (214kB)
100% |ββββββββββββββββββββββββββββββββ| 215kB 6.5MB/s
Collecting six>=1.3.0 (from cartopy)
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=0.7.2 in /tmp/what/lib/python3.7/site-packages (from cartopy) (40.4.3)
Installing collected packages: numpy, shapely, pyshp, six, cartopy
Running setup.py install for pyshp ... done
Running setup.py install for cartopy ... done
Successfully installed cartopy-0.17.0 numpy-1.16.0 pyshp-2.0.1 shapely-1.6.4.post2 six-1.12.0
Had the same issue, in fact the problem comes from pip version 19.x and the pyproject.toml file in the cartopy tarball.
When the TOML file is available, pip 19.x activates PEP517 (https://www.python.org/dev/peps/pep-0517/) and its implementation currently has an issue: it does not include the current working directory in the Python path during the installation, so all the packages whose setup.py import their own/embedded modules are broken. This explains why pip cannot find the versioneer.py file during the cartopy installation.
Since the TOML file has been removed from the cartopy repository in a recent commit, installing from github does not trigger PEP517 and everything works fine.
There is an ongoing discussion on the pip repository about this: https://github.com/pypa/pip/issues/6163 (cartopy is also mentioned there btw, see https://github.com/pypa/pip/issues/6163#issuecomment-456822718)
The current workaround is to call pip install --no-use-pep517 cartopy, but uploading a new tarball which does not contain the TOML file (or with a modified setup.py that includes the current working directory before importing versioneer) would definitely be more user-friendly.
Thanks for the information @oceandatalab.
As you say, we've removed pyproject.toml for the next release, and it is good to have a workaround while pip & PEP517 is fully fleshed out.
I don't think there is anything more to be done in the cartopy codebase, but happy to re-open if there is.
Cheers,
I am having the same issue. I am trying to install on macOS
Hi @johnbarrett, did you try pip install git+https://github.com/SciTools/cartopy@master. This worked after I installed Cython. HTH
Hi,
pip install git+https://github.com/SciTools/cartopy@master
failed on this:
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/miniconda3/include -arch x86_64 -I/usr/local/miniconda3/include -arch x86_64 -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 -I/usr/local/miniconda3/include -I./lib/cartopy -I/usr/local/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/Cellar/geos/3.8.1/include -I/usr/local/miniconda3/include/python3.7m -c lib/cartopy/trace.cpp -o build/temp.macosx-10.7-x86_64-3.7/lib/cartopy/trace.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
lib/cartopy/trace.cpp:615:10: fatal error: 'ios' file not found
#include "ios"
^~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of Cartopy
This is on macos 10.14.6, conda 4.8.3.
I was running into that same thing fairly frequently. I put this in my~/.bash_profile which I think may help you. (Check out those linked issues if not)
# Adding additional flags for building C++ stuff
# https://github.com/matplotlib/matplotlib/issues/13609
# https://github.com/huggingface/neuralcoref/issues/97#issuecomment-436638466
export CFLAGS=-stdlib=libc++
# MACOSX_DEPLOYMENT for Python
MACOSX_DEPLOYMENT_TARGET=10.14
You should be able to get away with just MACOSX_DEPLOYMENT_TARGET=10.14--that should help make sure you pull in the right CFLAGS/compiler chain.
Someone should re-open this issue
Most helpful comment
Someone should re-open this issue