soft-matter / pims_nd2

Python nd2 reader based on the ND2 SDK
Other
16 stars 8 forks source link

Fix dll not found error #18

Closed aaristov closed 4 years ago

aaristov commented 4 years ago

While importing pims_nd2 in python 3.8, I get the following error:

c:\users\aaristov\appdata\local\programs\python\python38-32\lib\site-packages\pims_nd2\nd2reader.py in 6 from pims.base_frames import FramesSequenceND 7 import os ----> 8 from . import ND2SDK as h 9 from ctypes import c_uint8, c_uint16, c_float 10

c:\users\aaristov\appdata\local\programs\python\python38-32\lib\site-packages\pims_nd2\ND2SDK.py in 21 raise OSError("The bitsize does not equal 32 or 64.") 22 os.environ["PATH"] += os.pathsep + os.path.join(dlldir) ---> 23 nd2 = cdll.LoadLibrary('v6_w32_nd2ReadSDK.dll') 24 25

c:\users\aaristov\appdata\local\programs\python\python38-32\lib\ctypes__init__.py in LoadLibrary(self, name) 449 450 def LoadLibrary(self, name): --> 451 return self._dlltype(name) 452 453 cdll = LibraryLoader(CDLL)

c:\users\aaristov\appdata\local\programs\python\python38-32\lib\ctypes__init.py in init__(self, name, mode, handle, use_errno, use_last_error, winmode) 371 372 if handle is None: --> 373 self._handle = _dlopen(self._name, mode) 374 else: 375 self._handle = handle

FileNotFoundError: Could not find module 'v6_w32_nd2ReadSDK.dll'. Try using the full path with constructor syntax.

Adding the absolute path fixes the problem.

rbnvrw commented 4 years ago

Hi @aaristov thank you for taking the time to fix this! Is there a reason why you changed the version to 1.0-dev? If not, could you please change it back? Then I'll merge the PR.

jonathan-kuo11 commented 4 years ago

Hi--completely new to Github here, but I just installed pims_nd2 and I ran into the same problem. Just wanted to put it out here that I had to input the full path to v6_w32_nd2ReadSDK.dll into ND2SDK.py to fix it, which seems to be a manual version of what @aaristov has done automatically. How do I get the changes that @aaristov has written?

aaristov commented 4 years ago

pip install git+https://github.com/aaristov/pims_nd2.git

In setup.py you can use the following trick to override default pip requirement:

setup(
    install_requires=[
          "pims_nd2 @ git+https://github.com/aaristov/pims_nd2.git",
    ]

BTW, I'm looking forward to the pull request to be finally merged. It's already long validated and just pending a click.

caspervdw commented 4 years ago

Thanks @aaristov . Done and distributed a new release.

WaterKnight1998 commented 4 years ago

The version 1.1 and merge didn't solve the error: https://github.com/soft-matter/pims_nd2/issues/21