analogdevicesinc / libm2k

A C++ library (bindings for Python and C#) for interfacing with the ADALM2000
http://analogdevicesinc.github.io/libm2k
GNU Lesser General Public License v2.1
34 stars 32 forks source link

Add python 3.9 support #279

Closed jpnielsen closed 3 years ago

jpnielsen commented 3 years ago

Please add python 3.9.x support

Python 3.9 was released 2020-10-05

rgetz commented 3 years ago

Did you try Python 3.9 and run into issues/bugs?

jpnielsen commented 3 years ago

The installer lets me chose python 3.7 or 3.8 - not 3.9

https://github.com/analogdevicesinc/libm2k/releases/download/v0.5.0/libm2k-0.5.0-Windows-setup.exe

I was hoping you would keep this software updated. image

AlexandraTrifan commented 3 years ago

Hi,

I am looking into adding 3.9 to the build. Will come back with updates.

Thank you! -Alexandra

AlexandraTrifan commented 3 years ago

Hi,

Python 39 was added to the installer. This will be included in the next official release, but can be tested using the nightly builds. The latest nightly build can be found here: https://ci.appveyor.com/project/analogdevicesinc/libm2k/build/artifacts

-Alexandra

jpnielsen commented 3 years ago

Great.

I follow the Python 3 release and have been using 3.10 since its release 2021-10-04.

The installer for libm2k lets me choose Python 3.9 - and asks for my python installation.

image

On Wed, 20 Oct 2021 at 10:18, AlexandraTrifan @.***> wrote:

Hi,

Python 39 was added to the installer. This will be included in the next official release, but can be tested using the nightly builds. The latest nightly build can be found here: https://ci.appveyor.com/project/analogdevicesinc/libm2k/build/artifacts

-Alexandra

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/analogdevicesinc/libm2k/issues/279#issuecomment-947436031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGU7SNNMC277WUPEL7ZYLZTUHZ3MBANCNFSM5EZBS6IA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jpnielsen commented 3 years ago

Trying to run an example "bindings/python/examples/analog.py" - I renamed it adalm2k.py:

python .\adalm2k.py
Traceback (most recent call last):
  File "C:\Users\jpn99\source\python\adalm2k.py", line 30, in <module>
    import libm2k
  File "C:\Python310\lib\site-packages\libm2k.py", line 15, in <module>
    import _libm2k
ImportError: DLL load failed while importing _libm2k: The specified module could not be found.
jpnielsen commented 3 years ago
PS C:\Users\jpn99\source\python> dir C:\Python310\Lib\site-packages\*libm2k*

    Directory: C:\Python310\Lib\site-packages

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          20/10/2021    13.26                libm2k-0.5.0-py3.9.egg-info
-a---          20/10/2021    09.00        2234880 _libm2k.pyd
-a---          20/10/2021    08.59         362355 libm2k.py

PS C:\Users\jpn99\source\python> dir c:\windows\system32\*libm2k*

    Directory: C:\windows\system32

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          20/10/2021    07.02          53248 libm2k_lv.dll
-a---          20/10/2021    07.02         295936 libm2k-sharp-cxx-wrap.dll
-a---          20/10/2021    07.02         476672 libm2k.dll

PS C:\Users\jpn99\source\python> dir c:\windows\system32\*libiio*

    Directory: C:\windows\system32

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          20/10/2021    06.39          87040 libiio.dll
AlexandraTrifan commented 3 years ago

Hi,

It seems that you checked Python 3.10 when the installer required a path to your Python installation. The bindings were built for Python 3.9. The installer can't check the python version you provided, so you need to make sure you provide the correct version. These bindings are using a compiled python wrapper/layer which links to the specific Python version they were built with. Using them with another Python version can lead to undefined behaviour, like the one specified above: where the wrapper _libm2k.dll can't be found. If you have the Python3.9 installed, you can run the new installer and point it at that specific version.

Thank you! -Alexandra

jpnielsen commented 3 years ago

I only use Python 3.10

adisuciu commented 3 years ago

We cannot build libm2k for python 3.10 as our CI provider does not ship python 3.10 yet. When they start shipping it, we will update the installer.

jpnielsen commented 3 years ago

It kind of works when I installed Python 3.9 instead

But it said that my device was not connected ( it was blinking, when I ran the program)

I fixed that by installing the drivers and iio - apparently this libm2k installer didn't install everything needed to communicate with firmware 0.28


https://github.com/analogdevicesinc/plutosdr-m2k-drivers-win/releases/latest
https://github.com/analogdevicesinc/libiio/releases/latest
jpnielsen commented 3 years ago

image

I do get the "libxml" errors - perhaps because I'm running in the newest Powershell 7 on Windows 11.

AlexandraTrifan commented 3 years ago

Hi,

The connection issues might have been because the drivers were not installed. The libm2k installer provides an option to install (or overwrite) libiio on your computer.

There was a change of LibXML2 Libusb and Visual Studio compiler versions for both libm2k and libiio. For libm2k it's already on the master branch and in the nightly build that you installed. For libiio, it's still an open PR (https://github.com/analogdevicesinc/libiio/pull/753). You installed the latest libiio release which points to older versions of these dependencies, while the nightly build of libm2k points to the latest versions. Both projects will probably have a new release that will include all these changes. For now, you can reinstall libm2k and choose the option to overwrite libiio. This will get rid of the libxml2 issue displayed on the screen.

-Alexandra

jpnielsen commented 3 years ago

OK, thank you.