aldebaran / libqi-python

qiSDK python bindings
BSD 3-Clause "New" or "Revised" License
15 stars 11 forks source link

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

Closed NoiZeR355 closed 3 years ago

NoiZeR355 commented 8 years ago

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?

robertanto commented 3 years ago

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.

nyibbang commented 3 years ago

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.

robertanto commented 3 years ago

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)```
nyibbang commented 3 years ago

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

robertanto commented 3 years ago

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

Yes, I have the _qi.so file.

nyibbang commented 3 years ago

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

robertanto commented 3 years ago

No.

nyibbang commented 3 years ago

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

robertanto commented 3 years ago

yes, I see it!

nyibbang commented 3 years ago

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.

robertanto commented 3 years ago

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!

robertanto commented 3 years ago

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

Same output.

nyibbang commented 3 years ago

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