Comments (16)
Mmm... I just learnt that .pyd is only for WIndows.
Then why libm2k.py cannot find _libm2k module even though _libm2k.so is in the egg??
from libm2k.
Hi,
I need to setup a machine to test your steps. Could you tell me if you have any other Python version installed on your machine?
Can you check that you have the base library installed somewhere visible from your PATH? (you should have a libm2k.dylib which is the base C++ library). The libm2k.py and _libm2k.so are only additions for the Python bindings.
I will run some tests and get back to you.
Thank you,
-Alexandra
from libm2k.
Thank you for your support, Alexandra!
Actually I cannot find libm2k.dylib anywhere.
There is no mention of it in the build log, neither.
I can see libm2k-sharp-cxx-wrap.dylib created in the build directory.
It's for c sharp binding? Is there special switch needed to create libm2k.dylib?
On my Mac, I basically use Anaconda's Python with its environment management.
For this experiment, I have created a new conda environment called 'iio'
conda create -n iio python=3.6
source activate iio
pip install numpy,
Then installed libiio by installer package for Mac from
https://github.com/analogdevicesinc/libiio
I had to also download tar ball to install python binding.
from libm2k.
Hi,
Did you run "sudo make install"?
The "make" command builds the library, but "make install" installs the library in your system.
That should install libm2k.dylib in a location visible from your PATH.
-Alexandra
from libm2k.
Yes, I did run "sudo make install".
I run again and added to log:
build_log.txt
(L.760 and onward)
Again, the only *.dylib file appear is libm2k-sharp-cxx-wrap.dylib ...
from libm2k.
Hi,
The libm2k-sharp-cxx-wrap is related to the C# bindings, so it's not what we are looking for.
I made some changes on a development branch. Could you try those?
The branch is : https://github.com/analogdevicesinc/libm2k/tree/packaging .
The master version, the one that you were using, was building an OSX framework, libm2k.framework. From what I tested there was something wrong with the linking path.
In this updated version (branch packaging), the library is built as libm2k.dylib by default, not libm2k.framework.
Please remove everything in your build folder before building the new version.
Also, please remove this folder manually: /Library/Frameworks/libm2k.framework .(you should not need it anymore)
Thank you,
-Alexandra
from libm2k.
Thank you for your effort, Alexandra!
I tried the packaging branch and libm2k.dylib seem to be created! But still import libm2k results in "No module named '_libm2k'"...
Here is the log
libm2k_packaging_build_fail.log
L2: made sure /Library/Frameworks/libm2k.framework is deleted
L4: activate iio environment where libiio and its Python binding is working
L6: git clone libm2k
L15: switch to the packaging branch
L20: cmake
L56: make
L947: sudo make install
L1034: sudo python setup.py install
L1070: /usr/local/lib/libm2k.dylib exist!
L1075: running python in the 'build' folder and import libm2k gets "Segmentation fault: 11"
L1082: running python in other directory and import libm2k gets "No module named '_libm2k'"
from libm2k.
@tfcollins any thoughts - there was a lot of rpath manipulation we did for some of the Mac frameworks?
from libm2k.
Hi,
I investigated further and may have come with a fix for this.
You can test it from this branch: https://github.com/analogdevicesinc/libm2k/tree/fix-rpath
I managed to test it in the system (with Python.framework or python from /usr/local/bin), but also in the Anaconda env (as you described it).
We will use -DENABLE_CSHARP=OFF (if you don't need CSharp bindings, this will skip them and make the build a little faster).
- Cleanup the build folder.
cmake -DENABLE_CSHARP=OFF ..
make && sudo make install
- This will install everything in the system (/usr/local/lib/libm2k.dylib, /usr/local/include/all the include files).
- Next we need to install the python bindings in the Anaconda env.
sudo python setup.py install
will not install everything you need. - On my test machine (and on yours as well, from what I have seen in the log, this will only copy the .egg in the python folder ("Copying libm2k-0.1.0-py3.6.egg to /Users/ssato/anaconda3/envs/iio/lib/python3.6/site-packages") . We also need _libm2k.so and libm2k.py. So we can run :
sudo python setup.py install_lib
instead ofsudo python setup.py install
.
Not sure why this happens on Mac OSX. The behaviour is different on Linux for the same command.
-After this, you should be able to run python andimport libm2k
.
Please let us know if this worked for you.
I will investigate further why "install_lib" is needed on Mac OSX and will update the documentation once you can confirm it works.
Thank you,
-Alexandra
from libm2k.
Thanks again, Alexandra.
fix-rpath modifications resolved ModuleNotFoundError !
But then I'm greeted with Segmentation fault: 11 ...
Running code inside libm2k.py manually line by line, it seems the segmentation fault is raised in "import _libm2k"
L2: activate iio environment where libiio and its Python binding is working
L4: git clone libm2k
L13: switch to the fix-rpath branch
L18: cmake -DENABLE_CSHARP=OFF ..
L65: make
L952: sudo make install
L1037: sudo python setup.py install_lib
L1045: sudo python setup.py install
L1083: running python in the 'build' folder and import libm2k gets "Segmentation fault: 11" <-- this is same behavior as before
L1090: running python in other directory and import libm2k gets "Segmentation fault: 11" <-- this is improvement. It was "No module named '_libm2k'" before
L1099: tried "python -v -m libm2k"
L1274: importing _libm2k raises "Segmentation fault: 11"
from libm2k.
Hi,
Sorry for the delay. It took a bit of searching but I hope this fixes the issue.
I didn't run into the "Segmentation fault 11" issue until I updated the conda env (which also updated the python version).
I added another commit on the fix-rpath branch which should handle the issue. Can you try again and let us know the outcome?
Thanks,
-Alexandra
from libm2k.
Thank you very much for your continuous efforts, Alexandra!
Well, fix-rpath branch is missing in origin now... could you push it?
(iio) ShunyanoMacBook-puro-1424:libm2k ssato$ git checkout fix-rpath error: pathspec 'fix-rpath' did not match any file(s) known to git.
from libm2k.
Hi,
It was merged to master and removed.
All those changes should be on master now. Running git pull on the master branch should fetch the updates.
-Alexandra
from libm2k.
Excellent!
Compilation and installation succeeded. Now "import libm2k" seem to work alright.
I will get Pluto hardware back from my friend next week and start testing!
from libm2k.
Hi,
Happy to know it works fine.
Please be advised that libm2k is mainly for interfacing with ADALM2000 devices. ADALM-Pluto (which is an SDR) can also be controlled using this library, but it provides limited functionality (such as configuring sample rates / enabling devices / simple data capture etc.).
If you are looking for an easy way to configure Pluto in Python, you can look into the pyadi-iio Pluto example ( https://github.com/analogdevicesinc/pyadi-iio/blob/master/examples/pluto.py ) .
If you are looking for a C library, libiio is the way to go. ( https://github.com/analogdevicesinc/libiio )
Thank you,
-Alexandra
from libm2k.
I meant ADALM2000 actually.
And now I tested and confirmed that libm2k python examples work alright with ADALM2000 on my Mac. Thank you very much!
from libm2k.
Related Issues (20)
- spi_write_and_read() func does not work in version 0.5 HOT 8
- libm2k Runtime Error in Raspbberry Pi HOT 9
- Modifying the status of unused DIO pins after configuring SPI or I2C interfaces in the python bindings. HOT 8
- libm2k spi_write_and_read() function getting stuck when called multiple times HOT 9
- libm2k spi functionality in python HOT 1
- Understanding the ADALM 2000 sample rate HOT 2
- Cannot build libm2k HOT 2
- discrete values of analog out sample rate not communicated HOT 1
- ADALM2000 dac push function cause reset
- Using 64-bit labview truncates 64-bit handle (address) to 32-bit HOT 2
- 'LIBM2K_ENABLE_LOG' error with MSVC
- Add compute calibration parameters without writing to the board API HOT 1
- Please add Python 3.11 support HOT 4
- How to set sampling frequencies <100k? HOT 5
- DLL load failed on Windows
- returns none when I try getAvailableSampleRates();
- M1 Mac platform not supported HOT 3
- Python examples + threading or so. HOT 2
- Please add Ubuntu 24.04 packages HOT 1
- i2c has incorrect timing, causing i2c communication to not function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libm2k.