mattkjames7 / PyGeopack

Wrapper for geopack-08 used for the Tsyganenko magnetic field models
GNU General Public License v3.0
11 stars 2 forks source link

Import error on windows11 #17

Closed yw-h closed 1 year ago

yw-h commented 1 year ago

`Importing libgeopack.dll failed, please reinstall

FileNotFoundError Traceback (most recent call last) File c:\Users\tghyw\anaconda3\lib\site-packages\PyGeopack_CFunctions.py:19 18 addWindowsSearchPaths() ---> 19 libgeopack = ctypes.CDLL(getLibFilename()) 20 else:

File c:\Users\tghyw\anaconda3\lib\ctypes__init__.py:373, in CDLL.init(self, name, mode, handle, use_errno, use_last_error, winmode) 372 if handle is None: --> 373 self._handle = _dlopen(self._name, mode) 374 else:

FileNotFoundError: Could not find module 'c:\Users\tghyw\anaconda3\lib\site-packages\PyGeopack__data\geopack\lib\libgeopack.dll' (or one of its dependencies). Try using the full path with constructor syntax.`

Patch 1.1.2 can be imported well before, but can't import the newest patch. I saw you remove the lib files, but it seems like still try to find it.

mattkjames7 commented 1 year ago

Hello, sorry for the delayed reply.

It looks like the path which you show in your FileNotFoundError is missing a \ (PyGeopack__data should be PyGeopack\__data) - if this is the issue, then I have probably messed up the string formatting somehow. It may be something else though.

Can I ask how you installed it? And whether you had a previous version installed before? Some of the older versions can leave files behind when they are installed which could also cause problems...

In the mean time, I shall try and install Windows 11 on a VM and see if I can reproduce it, in case it is a W11-specific problem!

mattkjames7 commented 1 year ago

Right, I did some digging, and I found some issues, which I think I fixed... It didn't want to compile correctly for me in W11, leading to the same error you appear to have. It does work for me now.

Hopefully these steps should get it working for you:

Please let me know if this works for you if you get a chance. Cheers!

yw-h commented 1 year ago

It works well! Thank you for your continuous work!

mattkjames7 commented 1 year ago

Brilliant, thanks for using my code!