0

I have installed the Python SDK for the Pepper (as indicated here: http://doc.aldebaran.com/2-5/dev/python/install_guide.html#python-install-guide). I have Mac OS 10.14.3 (Mojave) and running python 2.7. When I am trying to import naoqi, I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/../Cellar/python@2/2.7.16/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 539, in <module>
    main()
  File "/usr/local/bin/../Cellar/python@2/2.7.16/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 521, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/bin/../Cellar/python@2/2.7.16/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/bin/../Cellar/python@2/2.7.16/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/bin/../Cellar/python@2/2.7.16/bin/../Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 525, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 458, in get_config_vars
    import re
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 108, in <module>
    import _locale
SystemError: dynamic module not initialized properly

I have added the following lines in my .bash_profile:

export PYTHONPATH=$robotology_dir/pynaoqi-python2.7-2.5.7.1-mac64/lib/python2.7/site-packages:${PYTHONPATH}
export DYLD_LIBRARY_PATH=$robotology_dir/pynaoqi-python2.7-2.5.7.1-mac64/lib:${DYLD_LIBRARY_PATH}
export DYLD_FRAMEWORK_PATH=$robotology_dir/pynaoqi-python2.7-2.5.7.1-mac64:${DYLD_FRAMEWORK_PATH}

I saw that here there was a similar error: Python for Naoqi (dynamic module not initialized properly) I even tried the csrutil status --> and disabled it but still there was no change in the error I received.

Any help would be highly appreciated! Thank you very much!

Vicky Vou
  • 101
  • 1
  • 3

2 Answers2

0

Currently, you are using python 2.7.16 which is not supported.

You have to download exactly this python (https://www.python.org/downloads/release/python-2710/) and then use it via /usr/local/bin/python2.7 - You should see that version name is:

Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Marek Grác
  • 743
  • 9
  • 24
0

I had tried various solutions, but in the end, reinstalling python (even if I installed the latest one of 2.7 --> 2.7.16) seemed to do the trick! And even if python is not the usr/local/bin one (/Library/Frameworks/Python.framework/Versions/2.7/bin/python), it seems to be working. Thank you very much for your time and reply :)

Vicky Vou
  • 101
  • 1
  • 3