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

setup.py imports from Cython before checking for Cython #34

Closed
jsolbrig opened this issue Mar 2, 2018 · 10 comments
Closed

setup.py imports from Cython before checking for Cython #34

jsolbrig opened this issue Mar 2, 2018 · 10 comments

Comments

@jsolbrig
Copy link

jsolbrig commented Mar 2, 2018

As discussed in Unidata/netcdf4-python#767, setup.py calls from Cython.Build import cythonize before it requires Cython to be installed. As a consequence, building without Cython previously installed fails with the following error:

Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    from Cython.Build import cythonize
ImportError: No module named Cython.Build
@jhamman
Copy link
Collaborator

jhamman commented Mar 3, 2018

What is the desired behavior here? netcdftime depends on cython, as does netcdf4.

@jswhit - how do you get around this in netcdf4?

jswhit added a commit that referenced this issue Mar 3, 2018
@jswhit
Copy link
Collaborator

jswhit commented Mar 3, 2018

I think pull request #35 should fix it (untested). Based on https://stackoverflow.com/questions/37471313/setup-requires-with-cython

@jswhit
Copy link
Collaborator

jswhit commented Mar 5, 2018

@jsolbrig, can you test this and let us know if it fixes the problem?

@jsolbrig
Copy link
Author

jsolbrig commented Mar 5, 2018

@jswhit Yep, that solved it. I'm also able to build netcdf4-python against it.

jhamman pushed a commit that referenced this issue Mar 21, 2018
* fix for issue #34

* put setuptools in requirements.txt

* fix typo
@jhamman
Copy link
Collaborator

jhamman commented Apr 27, 2018

closed via #35

@jhamman jhamman closed this as completed Apr 27, 2018
@terokinnunen
Copy link

Looks like this issue came back in release 1.0.3.

[terokinnunen@localhost tmp]$ python3 -m venv venv
[terokinnunen@localhost tmp]$ source venv/bin/activate
(venv) [terokinnunen@localhost tmp]$ pip install -U pip setuptools
Collecting pip
  Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/e7/16/da8cb8046149d50940c6110310983abb359bbb8cbc3539e6bef95c29428a/setuptools-40.6.2-py2.py3-none-any.whl
Installing collected packages: pip, setuptools
  Found existing installation: pip 18.0
    Uninstalling pip-18.0:
      Successfully uninstalled pip-18.0
  Found existing installation: setuptools 40.4.3
    Uninstalling setuptools-40.4.3:
      Successfully uninstalled setuptools-40.4.3
Successfully installed pip-18.1 setuptools-40.6.2
(venv) [terokinnunen@localhost tmp]$ pip install cftime
Collecting cftime
  Using cached https://files.pythonhosted.org/packages/80/23/cd5513106c709f1faa3623bb34a5284b55ea7dad4229103b68c154d8e39f/cftime-1.0.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-mz69t_45/cftime/setup.py", line 6, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-mz69t_45/cftime/
(venv) [terokinnunen@localhost tmp]$

@ghost
Copy link

ghost commented Dec 3, 2018

I confirm, same problem with cftime v. 1.0.3.

Collecting cftime (from netcdf4>=1.3.1->-r requirements.txt (line 7))
  Using cached https://files.pythonhosted.org/packages/80/23/cd5513106c709f1faa3623bb34a5284b55ea7dad4229103b68c154d8e39f/cftime-1.0.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "", line 1, in 
      File "C:\Users\ererkka\AppData\Local\Temp\pip-install-1vo__ug_\cftime\setup.py", line 6, in 
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'

@jswhit
Copy link
Collaborator

jswhit commented Dec 3, 2018

@bjlittle, can you take a look at this? I think you added cythonize in pull request #83. As discussed in pull request #35 (issue #34) we need to pass .pyx files to Extension (which can handle that as of version 18.0). That way we are not importing cython before setup_requires is invoked.

@jswhit
Copy link
Collaborator

jswhit commented Dec 3, 2018

Pull request #98 should fix this (again), but I haven't tested yet in an environment without cython.

@jswhit
Copy link
Collaborator

jswhit commented Dec 5, 2018

This was just fixed by merging pull request #98

@jswhit jswhit closed this as completed Dec 5, 2018
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