3

I have an annoying problem with PyCharm CE and naoqi. Following the installation instructions in Aldebaran Guide, I have configured my environment to work with this one. I have installed the version of python (python 2.7.13) suggested by Aldebaran, I have written the .bash_profile using:

# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

#NaoQI 2.5.5
export PYTHONPATH=${PYTHONPATH}:/Users/francesco/Documents/PyLibs/pynaoqi-python2.7-2.5.5.5-mac64/lib/python2.7/site-packages
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Users/francesco/Documents/PyLibs/pynaoqi-python2.7-2.5.5.5-mac64/lib

after that, I launch my code in python from Terminal (making sure that the right version of python is called when I type

$ python my_code.py

and all is working (I tried also with virtualenv and all works fine if I launch all from terminal). So far so good but then comes the poison arrow. I use PyCharm CE like IDE, I have created a new project that use the same environment that works fine in terminal and the magic happens.. The first issue is:

/Users/francesco/Documents/PyEnv/pynaoqi255_python2713/bin/python /Users/francesco/PycharmProjects/PepperRobot/PepperRobot.py Traceback (most recent call last): File "/Users/francesco/PycharmProjects/PepperRobot/PepperRobot.py", line 5, in import qi ImportError: No module named qi

(Ok seriuosly this is the same environment that in terminal works) I try to bypass the problem, adding the content of naoqi sdk in the virtualenv's site-package. Ok, the problem is bypassed.. But there is another problem:

/Users/francesco/Documents/PyEnv/pynaoqi255_python2713/bin/python /Users/francesco/PycharmProjects/PepperRobot/PepperRobot.py Traceback (most recent call last): File "/Users/francesco/PycharmProjects/PepperRobot/PepperRobot.py", line 5, in import qi File "/Users/francesco/Documents/PyEnv/pynaoqi255_python2713/lib/python2.7/site-packages/qi/init.py", line 88, in from _qi import Application as _Application ImportError: dlopen(/Users/francesco/Documents/PyEnv/pynaoqi255_python2713/lib/python2.7/site-packages/_qi.so, 2): Library not loaded: @loader_path/libqipython.dylib Referenced from: /Users/francesco/Documents/PyEnv/pynaoqi255_python2713/lib/python2.7/site-packages/_qi.so Reason: image not found

Process finished with exit code 1

I did not understand why... I have also include in

Preferences -> console -> Python Console -> Environment Variables

the same variables included in .bash_profile but to no avail. How can I solve this tedious problem ?

  • 1
    I add that when I try to print the environment variable inside pycharm (even if I add the vars in python console menu) the system print with the project directory. – Francesco Lanza Jun 27 '17 at 14:14
  • I'm having the same issue. What exactly did you to when you said you "added the content of naoqi sdk in the virtualenv's site-package"? Did you copy and paste the content in the naoqi's site-packages folder? – user77005 Sep 05 '19 at 03:13

1 Answers1

3

I have solved my problem editing run/debug configuration and putting here the environment variable DYLD_LIBRARY_PATH. All works fine.