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

missing cython requirement #127

Closed
danielhrisca opened this issue Jan 10, 2018 · 20 comments
Closed

missing cython requirement #127

danielhrisca opened this issue Jan 10, 2018 · 20 comments

Comments

@danielhrisca
Copy link
Contributor

>python.exe -m pip install mdfreader
Collecting mdfreader
  Downloading mdfreader-2.7.4.tar.gz (653kB)
    100% |████████████████████████████████| 655kB 655kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Daniel\AppData\Local\Temp\pip-build-i93z7xpm\mdfreader\setup.py", line 6, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
@ratal
Copy link
Owner

ratal commented Jan 10, 2018

I do not reproduce your issue. I will check later on windows.
Are you sure your config is ok because looking at Cython tutorial, I have exact same line for cythonize import ?

@danielhrisca
Copy link
Contributor Author

Try with a Python installation or virtualenv that does not have cython already installed

@ratal
Copy link
Owner

ratal commented Jan 11, 2018

cython is normally a requirement for mdfreader but you want to propose it as an optionnal requirement ?

@danielhrisca
Copy link
Contributor Author

Actually the problem is if you need cython during the installation, and cython is not already installed, you will get the error even though cython is included in the install_requires

This probably helps:
http://cython.readthedocs.io/en/latest/src/reference/compilation.html?highlight=compilation#distributing-cython-modules

@ratal
Copy link
Owner

ratal commented Jan 12, 2018

Thanks Daniel for the tip.
I think on linux, there is no issue installing cython and have correct compilation environment.
But on windows, most difficult is probably to have suitable compilation environment rather than installing cython. Do you experiment and want to include it in asammdf for performance up ?

@ratal
Copy link
Owner

ratal commented Jan 12, 2018

I modified setup.py to avoid error when cython is not installed, in last commit, thanks.

@danielhrisca
Copy link
Contributor Author

danielhrisca commented Jan 12, 2018

It's a real pain in the ass to get the compilation working in Windows, this is why I normally rely on WinPython and https://www.lfd.uci.edu/~gohlke/pythonlibs/ , and I will just use numpy without custom cython or C extensions for asammdf.

Like I said the cython issue came when I had to use a stripped down Pyhon installation that did not have cython installed (WinPyhton 3.7.0 in this particular case)

@ratal
Copy link
Owner

ratal commented Jan 18, 2018

Doing the same for windows but using anaconda. For big files (several Gb), I think cython is worth the pain for mdfreader.
Should be ok now, closing but reopen if you face again this issue.

@ratal ratal closed this as completed Jan 18, 2018
@waltherg
Copy link

waltherg commented Apr 3, 2018

@ratal I second the issue raised by @danielhrisca: the way you import numpy, Cython etc. at the top of your setup.py file is for lack of a better expression just plain wrong. These imports at the top of your setup.py break the usual way Python packages are installed - requirements of your package should be listed somewhere in your setup.py so that they're installed but you shouldn't import them in your setup.py the way you're doing it right now.

See the setup.py file of e.g. pandas which also relies heavily on numpy:

https://github.com/pandas-dev/pandas/blob/master/setup.py

@ratal ratal reopened this Apr 3, 2018
@ratal
Copy link
Owner

ratal commented May 18, 2018

Thanks, I remove all import in header and made sure it woudl install without cython, in dev branch

@danielhrisca
Copy link
Contributor Author

daniel@daniel-VirtualBox:~$ pip3 install cython
Collecting cython
  Downloading https://files.pythonhosted.org/packages/19/eb/c4d9f3beafd5ac0615936860bcee41d93ca58f8734a16715da0037d2c468/Cython-0.28.2-cp36-cp36m-manylinux1_x86_64.whl (3.4MB)
    100% |████████████████████████████████| 3.4MB 398kB/s 
Installing collected packages: cython
Successfully installed cython-0.28.2
daniel@daniel-VirtualBox:~$ pip3 install https://github.com/ratal/mdfreader/archive/dev.zip
Collecting https://github.com/ratal/mdfreader/archive/dev.zip
  Downloading https://github.com/ratal/mdfreader/archive/dev.zip
     / 450kB 706kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 346, in get_provider
        module = sys.modules[moduleOrReq]
    KeyError: 'numpy'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-zkevh2nd-build/setup.py", line 9, in <module>
        numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1136, in resource_filename
        return get_provider(package_or_requirement).get_resource_filename(
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 348, in get_provider
        __import__(moduleOrReq)
    ModuleNotFoundError: No module named 'numpy'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-zkevh2nd-build/

@AkbarAlam
Copy link

I have tried to install and still have this problem. any solution?

@ratal
Copy link
Owner

ratal commented May 30, 2018

Hi Daniel,
I guess you have this error because there is no numpy installed in your virtual environment, completly virgin except Cython ?
I looked a bit and coud not find any other way than just informing user he should install numpy. Normally pip should handle this depency but with this code, it is not possible I think; I need those include_dirs and if numpy is not installed I do not know how to request numpy install.

@ratal
Copy link
Owner

ratal commented May 30, 2018

Hi Gourab,
I guess your issue is the one described at the beginning of this thread. Did you try installing the git dev branch ?

@danielhrisca
Copy link
Contributor Author

Hello Aymeric,

this happened on a fresh Ubuntu install. There must be a way to make this work, maybe you should have a deeper look at some other projects.

@cristi-neagu
Copy link
Contributor

@danielhrisca
Copy link
Contributor Author

@cristi-neagu
Copy link
Contributor

I see it's already in here. Thanks

@AkbarAlam
Copy link

@ratal yeah . but getting this error error: Setup script exited with error: Unable to find vcvarsall.bat

@ratal
Copy link
Owner

ratal commented Jun 1, 2018

Hi,
I think this is different issue (here about how to install mdfreader without cython installed)
You are trying to build dataRead cython (you probably installed) module but you are missing Microsoft Visual C++ Compiler for you installed Python version.
Up to you, either install with (need proper compilation environment) or without cython (pure python)

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

No branches or pull requests

5 participants