Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't install package cartopy #85

Closed
swnesbitt opened this issue Mar 13, 2018 · 8 comments
Closed

can't install package cartopy #85

swnesbitt opened this issue Mar 13, 2018 · 8 comments

Comments

@swnesbitt
Copy link

swnesbitt commented Mar 13, 2018

I tried installing Scitools' cartopy package

!pip install geos
!pip install pyproj
!pip install cartopy

and the installer reports errors.

Requirement already satisfied: geos in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: lxml in /usr/local/lib/python3.6/dist-packages (from geos)
Requirement already satisfied: flask in /usr/local/lib/python3.6/dist-packages (from geos)
Requirement already satisfied: click>=2.0 in /usr/local/lib/python3.6/dist-packages (from flask->geos)
Requirement already satisfied: Werkzeug>=0.7 in /usr/local/lib/python3.6/dist-packages (from flask->geos)
Requirement already satisfied: Jinja2>=2.4 in /usr/local/lib/python3.6/dist-packages (from flask->geos)
Requirement already satisfied: itsdangerous>=0.21 in /usr/local/lib/python3.6/dist-packages (from flask->geos)
Requirement already satisfied: MarkupSafe in /usr/local/lib/python3.6/dist-packages (from Jinja2>=2.4->flask->geos)
Requirement already satisfied: pyproj in /usr/local/lib/python3.6/dist-packages
Collecting cartopy
  Using cached Cartopy-0.16.0.tar.gz
    Complete output from command python setup.py egg_info:
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Plex/Scanners.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Plex/Actions.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Pythran.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Lexicon.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Scanning.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Parsing.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Visitor.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/FlowControl.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Code.py because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Runtime/refnanny.pyx because it changed.
    Compiling /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Tempita/_tempita.py because it changed.
    [ 1/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Code.py
    [ 2/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/FlowControl.py
    [ 3/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Lexicon.py
    [ 4/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Parsing.py
    [ 5/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Pythran.py
    [ 6/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Scanning.py
    [ 7/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Compiler/Visitor.py
    [ 8/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Plex/Actions.py
    [ 9/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Plex/Scanners.py
    [10/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Runtime/refnanny.pyx
    [11/11] Cythonizing /tmp/easy_install-1yz5rh__/Cython-0.27.3/Cython/Tempita/_tempita.py
    Unable to find pgen, not compiling formal grammar.
    warning: no files found matching '2to3-fixers.txt'
    warning: no files found matching 'Doc/*'
    warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.pxd' under directory 'Cython/Utility'
    
    Installed /tmp/pip-build-l42wavod/cartopy/.eggs/Cython-0.27.3-py3.6-linux-x86_64.egg
    /tmp/pip-build-l42wavod/cartopy/setup.py:178: 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), ))
    /tmp/pip-build-l42wavod/cartopy/setup.py:234: UserWarning: Unable to determine Proj4 version. Ensure you have 4.9.0 or later installed, or installation may fail.
      '.'.join(str(v) for v in PROJ_MIN_VERSION), ))
    Proj4 version 0.0.0 is installed, but cartopy requires at least version 4.9.0.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-l42wavod/cartopy/
@craigcitro
Copy link
Contributor

Yes, there seem to be a few problems here:

  1. As with your initial report, before cython is installed, pip hung with no output. I'm going to look into that.
  2. Once you get past that, you need a handful of additional packages.

I think this is a complete recipe:

!apt-get install libproj-dev proj-data proj-bin
!apt-get install libgeos-dev
!pip install cython
!pip install cartopy

LMK if that doesn't get you unstuck. (I'll keep this open for the first issue until I know more.)

@craigcitro
Copy link
Contributor

oic -- the "freeze before cython is installed" was actually "craig is too impatient to wait for output to start appearing".

so the remaining issue here was cartopy install instructions; the above seems to work, and I'll add them to the install snippets.

@swnesbitt LMK if you're still blocked.

@swnesbitt
Copy link
Author

unstuck! thanks.

screenshot 2018-03-13 12 22 39

craigcitro added a commit that referenced this issue Mar 13, 2018
We've seen external users get confused trying to install cartopy, since the
website doesn't really have install instructions, eg
#85.

This CL just adds a snippet with install instructions, and adds it to the list
of imports we offer pointers for.

RELNOTES: n/a

Build log: https://console.cloud.google.com/gcr/builds/35109215-56ad-4dcd-8311-cb89dd6713f7?project=colab-datalab
Pushed docker image: gcr.io/colab-datalab/datalab:auto-188827433-2018-03-12T22-13-15-342061983-07-00

PiperOrigin-RevId: 188931623
@jrieffel
Copy link

I'm having trouble installing Cartopy with the same test as above. The error printed in colab is:

Geometry must be a Point or LineString

and the error in the log is:

python3: geos_ts_c.cpp:3991: int GEOSCoordSeq_getSize_r(GEOSContextHandle_t, const geos::geom::CoordinateSequence*, unsigned int*): Assertion `0 != cs' failed.

@colaboratory-team
Copy link
Contributor

See SciTools/cartopy#1346 (comment):

To install in Colab on Ubuntu using pip, you need to install the library dependencies:

!apt-get install -qq libgdal-dev libproj-dev
Then !pip install cartopy works.

@jrieffel
Copy link

No luck:

!apt-get install -qq libgdal-dev libproj-dev
!pip install cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines()
plt.show()

produces the same error.


Mar 19, 2020, 1:08:06 PM | WARNING | WARNING:root:kernel 1cf4389e-ca0b-42cc-9c88-401640a630e9 restarted
-- | -- | --
Mar 19, 2020, 1:08:06 PM | INFO | KernelRestarter: restarting kernel (1/5), keep random ports
Mar 19, 2020, 1:08:06 PM | WARNING | python3: geos_ts_c.cpp:3991: int GEOSCoordSeq_getSize_r(GEOSContextHandle_t, const geos::geom::CoordinateSequence*, unsigned int*): Assertion `0 != cs' failed.

@vitorepsantos
Copy link

vitorepsantos commented Aug 3, 2020

Yes, there seem to be a few problems here:

1. As with your initial report, before cython is installed, `pip` hung with no output. I'm going to look into that.

2. Once you get past that, you need a handful of additional packages.

I think this is a complete recipe:

!apt-get install libproj-dev proj-data proj-bin
!apt-get install libgeos-dev
!pip install cython
!pip install cartopy

LMK if that doesn't get you unstuck. (I'll keep this open for the first issue until I know more.)

Had to install one more

apt install python3-dev

@felnne
Copy link

felnne commented Oct 15, 2020

I recently hit issues with this too, specifically the issue @jrieffel mentioned, which I was I was able to resolve by following the advice from SciTools/cartopy#871.

In case it's useful to others my install is:

# not using `python-cartopy` package as it doesn't include all build dependencies
!apt-get install libproj-dev proj-bin proj-data
!apt-get install libgeos-dev

# shapely needs to be reinstalled to use the same geos install as cartopy (https://github.com/SciTools/cartopy/issues/871)
!pip uninstall -y shapely
!pip install --no-binary shapely shapely
!pip install cartopy

This then produces output with something like:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
ax.set_extent([80, 170, -45, 30], crs=ccrs.PlateCarree())

ax.stock_img()
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.COASTLINE)

plt.show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants