DLL issue when importing sima

206 views
Skip to first unread message

Rylan Larsen

unread,
Oct 23, 2014, 2:42:43 PM10/23/14
to sima-...@googlegroups.com
I recently stumbled upon SIMA and am very interested in trying the tutorial and  running it on some of my own data to compare its performance to other software we have been using.

However,  I am running into a DLL issue when importing sima in the tutorial script or even just by the command "import sima". I have listed the dependencies installed and the command error below. I have encountered this type of issue before when a 64 bit DLL is not available. However before I go an install 32 bit winpython to attempt to solve this, I thought I would ask if any users have encountered a similar error during installation. Any thoughts on solutions? Thanks in advance.


import sima

SIMA: Python package for sequential image analysis.
Developed by Patrick Kaifosh, Jeffrey Zaremba, Nathan Danielson.
Copyright (C) 2014 The Trustees of Columbia University in the City of New York.
Licensed under the GNU GPL version 2 or later.
Documentation: http://www.losonczylab.org/sima
Version 0.3.1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\sima\__init__.py", line 9, in <module>
    from sima.imaging import ImagingDataset
  File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\sima\imaging.py", line 21, in <module>
    import sima.segment as segment
  File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\sima\segment.py", line 26, in <module>
    import sima.oPCA as oPCA
  File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\sima\oPCA.py", line 16, in <module>
    import sima._opca as _opca
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.


Installed dependencies (via pip.get_installed_distributions() ) in WinPython-64bit-2.7.6.4
numpy==1.8.1
scipy==0.13.3
matplotlib==1.3.1
scikit-image==0.10.1
shapely==1.4.3
opencv-python==2.4.8

Patrick Kaifosh

unread,
Oct 24, 2014, 7:30:58 AM10/24/14
to sima-...@googlegroups.com
Thanks for the feedback. This looks like a problem with the installation -- in particular, the compiled _opca.c . What method did you use to install the SIMA package? Did you use a Windows installer (32 bit, or 64 bit?), or did you install from source with "python setup.py install" ?

Rylan Larsen

unread,
Oct 24, 2014, 6:13:55 PM10/24/14
to sima-...@googlegroups.com
Initially, I attempted to install with the sima-0.3.1.win-amd64-py2.7.exe file thinking that would be easiest, but that was the approach that produced the described
error. I also tried several other approaches including pip wheel
sima-0.3.1-cp27-none-win_amd64.whl and "python setup.py install", however all these approaches produced the same "ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed."

The approach that worked to resolve this error and allow for import sima to run was to install cython and then follow through most the instructions described in 64bitcythonextensiononwindows which included installing Windows SDK .NET 3.5 SP1, running the SDK shell, setting the environment variables as described in the link. Only then, when I ran python setup.py install from within the SDK shell did it seem to compile everything correctly.

 I have not been able to determine what is missing from the windows installers preventing them from compiling everything correctly. Perhaps worth mentioning, another 64-bit python user (on windows) encountered the same issue with the installer trying it independently. The only workaround I found seems to be to not use the installers.

Patrick Kaifosh

unread,
Oct 28, 2014, 11:02:57 AM10/28/14
to sima-...@googlegroups.com
Thanks again for the detailed feedback. I have confirmed that there is indeed a problem with the 64-bit windows installers, and I have removed these installers from pypi. We are working on figuring out how to properly create the 64 bit Windows installers. It sounds like you are having more luck with WinPython than we are with Anaconda for 64 bit, so I may switch to using that to create the installers.

Rylan Larsen

unread,
Oct 28, 2014, 2:59:33 PM10/28/14
to sima-...@googlegroups.com
To summarize what I have seen work for now two users, the method that works to install 64-bit Sima for windows is to build from the source (sima-0.3.1.zip). This of course involves cython, installing windows SDK  .NET (with the previously linked 64bit cython for windows instructions and running as administrator) , and running "python setup.py install" from the SDK shell.
We have not had any luck with 64-bit wheel, egg, msi, or exe files either. We have been able to build from the source with this method and then run Sima in both 64-bit WinPython and Anaconda. Hopefully this is useful for troubleshooting.

Thanks for releasing your software and code. While I have only had a few days to explore it so far, it appears to be very useful! 

Patrick Kaifosh

unread,
Oct 28, 2014, 3:47:00 PM10/28/14
to sima-...@googlegroups.com
We have uploaded new installers and a new wheel for 64 bit python on windows. It would be great if you could confirm whether these resolve the issues that you have been having with installation. Thanks again for all the feedback.

erik flister

unread,
Jun 9, 2015, 2:09:38 AM6/9/15
to sima-...@googlegroups.com
it looks like this bug i've been chasing down may be related to the solution found in this thread:

patrick -- could you weigh in?  how did you resolve "DLL load failed: A dynamic link library (DLL) initialization routine failed" for win64 installers?
-e
Reply all
Reply to author
Forward
0 new messages