aldebaran/libqi-python

compiled libqi-python for python 3.4 can't import it

Closed this issue · 13 comments

Hi,

I compiled libqi-python for python 3.4 but when I'm trying to import it I got the following error.

File "/lib/python3.4/site-packages/qi/init.py", line 85, in
from _qi import Application as _Application
ImportError: dynamic module does not define init function (PyInit__qi)

Does someone have a clue how I can fix that?

It seems from StackOverflow1 & StackOverflow2 that the problem is in the way we compiled the libboost-python library.

In my case, the import does not work even with python 2.7.

libqi-python is currently being ported to Python 3, but note that only Python 3.5+ will be supported.
The team/platform/dev branch contains the modifications related to Python 3.

Thank you @nyibbang for your help!

In my case, I have compiled on the Jetson TX2 Platform (arm).
As suggested in #9 I compiled the release 2.5 on Ubuntu 16.04 (container) using Boost 1.64.0 .
I compiled libboost_python.so.1.64.0 using python2.7.

Is there a way to overcome this problem?

File  "/usr/lib/python2.7/dist-packages/qi/__init__.py", line 88, in 
from _qi import Application as _Application
ImportError: dynamic module does not define init function (init_qi)```

Which branch did you use to build libqi-python ?
Do you have a _qi.so library in your build directory ?

I built the branch "release-2.5" and applied these patches.

Yes, I have the _qi.so file.

If you run readelf -d _qi.so | grep init readelf -s _qi.so | grep init, do you see the init_qi symbol ?

No.

Sorry, I meant readelf -s _qi.so | grep init

yes, I see it!

Check that the symbol is exposed correctly (in the readelf output, the content of the 6th column should be DEFAULT).
Then try setting the PYTHONPATH environment variable to the path containing the _qi.so library when running your python interpreter.

Also it seems you installed the qi python module using pip (from the path /usr/lib/python2.7/dist-packages/qi), which should come with its owns _qi.so library. But from what I understand you also compiled it from the sources ? also at the beginning, this was about Python 3.4, but there it seems you're using Python 2.7. I'm a bit confused.

I am sorry for that.

I am not the author of the issue. I have the same problem but with Python2.7.
I have compiled the library on the Jetson TX2 Platform (arm) because I can't install it from pypi.
To do that, I created a Docker container with Ubuntu 16.04 and Boost 1.64.0.

I confirm that the content of the 6th column is DEFAULT!

Then try setting the PYTHONPATH environment variable to the path containing the _qi.so library when running your python interpreter.

Same output.

Okay I understand a bit better now, although I doubt the two issues are related. I'm going to close this issue and we can discuss your issue on #9