Closed damercer closed 3 years ago
I did a little looking around and found libm2k.dll in the System32 folder. It was dated 2/1/21. In the same folder there is a libiio.dll dated 10/24/20 which I verified as the ones placed there by libm2k-0.4.0-Windows-setup.exe (I looked before and after running the set-up program). Are these the right DLL files for use with 64 bit Python 3.8? System32 is in the PATH variable.
Doug
Hi,
The path looks good. Also, the libm2k.dll and libiio.dll you found in System32 match the ones I got when testing the libm2k installer on a fresh Python38 install, using the version you mentioned above. Can you check if libm2k.py and _libm2k.pyd can be found in the following location: C:\Program Files\Python38\Lib\site-packages ? (libm2k.py is found in the shell - as seen above, but I would like to know where did the _libm2k.pyd get installed)
Thank you! -Alexandra
Yes, both files are there and also dated 2/1/21. Doug
The following image is a dependency tree of the _libm2k.pyd file, the reason for prompting that issue might be that a required .dll is missing.
-Alexandra
We could also try to add C:\Program Files\Python38\Lib\site-packages to the PATH and see if that changes anything.
-Alexandra
The VCRUNTIME vs vcruntime should not make a difference in this case. Could you send me the libm2k-wininst.log (should be located in the Python38 directory)? There are a few other things we can try to find out where this is coming from.
import sys
import os
for line in sys.path: print(line)
for path in os.environ["PATH"].split(";"): print(path)
import libm2k
print(libm2k.__file__)
The first 'for' should output the search paths for Python modules: similar to the following: C:\Python38\python38.zip C:\Python38\DLLs C:\Python38\lib C:\Python38 C:\Python38\lib\site-packages
The second 'for' should output your Path, in the same order as mentioned in the comments above.
The last print, if the import works, should output the location where your Python shell was opened. Because all the required files are contained in the attached zip, running a shell inside that directory, should automatically look for required files/modules in that same location. If not found, then move to the next locations mentioned by the Path.
-Alexandra libm2k-win64.zip
============ RESTART: C:/ALICEm2k/libm2k-win64/libm2k-win64/test.py ============ C:/ALICEm2k/libm2k-win64/libm2k-win64 C:\ALICEm2k\libm2k-win64\libm2k-win64 C:\Program Files\Python38\python38.zip C:\Program Files\Python38\DLLs C:\Program Files\Python38\lib C:\Program Files\Python38 C:\Users\merce\AppData\Roaming\Python\Python38\site-packages C:\Program Files\Python38\lib\site-packages C:\Program Files\Python38\Scripts\ C:\Program Files\Python38\ C:\Program Files\Python38\Lib\site-packages C:\Python27\ C:\Python27\Scripts\ C:\WINDOWS\system32 C:\WINDOWS C:\WINDOWS\System32\Wbem C:\WINDOWS\System32\WindowsPowerShell\v1.0\ C:\WINDOWS\System32\OpenSSH\ C:\Program Files\Calibre2\ C:\Program Files\doxygen\bin C:\Program Files\Inkscape\bin C:\Program Files (x86)\Analog Devices\libsmu C:\Program Files\Analog Devices\libsmu C:\Users\merce\AppData\Local\Microsoft\WindowsApps C:\Users\merce\AppData\Local\GitHubDesktop\bin
C:\Users\merce\AppData\Local\Microsoft\WindowsApps C:/ALICEm2k/libm2k-win64/libm2k-win64\libm2k.py
It seems to have found libm2k properly in there.
One thing I noticed that looks funny is these two lines to different site packages: C:\Users\merce\AppData\Roaming\Python\Python38\site-packages C:\Program Files\Python38\lib\site-packages The frist one might be a leftover from an earlier failed attempt at installing Python3.8.9? I had uninstalled it before redoing the current one to a different place that worked. Thanks Doug
Hi,
The path you mentioned is the only thing that does not look right here. I think it might be a leftover if you tried to install Python just for the current user (i am not 100% sure).
Is there anything that might disturb the libm2k.py files at that location?
Since that path has priority over the correct site-packages path, it might lead libm2k.py to a wrong location for _libm2k.pyd.
Can you try to remove it from PYTHONPATH?
You can either run
import sys
sys.path.remove('C:\Users\merce\AppData\Roaming\Python\Python38\site-packages')
But I think that will only be applied until you close the Python shell. Or you can go to the ENV variables in Windows and check whether that faulty path is listed under PYTHONPATH.
Thank you! -Alexandra
I looked in that Roaming folder and it only had numpy in it ( I guess that is where PIP3 put it). I moved the numpy folders to the site_packages folder under Python38 and deleted the Roaming stuff. numpy still loads now. That line is missing from the Path but still can't import libm2k (except in that test directory).
Do you have a 64bit or 32bit machine?
Quad core I5 64 bit processor running Win 10 2004 64 bit OS
I think I have identified what is (was) missing on my system. I ran the m2kcli tool in a command window and it said that msvcr120.dll was missing. I copied the msvcr120.dll file you included in that zip file into the System32 folder (where all the other .dll files are) and I can now import libm2k in the Python38 shell. Here is a snapshot of what shows up in the program manager as for Microsoft Visual C++:
One of these must not include the right runtime to match what you are using on your development machines for libm2k.
Your libm2k installer needs another check to see if this dll also needs to be installed on the end user's system.
The m2kcli now works as well by the way.
Thanks
Doug
Hi,
Thank you for looking into this. I will add the missing DLLs in the building/packaging process and commit the changes to master.
-Alexandra
Thanks.
I think you have not added this dll, I tried with the latest version and it only worked after copying that dll.
Hi,
Thank you for looking into this. I will add the missing DLLs in the building/packaging process and commit the changes to master.
-Alexandra
Adding a comment to a closed issue probably will not get the developers attention. If you still have an issue on this topic re-open the issue or make a new open issue.
@damercer I could sort this issue out by the same DLL method that you have mentioned earlier. But a better help was the already closed issue #98. Thank you for your comment though, I will keep this in my mind.
Now that libsmu is also available for Python 3.8 I've decided to go back and try installing libm2k on my Windows computer. I have a newly installed version of Python 3.8.9 64 bit installed. I down loaded libm2k released version 0.4.0 today. After running the libm2k-0.4.0-Windows-setup.exe setup program with the add Python 3.8 bindings checked, I tried to import libm2k in the Python shell.
This is what it spit back: Python 3.8.9 (tags/v3.8.9:a743f81, Apr 6 2021, 14:02:34) [MSC v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.
Is there another step I missed? It finds the \libm2k.py file but not the compiled DLL. Is something missing from the PATH variable.
C:>path PATH=C:\Program Files\Python38\Scripts\;C:\Program Files\Python38\;C:\Python27\;C:\Python27\Scripts\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Calibre2\;C:\Program Files\doxygen\bin;C:\Program Files\Inkscape\bin;C:\Program Files (x86)\Analog Devices\libsmu;C:\Program Files\Analog Devices\libsmu;C:\Users\merce\AppData\Local\Microsoft\WindowsApps;C:\Users\merce\AppData\Local\GitHubDesktop\bin;;C:\Users\merce\AppData\Local\Microsoft\WindowsApps
C:>
Not an urgent problem. I'm not looking to write any M2k Python right away. Just trying to see if libm2k is working for me now.
Thanks
Doug