This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: undefined symbol: PyUnicodeUCS2_FromUnicode when executing any command with pip2.7
Type: behavior Stage: resolved
Components: ctypes Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, rkommine, terry.reedy
Priority: normal Keywords:

Created on 2016-12-13 06:07 by rkommine, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Installation.Log.txt rkommine, 2016-12-13 06:07 Python Installation Log file
Messages (4)
msg283074 - (view) Author: Ramakrishna Kommineni (rkommine) * Date: 2016-12-13 06:07
Hi,

I have installed python from source in the directory /home/rkommine/software/python2.7.
During installation there are no errors seen.
I have added the below environment variables to my bashrc

export PATH=/home/rkommine/software/python2.7.12/bin:/home/rkommine/software/tcltk8.6.6/bin:$PATH
export LD_LIBBRARY_PATH=/home/rkommine/software/python2.7.12/lib:$LD_LIBBRARY_PATH

rkommine@rubuntu:~/Downloads$ which python2.7
/home/rkommine/software/python2.7.12/bin/python2.7
rkommine@rubuntu:~/Downloads$ python2.7 --version
Python 2.7.12
rkommine@rubuntu:~/Downloads$ which pip2.7
/home/rkommine/software/python2.7.12/bin/pip2.7

But when I execute any command with pip2.7 I am getting the below errors

rkommine@rubuntu:~/Downloads$ pip2.7 --version
Traceback (most recent call last):
  File "/home/rkommine/software/python2.7.12/bin/pip2.7", line 7, in <module>
    from pip import main
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/__init__.py", line 16, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <module>
    from pip.index import Link
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/index.py", line 30, in <module>
    from pip.wheel import Wheel, wheel_ext
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/wheel.py", line 32, in <module>
    from pip import pep425tags
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/pep425tags.py", line 9, in <module>
    import ctypes
  File "/home/rkommine/software/python2.7.12/lib/python2.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /home/rkommine/software/python2.7.12/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: PyUnicodeUCS2_FromUnicode
rkommine@rubuntu:~/Downloads$ pip2.7 install robotframework
Traceback (most recent call last):
  File "/home/rkommine/software/python2.7.12/bin/pip2.7", line 7, in <module>
    from pip import main
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/__init__.py", line 16, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <module>
    from pip.index import Link
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/index.py", line 30, in <module>
    from pip.wheel import Wheel, wheel_ext
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/wheel.py", line 32, in <module>
    from pip import pep425tags
  File "/home/rkommine/software/python2.7.12/lib/python2.7/site-packages/pip/pep425tags.py", line 9, in <module>
    import ctypes
  File "/home/rkommine/software/python2.7.12/lib/python2.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /home/rkommine/software/python2.7.12/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: PyUnicodeUCS2_FromUnicode
rkommine@rubuntu:~/Downloads$ 

Could you please help to fix this error?
Thanks in advance.
msg283454 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-12-17 00:32
This tracker is for fixing Python and CPython.  There are other forums (python-list, StackOverflow, for instance) for help with user errors.  I believe that there are people on python-list with experience building on Ubuntu and variants, so I suggest asking there.  Include details on exactly how you retrieved the source onto your machine.
msg283455 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-12-17 00:33
PS, for future reference, 'crash' here means hanging or exiting *without* a traceback.
msg283460 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-12-17 01:54
I think there are two different Python installations in your $PATH (the one you compiled with UCS4 and the other one is compiled with UCS2 - probably the system Python)

Anyway, like Terry said, this is out of scope for this tracker.
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 73143
2016-12-17 01:54:41berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg283460

resolution: not a bug
stage: resolved
2016-12-17 00:33:49terry.reedysetmessages: + msg283455
2016-12-17 00:32:54terry.reedysettype: crash -> behavior

messages: + msg283454
nosy: + terry.reedy
2016-12-13 06:07:33rkomminecreate