Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with the Aldebaran NaoQI Python SDK #4

Open
severin-lemaignan opened this issue Dec 14, 2016 · 15 comments
Open

Conflict with the Aldebaran NaoQI Python SDK #4

severin-lemaignan opened this issue Dec 14, 2016 · 15 comments

Comments

@severin-lemaignan
Copy link

After installing libqi from ROS Kinetic and the Aldebaran closed-source NaoQI Python SDK (tested with version 2.1.4.13), importing the naoqi Python package fails:

$ python -c"import naoqi"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "naoqi.py", line 7, in <module>
    import qi
  File "qi/__init__.py", line 72, in <module>
    from _qi import Application as _Application
ImportError: ./_qi.so: undefined symbol: _ZN2qi3log11addCategoryERKSs

The error comes from _qi.so (loaded by the Python SDK) incorrectly linking to the libqi.so provided by ROS.

The 'easy' workaround is to re-export LD_LIBRARY_PATH with the Python SDK path first before running any python code.
This is inconvenient, and not always possible (for instance, when a ROS launch file starts both C++ and Python nodes).

Any ideas? Ideally, Aldebaran could release the Python SDK as open-source, and we could package it along with libqi.so...

@suryaambrose
Copy link
Member

Hi,

Unfortunately, I don't have any solution to offer you right now. This is an issue we encountered many times internally and we are now used to the fact that using naoqi python SDK must be done without a ROS workspace sourced. Sadly, open-sourcing our SDK is not a decision I can make, and AFAIK it is not foreseeable in the next future..
Splitting your launch files might be the easiest option here..

@severin-lemaignan
Copy link
Author

@suryaambrose well, that kind of the answer I expected :-) but thanks for confirming.

One possible (and relatively easy) solution would be to provide a statically linked version of _qi.so.
Another option (but probably not as easy) would be to provide a Python SDK recompiled for each release of libqi.so.

@severin-lemaignan
Copy link
Author

Just to add to the discussion: currently our nao_bringup launch files always try to start some Python nodes.
Due the this issue, this can not work (the Python modules will always fail to start).

@suryaambrose
Copy link
Member

Hi again Severin,

There MIGHT be a solution to your problem (but not tested, not very clean either so... up to you, if you want to give it a try).

python -c "import naoqi" first import naoqi.py in your Python SDK, which in turn import the _qi.so library with its dependencies (basically).
The problem here is that _qi.so is expecting to get libqi 2.1, and receives libqi 2.5 from your ROS package. What you could do is use the open source project here to recompile the python bindings of the libqi library, fitting libqi2.5, and replace the bindings in your SDK by those you compiled.

  1. You will probably need to use qibuild, so if you never did, that's quite an overhead.
  2. This solution should work, but it might lead to other API problems between libqi and the rest of the SDK (which won't be solvable this time)
  3. This is clearly an ugly solution since you are hacking your SDK.

So, a lot of buts and ifs !

@severin-lemaignan
Copy link
Author

Haha! I missed the fact that the source for _qi.so is available! Thanks for pointing it! I'll certainly give it a try.

@suryaambrose
Copy link
Member

suryaambrose commented Dec 15, 2016

Nice, good luck !

If you need a hint, _qi.so is generated from here: https://github.com/aldebaran/libqi-python/blob/master/py2py3/CMakeLists.txt#L66

@severin-lemaignan
Copy link
Author

I did not checked yet in details, but wouldn't it be possible to package the python bindings in ROS alongside libqi? that would certainly make everybody's life easier (... sudo apt install ros-kinetic-naoqi-python...)

We might have to deal with a dependency on the C++ SDK, though?

@suryaambrose
Copy link
Member

If this solution is proven to be efficient, yes I think we could package libqi-python in a ROS package. That should be doable.
I don't think we would need to bother with the C++ SDK though (but I might be wrong)

@warp1337
Copy link

This would help!

@warp1337
Copy link

Did anyone ever manage to build libqi-python?

@elahia
Copy link

elahia commented Aug 7, 2018

Hi,

I passed a long way to reach this point, I'm new with linux, python, naoqi, qibuild, ros and other friends! but i got the same error, so would you please explain the solution in a more step by step manner, such that me also as a beginner could solve the problem!

I'm running ubuntu 16.04, 64 bit, python 2.7.12, libboost 1.58 and ros Lunar
i installed libbbost1.55 from here beside my 1.58 (how can i be sure if it really installed!)
and after installation is it necesary to set it as default libboost, if yes how can i do it?

Thanks in advance,
Regards.

@AndrewJSchoen
Copy link

Any progress on an "official" workaround to this? I would be interested if so.

@victorpaleologue
Copy link
Contributor

victorpaleologue commented Oct 1, 2018

This is a bit of big news for an issue thread but...
The NAOqi Python SDK is now being replaced the Qi Framework in Python.
The Qi Framework is the open source core of NAOqi & the communication library to make clients, or extend NAOqi with new services.

It can be installed on most machines using pip:
$ pip install --user qi

So the best advice for ROS maintainers I could give now is to remove any occurrence of the legacy NAOqi Python SDK, and use the standard practices around Python and pip to package it.

For maintainers, please have a look at libqi-python's GitHub (the most advanced branch is the release-2.9 currently).

@zfwang615
Copy link

Thank you for your discussion. OMG, 2020 is coming soon! Is there any solution to this problem? I just want to control the Nao with the keyboard by ROS.

Thanks in advance,
Regards.

@SHIVOH
Copy link

SHIVOH commented Oct 19, 2020

Hi,

I passed a long way to reach this point, I'm new with linux, python, naoqi, qibuild, ros and other friends! but i got the same error, so would you please explain the solution in a more step by step manner, such that me also as a beginner could solve the problem!

I'm running ubuntu 16.04, 64 bit, python 2.7.12, libboost 1.58 and ros Lunar
i installed libbbost1.55 from here beside my 1.58 (how can i be sure if it really installed!)
and after installation is it necesary to set it as default libboost, if yes how can i do it?

Thanks in advance,
Regards.

@elahia if you solved your problem, kindly share with me the details of your procedure. I am exactly at the situation you were 2 years before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants