Hi,
I have been struggling to get libm2k installed in python on my Mac computer.
I get the following error when importing libm2k in python:
I followed the install process that I could find online starting at https://wiki.analog.com/university/tools/m2k/libm2k/libm2k
Created a virtual environment starting from python3.10
However, I get the error pasted above when trying to import libm2k.
I did try to download the wheels directly from the libm2k python bindings GitHub but none of the wheels seemed to be compatible with my system/python version.
I am working on an iMAC with Monterey
I am familiar with linux, command line, ... willing to move some files manually in the right folders, but I cannot figure out where _libm2k.cpython-310-darwin.so wants the libiio files and how.
Thanks,
-- Peter Kinget
lallison - Moved from StudentZone (Analog Dialogue) to Software and Development Tools. Post date updated from Friday, May 17, 2024 3:37 PM UTC to Tuesday, June 24, 2025 9:24 PM UTC to reflect the move.
So I got this to work ... tl;dr: Use python 3.11
on mac os from a terminal in the folder where the packages are downloaded I did the following:
> sudo installer -pkg ./libiio-0.25.g29107ada.pkg -target /
> sudo installer -pkg ../macOS-11_latest_main_libiio.pkg -target /
> sudo installer -pkg ./libm2k-0.8.0.g5b961eb.pkg -target /
Then tried:
> /Library/Frameworks/libm2k.framework/Tools/m2kcli
⇒ did not work
Did again:
> sudo installer -pkg ./libiio-0.25.g29107ada.pkg -target /
> /Library/Frameworks/libm2k.framework/Tools/m2kcli
⇒ worked!
Installed python3.11 (using brew install python@3.11 )
In virtual environment for python 3.11:
> pip install -i https://test.pypi.org/simple/ libm2k --force-reinstall
Then things worked in python as well ...
Hi,
The issue here is that the wiki docs for libm2k you mentioned above are outdated. We will make sure to add the necessary changes there.
At the moment there is a major change done in libiio, which is the direct dependency for libm2k.
Libiio main branch (which you mentioned here: > sudo installer -pkg ../macOS-11_latest_main_libiio.pkg -target / ) points to the new version of libiio - v1.0. This is incompatible with libiio v0.25 and libm2k v0.8.0. Seeing how the documentation points to the latest nightly builds of libiio it is expected to get errors when trying to run libm2k.
We will update the documentation accordingly in order to point users to libiio v0.25 instead of the latest development build.
Doing just the following steps (based on what you described above) should suffice:
> sudo installer -pkg ./libiio-0.25.g29107ada.pkg -target /
> sudo installer -pkg ./libm2k-0.8.0.g5b961eb.pkg -target /
Thank you!
-Alexandra
Hi,
The issue here is that the wiki docs for libm2k you mentioned above are outdated. We will make sure to add the necessary changes there.
At the moment there is a major change done in libiio, which is the direct dependency for libm2k.
Libiio main branch (which you mentioned here: > sudo installer -pkg ../macOS-11_latest_main_libiio.pkg -target / ) points to the new version of libiio - v1.0. This is incompatible with libiio v0.25 and libm2k v0.8.0. Seeing how the documentation points to the latest nightly builds of libiio it is expected to get errors when trying to run libm2k.
We will update the documentation accordingly in order to point users to libiio v0.25 instead of the latest development build.
Doing just the following steps (based on what you described above) should suffice:
> sudo installer -pkg ./libiio-0.25.g29107ada.pkg -target /
> sudo installer -pkg ./libm2k-0.8.0.g5b961eb.pkg -target /
Thank you!
-Alexandra
Thanks!