I recently reinstalled gnuradio-git from the AUR (using yaourt -S gnuradio-git), now gnuradio's Python interface does not work. It seems to me that something is incorrectly causing a symbol in /usr/lib/python2.7/site-packages/gnuradio/gr/_gnuradio_core_runtime.so to be called PyInit__gnuradio_core_runtime instead of init_gnuradio_core_runtime. Any help would be appreciated.
I've tried, to no avail:
Modifying the build file to checkout an older version of gnuradio (the version that I think was previously installed)
Downgrading swig to the previous version (2.0.7)
Googling for this error message
Setting PYTHONPATH and LD_LIBRARY_PATH
Testing gnuradio as simply as possible:
python2 -c "from gnuradio import gr" Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/site-packages/gnuradio/gr/__init__.py", line 43, in <module> from gnuradio_core import * File "/usr/lib/python2.7/site-packages/gnuradio/gr/gnuradio_core.py", line 23, in <module> from gnuradio_core_runtime import * File "/usr/lib/python2.7/site-packages/gnuradio/gr/gnuradio_core_runtime.py", line 26, in <module> _gnuradio_core_runtime = swig_import_helper() File "/usr/lib/python2.7/site-packages/gnuradio/gr/gnuradio_core_runtime.py", line 22, in swig_import_helper _mod = imp.load_module('_gnuradio_core_runtime', fp, pathname, description) ImportError: dynamic module does not define init function (init_gnuradio_core_runtime)
Upon inspecting the shared object that seems to be broken:
nm -D /usr/lib/python2.7/site-packages/gnuradio/gr/_gnuradio_core_runtime.so | grep gnuradio 00000000000258a0 T PyInit__gnuradio_core_runtime
On another machine (on which gnuradio was installed a few months ago), the symbol in the shared object name is init_gnuradio_core_runtime - which is what Python seems to expect.
gnuradio-companion gives an error message titles: "dynamic module does not define init function (init...":
Cannot import gnuradio. Is the python path environment variable set correctly? All OS: PYTHONPATH Is the library path environment variable set correctly? Linux: LD_LIBRARY_PATH Windows: PATH MacOSX: DYLD_LIBRARY_PATH
Last edited by Techmeology (2012-08-25 20:29:16)
I've been having the same problem. Unfortunately I can't help, but please post back if you find a solution!
I am having the same problem as well. The problem even persists when I build the source myself which leads me to believe it is one of the dependencies. When building from source I can run "make test" (or "make check" I can't remember which) and about 95% of the tests fail.
I just used yaourt to install gnuradio-git on another machine (which is nearly fresh). I can "from gnuradio import gr" without a problem, but gnuradio-companion didn't compile. One of the main differences with this machine is that I never installed python 3 on it. I'm pretty sure that on my other machine all of the binaries and python path variables are pointing to python2, but I can't be too sure since I am brand new to arch.
This is from the machine that works.
nm -D /usr/lib/python2.7/site-packages/gnuradio/gr/_gnuradio_core_runtime.so | grep gnuradio 0001f8e0 T init_gnuradio_core_runtime
This is from the machine that doesn't
nm -D /usr/lib/python2.7/site-packages/gnuradio/gr/_gnuradio_core_runtime.so | grep gnuradio 0000000000024bf0 T PyInit_gnuradio_core_runtime
Any help would be greatly appreciated.
EDIT: Found this. http://bugs.python.org/msg90429 . It looks like PyInit_ is used in Python3 instead of init_. This means that our systems are building towards Python3 for some reason.
Last edited by unclekyky (2012-08-25 18:18:17)
unclekyky: Thank you:D - that's very enlightening - and the clue I needed. I had wondered as much, so decided to test the theory by doing such things as alias python=python2, but that didn't work and so I dropped that theory in favour of something having changed with SWIG (as noted, downgrading didn't work), or some other dependency I hadn't considered - something must have changed between when I last successfully compiled it, and now. I tried a rebuild, having temporarily pacman -Rdd python. This build works correctly:D:D I'm still mystified as to why it suddenly broke, since I've had Python 3 installed up until now. It's a bit of a hack, but for now we can make this work like this:
sudo pacman -Rdd python yaourt -S gnuradio-git sudo pacman -S python
I also have come up with a solution (albeit hacked together), based on the discussion here (more specifically this post). I'm not sure how cmake determines the include or library path, but it can be overridden with this (just edit the PKGBUILD file):
cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so -DCMAKE_INSTALL_PREFIX=/usr ../
So, just to be clear: this isn't a bug with the AUR package. It exists in the CMakeLists.txt of the gnuradio git source. In that file there is a line that says "find_package(PythonLibs)" which for some reason on our systems was finding the Python3 libs. This can also be changed to "find_package(PythonLibs 2.7.3)" (if that is your version of Python). This cmake file needs to test to make sure the python version is less than 3.
Anyway, I'm glad we both got it sorted!
unclekyky: that's an even better solution:D Thanks.
Excellent! That works perfectly. Hopefully GNURadio git will be fixed soon - glad you raised the issue with them.