无法在MacOSX上安装Cartopy

问题描述 投票:0回答:1

说明

我无法使用pip在Mac上安装Cartopy。Proj已安装并运行。GEOS也已安装,但是我不确定它是否有效。如果有人对解决此问题有任何建议,我将不胜感激。

要复制和追溯的代码

$ pip install cartopy --no-binary cartopy
Collecting cartopy
  Using cached Cartopy-0.18.0.tar.gz (14.4 MB)
Requirement already satisfied: numpy>=1.10 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cartopy) (1.18.4)
Requirement already satisfied: shapely>=1.5.6 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cartopy) (1.7.0)
Requirement already satisfied: pyshp>=1.1.4 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cartopy) (2.1.0)
Requirement already satisfied: six>=1.3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cartopy) (1.14.0)
Requirement already satisfied: setuptools>=0.7.2 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cartopy) (41.2.0)
Skipping wheel build for cartopy, due to binaries being disabled for it.
Installing collected packages: cartopy
    Running setup.py install for cartopy ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6p/plpj2g0x0vs32g91rsdsx2n80000gn/T/pip-install-eatjklvl/cartopy/setup.py'"'"'; __file__='"'"'/private/var/folders/6p/plpj2g0x0vs32g91rsdsx2n80000gn/T/pip-install-eatjklvl/cartopy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/6p/plpj2g0x0vs32g91rsdsx2n80000gn/T/pip-record-37x0ie3d/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cartopy
         cwd: /private/var/folders/6p/plpj2g0x0vs32g91rsdsx2n80000gn/T/pip-install-eatjklvl/cartopy/
    Complete output (312 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/cartopy
    copying lib/cartopy/_version.py -> build/lib.macosx-10.9-x86_64-3.8/cartopy

[...]

    copying lib/cartopy/io/srtm.npz -> build/lib.macosx-10.9-x86_64-3.8/cartopy/io
    UPDATING build/lib.macosx-10.9-x86_64-3.8/cartopy/_version.py
    set build/lib.macosx-10.9-x86_64-3.8/cartopy/_version.py to '0.18.0'
    running build_ext
    building 'cartopy.trace' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/lib
    creating build/temp.macosx-10.9-x86_64-3.8/lib/cartopy
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.8/include -I./lib/cartopy -I/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/include -I/usr/local/Cellar/geos/3.8.1_1/include -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c lib/cartopy/trace.cpp -o build/temp.macosx-10.9-x86_64-3.8/lib/cartopy/trace.o
    lib/cartopy/trace.cpp:4439:48: error: use of undeclared identifier 'GEOD_ARCMODE'
      geod_genposition((&__pyx_v_self->geod_line), GEOD_ARCMODE, (__pyx_v_self->a13 * __pyx_v_t), (&__pyx_v_lonlat.y), (&__pyx_v_lonlat.x), NULL, NULL, NULL, NULL, NULL, NULL);
                                                   ^
    lib/cartopy/trace.cpp:8677:3: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
      0, /*tp_print*/
      ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
        Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
        ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    lib/cartopy/trace.cpp:8780:3: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
      0, /*tp_print*/
      ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
        Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
        ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    lib/cartopy/trace.cpp:8865:3: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
      0, /*tp_print*/
      ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
        Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
        ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    lib/cartopy/trace.cpp:8950:3: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
      0, /*tp_print*/
      ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
        Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
        ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    lib/cartopy/trace.cpp:12563:5: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
        0,
        ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
        Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
        ^
    /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    5 warnings and 1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6p/plpj2g0x0vs32g91rsdsx2n80000gn/T/pip-install-eatjklvl/cartopy/setup.py'"'"'; __file__='"'"'/private/var/folders/6p/plpj2g0x0vs32g91rsdsx2n80000gn/T/pip-install-eatjklvl/cartopy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/6p/plpj2g0x0vs32g91rsdsx2n80000gn/T/pip-record-37x0ie3d/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/cartopy Check the logs for full command output.

环境

Mac OS X 10.15.4点20.1不使用conda。

项目和GEOS

$ brew info proj  
proj: stable 7.0.1 (bottled), HEAD
Cartographic Projections Library
https://proj.org/
Conflicts with:
  blast (because both install a `libproj.a` library)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/proj.rb
==> Dependencies
Build: pkg-config ✘
Required: libtiff ✘
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 12,107 (30 days), 38,315 (90 days), 131,481 (365 days)
install-on-request: 1,635 (30 days), 5,538 (90 days), 17,198 (365 days)
build-error: 0 (30 days)

$ brew info geos
geos: stable 3.8.1 (bottled)
Geometry Engine
https://trac.osgeo.org/geos
/usr/local/Cellar/geos/3.8.1_1 (430 files, 9.7MB) *
  Poured from bottle on 2020-05-09 at 10:03:09
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/geos.rb
==> Dependencies
Build: swig ✘
Required: [email protected] ✔
==> Analytics
install: 12,717 (30 days), 36,681 (90 days), 121,342 (365 days)
install-on-request: 2,958 (30 days), 8,228 (90 days), 25,122 (365 days)
build-error: 0 (30 days)

点列表

$ pip list
Package                    Version
-------------------------- --------------
appdirs                    1.4.3
appnope                    0.1.0
attrs                      19.3.0
backcall                   0.1.0
bidict                     0.19.0
biosppy                    0.6.1
bleach                     3.1.4
certifi                    2020.4.5.1
chromedriver-autoinstaller 0.2.0
chromedriver-binary        83.0.4103.14.0
chromedriver-py            83.0.4103.14
cycler                     0.10.0
Cython                     0.29.17
decorator                  4.4.2
defusedxml                 0.6.0
distlib                    0.3.0
entrypoints                0.3
filelock                   3.0.12
future                     0.18.2
geckodriver-autoinstaller  0.1.0
h5py                       2.10.0
ipykernel                  5.2.0
ipython                    7.13.0
ipython-genutils           0.2.0
ipywidgets                 7.5.1
jedi                       0.16.0
Jinja2                     2.11.1
joblib                     0.14.1
jsonschema                 3.2.0
jupyter                    1.0.0
jupyter-client             6.1.2
jupyter-console            6.1.0
jupyter-core               4.6.3
kiwisolver                 1.2.0
MarkupSafe                 1.1.1
matplotlib                 3.2.1
mistune                    0.8.4
nbconvert                  5.6.1
nbformat                   5.0.5
nolds                      0.5.2
notebook                   6.0.3
numpy                      1.18.4
opensignalsreader          0.2.2
pandas                     1.0.3
pandocfilters              1.4.2
parso                      0.6.2
patsy                      0.5.1
pexpect                    4.8.0
pi                         0.1.2
pickleshare                0.7.5
pip                        20.1
prometheus-client          0.7.1
prompt-toolkit             3.0.5
ptyprocess                 0.6.0
Pygments                   2.6.1
pyhrv                      0.4.0
pyparsing                  2.4.7
pyrsistent                 0.16.0
pyshp                      2.1.0
python-dateutil            2.8.1
pytz                       2019.3
pyzmq                      19.0.0
qtconsole                  4.7.2
QtPy                       1.9.0
scikit-learn               0.22.2.post1
scipy                      1.4.1
seaborn                    0.10.0
selenium                   3.141.0
Send2Trash                 1.5.0
setuptools                 41.2.0
Shapely                    1.7.0
shortuuid                  1.0.1
six                        1.14.0
spectrum                   0.7.6
statsmodels                0.11.1
terminado                  0.8.3
testpath                   0.4.4
tornado                    6.0.4
traitlets                  4.3.3
urllib3                    1.25.9
versioneer                 0.18
virtualenv                 20.0.20
wcwidth                    0.1.9
webencodings               0.5.1
wheel                      0.34.2
widgetsnbextension         3.5.1
pip homebrew cartopy geos proj
1个回答
0
投票

已解决。我卸载了Shapely,GEOS,Proj,然后重新安装了它们。然后再按一次pip install cartopy --no-binary cartopy,就可以了。

© www.soinside.com 2019 - 2024. All rights reserved.