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

Cartopy should not build if dependencies are missing #610

Closed
jhamman opened this issue Apr 28, 2015 · 13 comments
Closed

Cartopy should not build if dependencies are missing #610

jhamman opened this issue Apr 28, 2015 · 13 comments

Comments

@jhamman
Copy link

jhamman commented Apr 28, 2015

cartopy was recently installed on our system and seems to be missing one or more dependencies. setup.py should take care of checking for all dependencies.

In [1]: import cartopy 
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-babd512b1575> in <module>()
----> 1 import cartopy

/usr/local/anaconda/envs/py3k/lib/python3.4/site-packages/cartopy/__init__.py in <module>()
    108 # convenience.
    109 import cartopy.crs
--> 110 import cartopy.feature

/usr/local/anaconda/envs/py3k/lib/python3.4/site-packages/cartopy/feature.py in <module>()
     27 import six
     28 
---> 29 import cartopy.io.shapereader as shapereader
     30 import cartopy.crs
     31 

/usr/local/anaconda/envs/py3k/lib/python3.4/site-packages/cartopy/io/shapereader.py in <module>()
     47 
     48 from shapely.geometry import MultiLineString, MultiPolygon, Point, Polygon
---> 49 import shapefile
     50 import six
     51 

ImportError: No module named 'shapefile'

It probably makes sense to add the required packages to a list in setup.py:

Setup(...
          install_requires=['shapefile', 'numpy >= 1.6', ...])

cc @jgaski

@ocefpaf
Copy link
Member

ocefpaf commented Apr 28, 2015

@jhamman what version of cartopy are you trying to install?

The latest version installs pyshp, which provides shapefile, via the setup.py by reading the requirements directory.

https://github.com/SciTools/cartopy/blob/master/requirements/default.txt#L4

@jhamman
Copy link
Author

jhamman commented Apr 28, 2015

cartopy version 0.11.0 installed via pip

@jhamman
Copy link
Author

jhamman commented Apr 28, 2015

If 0.12.0 checks for dependencies, you can close this issue. Thanks.

@ocefpaf
Copy link
Member

ocefpaf commented Apr 28, 2015

you can close this issue.

I cannot =)

Either you, as the issue owner, or a SciTools/cartopy dev) can though.

@QuLogic
Copy link
Member

QuLogic commented Apr 28, 2015

Yes, 0.12.0 does check dependencies, but we should ping @pelson because PyPI is outdated...

@jhamman
Copy link
Author

jhamman commented Apr 29, 2015

Ok. I'm closing now.

@pelson, can you update PyPI?

@jhamman jhamman closed this as completed Apr 29, 2015
@pelson
Copy link
Member

pelson commented Apr 29, 2015

@jhamman - yep, just done with python setup.py sdist upload.

@jhamman
Copy link
Author

jhamman commented Apr 29, 2015

Thanks @pelson!

@jhamman jhamman reopened this Apr 30, 2015
@jhamman
Copy link
Author

jhamman commented Apr 30, 2015

@pelson - We just tried to use you PyPI upload and it seems to be missing the requirements directory:

$ pip install cartopy
Collecting cartopy
  Using cached Cartopy-0.12.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-2_br6yjf/cartopy/setup.py", line 287, in <module>
        for name in os.listdir(os.path.join(HERE, 'requirements')):
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-2_br6yjf/cartopy/requirements'

@pelson
Copy link
Member

pelson commented May 1, 2015

I fixed the requirements issue by adding

$> cat MANIFEST.in 
include requirements/*.txt

Unfortunately, and very disappointingly, I still can't get PIP to play nice. 👎

$> python setup.py sdist --keep-temp
$> pip install Cartopy-0.12.0

Unpacking ./cartopy/cartopy_clean/Cartopy-0.12.0
  Running setup.py egg_info for package from Cartopy-0.12.0

Requirement already satisfied (use --upgrade to upgrade): Cython>=0.15.1 in python2.7/site-packages (from Cartopy==0.12.0.3)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6 in python2.7/site-packages (from Cartopy==0.12.0.3)
Requirement already satisfied (use --upgrade to upgrade): shapely>=1.5.6 in python2.7/site-packages (from Cartopy==0.12.0.3)
Requirement already satisfied (use --upgrade to upgrade): pyshp>=1.1.4 in python2.7/site-packages/pyshp-1.1.4-py2.7.egg (from Cartopy==0.12.0.3)
Requirement already satisfied (use --upgrade to upgrade): six>=1.3.0 in python2.7/site-packages (from Cartopy==0.12.0.3)
Installing collected packages: Cartopy
  Running setup.py install for Cartopy
    warning: build_py: byte-compiling is disabled, skipping.

    building 'cartopy.trace' extension
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/include -I./lib/cartopy -I/data/local/miniconda/include -I/include/python2.7 -c lib/cartopy/trace.c -o build/temp.linux-x86_64-2.7/lib/cartopy/trace.o
    gcc: lib/cartopy/trace.c: No such file or directory
    gcc: no input files
    error: command 'gcc' failed with exit status 1
    Complete output from command python -c "import setuptools;__file__='/var/tmp/pip-xhEJwJ-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/tmp/pip-uG74jK-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

...

running build_ext

building 'cartopy.trace' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/lib

creating build/temp.linux-x86_64-2.7/lib/cartopy

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/data/local/sci/r28/include -I./lib/cartopy -I/data/local/miniconda/include -I/data/local/sci/r28/include/python2.7 -c lib/cartopy/trace.c -o build/temp.linux-x86_64-2.7/lib/cartopy/trace.o

gcc: lib/cartopy/trace.c: No such file or directory

gcc: no input files

error: command 'gcc' failed with exit status 1

I'm on the verge of giving up on PIP altogether - conda just makes this stuff so much easier. I will take another look at this when my PIP 😡 subsides 😄

@QuLogic
Copy link
Member

QuLogic commented May 1, 2015

I'm not sure why your Cython does not print errors, but it looks like the sdist is still missing some files. This MANIFEST.in appears to work:

$ cat MANIFEST.in 
include requirements/*.txt
recursive-include lib *.pxd *.h

@pelson
Copy link
Member

pelson commented May 5, 2015

Thanks @QuLogic! I never use pip and found an old environment which had an ancient Cython version, hence the lack of stdout. That'll teach me to be lazy and not create a new environment for testing.

I've now uploaded cartopy v0.12.0 to pypi (with python setup.py sdist register upload).
@jhamman - would you mind checking it is working for you?

@jhamman
Copy link
Author

jhamman commented May 11, 2015

Looks like this is working ok now. Thanks.

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

4 participants