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

Adjust setup.py to reflect PEP-518, instead of throwing a "you need cython" error. #1112

Closed
Demetrio92 opened this issue Sep 4, 2018 · 4 comments
Milestone

Comments

@Demetrio92
Copy link

Demetrio92 commented Sep 4, 2018

Description

Fix setup.py to install cython, instead of giving the user an error.

pypa/pip#5761 (comment)
https://www.python.org/dev/peps/pep-0518/

Code to reproduce

On a fresh vitrual enviroment:

pip install cartopy

Traceback

(mypython) me@my_laptop:~/path/tmp$ python
Python 3.5.3+ (default, Nov 29 2017, 08:55:08) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
(mypython) me@my_laptop:~/path/tmp$ pip install cartopy
Collecting cartopy
  Using cached https://files.pythonhosted.org/packages/f5/7a/4a16db7c81f11b3c5889c5b913d9a5724c704a6947c5a87ec59c4a8985ac/Cartopy-0.16.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/tmp/pip-install-7r1fl7u1/cartopy/setup.py", line 47, in <module>
        from Cython.Distutils import build_ext
    ImportError: No module named 'Cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-7r1fl7u1/cartopy/setup.py", line 49, in <module>
        raise ImportError('Cython 0.15.1+ is required to install cartopy.')
    ImportError: Cython 0.15.1+ is required to install cartopy.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-7r1fl7u1/cartopy/

Operating system

Ubuntu 16.04

@benoit-pierre
Copy link

Technically, that's not adding PEP 518 support, just fixing the existing workaround so it works with setuptools>=36.7.0.

For PEP 518 support, a new pyproject.toml file should be added:

[build-system]
requires = ["Cython>=0.15.1", "numpy>=1.10", "setuptools", "wheel"]

@felixdivo
Copy link

Great that this is finally solved! 😄

@chaitan94
Copy link

It's great that this is finally solved.

But unfortunately it has also been un-solved later 😛
Refer to: 454a911

From the commit it seems this was because it results in some version mismatch in numpy coming from build dependencies vs numpy comping from actual dependency (although I am not completely sure what the exact reason is).

I am not sure how cartopy's build works, and what solutions are there to prevent this, but can this possibly be solved with a slightly modern build tool like poetry/dephell? I know that is sort of significant change to the project, but if that sounds like a good idea maybe I can try and take a dig at this. Would love to know maintainers thoughts on this (maybe from @dopplershift, @pelson or @QuLogic probably?).

@chaitan94
Copy link

Should this issue be ideally re-opened at least?

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

5 participants