mariomulansky/PySpike

Installation failure: failed to import Cython: DLL load failed

dmfolgado opened this issue · 8 comments

Hello, I was trying to install PySpike and I'm experiencing some installations issues. I have a x64 Windows 7 with Anaconda and Python 2.7.8. I installed Cython according to the instructions and added also to PATH. When I run a pip install pyspike I het the following error:

C:\Program Files\Anaconda>pip install pyspike
Collecting pyspike
  Using cached pyspike-0.1.3.tar.gz
Requirement already satisfied (use --upgrade to upgrade): numpy in c:\program files\anaconda\lib\site-packages (from pyspike)
Installing collected packages: pyspike
  Running setup.py install for pyspike
    failed to import Cython: DLL load failed: dll initialization routine failed (dynamic-link library).
error: Cython does not appear to be installed
Complete output from command "C:\Program Files\Anaconda\python.exe" -c "import setuptools, tokenize;__file__='c:\\users\\user\\appdata\\local\\temp\\pip-build-rgcrb\\pyspike\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-1a3jrv-record\install-record.txt --single-version-externally-managed --compile:
running install

running build

running build_py

creating build

creating build\lib.win-amd64-2.7

creating build\lib.win-amd64-2.7\pyspike

copying pyspike\distances.py -> build\lib.win-amd64-2.7\pyspike

copying pyspike\function.py -> build\lib.win-amd64-2.7\pyspike

copying pyspike\python_backend.py -> build\lib.win-amd64-2.7\pyspike

copying pyspike\spikes.py -> build\lib.win-amd64-2.7\pyspike

copying pyspike\__init__.py -> build\lib.win-amd64-2.7\pyspike

copying pyspike\cython_add.c -> build\lib.win-amd64-2.7\pyspike

copying pyspike\cython_distance.c -> build\lib.win-amd64-2.7\pyspike

running build_ext

failed to import Cython: DLL load failed: dll initialization routine failed (dynamic-link library).

error: Cython does not appear to be installed

----------------------------------------
Command ""C:\Program Files\Anaconda\python.exe" -c "import setuptools, tokenize;__file__='c:\\users\\user\\appdata\\local\\temp\\pip-build-rgcrb\\pyspike\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-1a3jrv-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\user\appdata\local\temp\pip-build-jrgcrb\pyspike

Thanks for your help.

Hi,
thanks for your interest in PySpike.
I have no Windows machine to test right now, I only checked installation on Linux and Mac so I'm not sure I can be of help right now. Have you tried if cython is working in general? I thought Anaconda already contains cython, so maybe the separate installation of cython did some harm instead of good?

Hello Mario,

Thanks for your quick reply and congratulations on your team efforts to build this program.
I re-installed Cython because I already had problems with the built-in Cython package from Anaconda with PySpike. Cython does appear to be correctly installed in my machine. It has been added to PATH and also a line in the distutils.cgf. Additionally I made Cython import with IPython and received no errors. I have another backup windows machine. I'll try to make a fresh install in that machine and let you know.

Ok I see. I will try to find a Windows machine to see if I have the same problem and see what I can do about it. Another idea would be to get the latest PySpike from github and try to generate the library by hand with python setup.py build_ext --inplace

I will appreciate that Mario. Regarding the manual installation I have already tried that with a git clone and it gives me the same error:
failed to import Cython: DLL load failed: dll initialization routine failed (dynamic-link library).
error: Cython does not appear to be installed.

Ok, I made a fresh install on a 32 bits Windows 7 machine and I think it successfully installed PySpike. I ran the ISI and SPIKE-distances examples and I was able to compute the metrics. Just a small notice that I think on your README examples isi_profil.avrg() should be isi_profile.avrg().
This is not however the machine that I intend to work with but at least the problem seems to be completely from my end. I have to try to re install Anaconda as well on my working machine.

Thanks for the update and thanks for noting the typo, I'll correct that.
I'm glad PySpike is working in general on Windows as well. I just want to note that PySpike also works without cython. It then falls back on the (very) slow python implementations. But if you don't deal with too big data sets this might be sufficient.

Hi Mario. I confirm that I re-installed Anaconda on my working machine and I have successfully installed PySpike. However I am unable to get this work with Cython so it always falls back to the slower implementations. I think the issue is with Cython itself and Windows 64 bit versions. It seems Cython, MinGW and Windows 64 bit do not get along well with each other. Here it's an example with Enthought distribuction: http://stackoverflow.com/questions/24344402/how-to-get-cython-to-use-mingw-with-enthought-canopy-distribution
Probably playing with a workaround to use another C/C++ compilers rather than MinGW will makes this work (but I'm not completely sure how to make that). For now, I think I will keep using the fallback implementation as I use CUDA MKL to speed the things up a little bit.
As a final note, on my Windows 32-bit machine I did not have any problems and Cython is running smooth.
Thanks for your help!

EDIT: Probably this one will help other people too - https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows

Ok. I see. As this is seemingly a Cython problem and not related to PySpike I will close the issue here. Thanks for posting your findings, though.