LORD-MicroStrain / MSCL

MicroStrain Communication Library
https://www.microstrain.com/software/mscl
MIT License
78 stars 57 forks source link

DLL fails load of _mscl.pyd on Windows 10 and Anaconda3 #73

Closed craiganderson-53546 closed 5 years ago

craiganderson-53546 commented 5 years ago

I have a WSDA-2000, SensorConnect, Anaconda3. I successfully read data from the WSDA a month ago without issue using Python in Jupyter Notebook. Then I got a new laptop. I reloaded the latest SensorConnect and Anaconda3, and did a conda update. All my other notebooks run fine but my notebook that imports mscl fails. I downloaded the latest mcsl.py (3.0.6) into ..\Anaconda\lib and _mscl.pyd into ..\Anaconda3\DLLs, both paths appear in sys.path. The error occurs in mscl.py as it tries to load _mscl.pyd. The same error occurs from a py script run from the Anaconda prompt. The error appears as follows...

ImportError Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\lib\mscl.py in swig_import_helper() 17 try: ---> 18 fp, pathname, description = imp.find_module('_mscl', [dirname(file)]) 19 except ImportError:

~\AppData\Local\Continuum\anaconda3\lib\imp.py in find_module(name, path) 295 else: --> 296 raise ImportError(_ERR_MSG.format(name), name=name) 297

ImportError: No module named '_mscl'

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)

in ----> 1 import mscl ~\AppData\Local\Continuum\anaconda3\lib\mscl.py in 26 fp.close() 27 return _mod ---> 28 _mscl = swig_import_helper() 29 del swig_import_helper 30 else: ~\AppData\Local\Continuum\anaconda3\lib\mscl.py in swig_import_helper() 18 fp, pathname, description = imp.find_module('_mscl', [dirname(__file__)]) 19 except ImportError: ---> 20 import _mscl 21 return _mscl 22 if fp is not None: ImportError: DLL load failed: The specified module could not be found.
rwslord commented 5 years ago

I don't have any experience with Anaconda, but in general, I always have _mscl.pyd sitting directly next to mscl.py. Could you try copying _mscl.pyd into the ..\Anaconda\lib folder as well, and see if that helps?

craiganderson-53546 commented 5 years ago

Already tried that, no love.

Sent from my iPhone, please excuse spelling and brevity

On Feb 14, 2019, at 3:40 PM, Richard Stoneback notifications@github.com wrote:

I don't have any experience with Anaconda, but in general, I always have _mscl.pyd sitting directly next to mscl.py. Could you try copying _mscl.pyd into the ..\Anaconda\lib folder as well, and see if that helps?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

rwslord commented 5 years ago

Can you see if you can import mscl from a python file that is directly next to mscl.py and _mscl.pyd?

You also mentioned a version 3.0.6. Is that your python version? MSCL is up to 48.0.0, and it's compiled with Python 2.7, and 3.6. I'm not sure if mscl.py for Python 3.6 will work with python 3.0.6.

craiganderson-53546 commented 5 years ago

Yes, just verified with both files in the same location and the symptom persists. The version string I gave was in the mscl.py file header, perhaps not useful. I am running Python 3.7.1

rwslord commented 5 years ago

I've replicated your issue. I'm looking into it now.

rwslord commented 5 years ago

So it looks like, since MSCL was built with Python 3.6, it can't be imported using 3.7, unfortunately. I would have thought this would work, but there is specifically a Python36.dll that it needs.

So unfortunately, I think the only options here are to use Python 3.6, or to compile it yourself using Python3.7.

craiganderson-53546 commented 5 years ago

Yeah, makes sense. I tried with the release of mscl that was current when I originally started this project, then I looked for a history of versions of Python to see what I had installed before. I will try to recompile it first. Thanks for the help!

rwslord commented 5 years ago

no problem!

craiganderson-53546 commented 5 years ago

AH! Way easier to simply create a 3.6 env within my existing Anaconda (e.g., conda create <> python=3.6). Instructions are available here