ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 224 forks source link

Failed to parse CPython sys.version / Could not import binstar_client #394

Open andrewbolster opened 9 years ago

andrewbolster commented 9 years ago

Have seen a few versions of this issue raised before but none of the proposed solutions/checks apply.

Have tried:

This is just after installing

➜   conda update conda                                                                                9660-[12:23:35]
Warning: could not import binstar_client (failed to parse CPython sys.version: '2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 17:02:03) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]')Fetching package metadata: An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

    https://github.com/conda/conda/issues

Include the output of the command 'conda info' in your report.

Traceback (most recent call last):
  File "/home/bolster/anaconda/bin/conda", line 5, in <module>
    sys.exit(main())
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 201, in main
    args_func(args, p)
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 208, in args_func
    args.func(args, p)
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/cli/common.py", line 612, in inner
    return func(args, parser)
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/cli/main_update.py", line 39, in execute
    install.install(args, parser, 'update')
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 255, in install
    offline=args.offline)
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/cli/common.py", line 549, in get_index_trap
    return get_index(*args, **kwargs)
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/api.py", line 42, in get_index
    unknown=unknown)
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/utils.py", line 119, in __call__
    value = self.func(*args, **kw)
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 228, in fetch_index
    session = CondaSession()
  File "/home/bolster/anaconda/lib/python2.7/site-packages/conda/connection.py", line 59, in __init__
    super(CondaSession, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 287, in __init__
    self.headers = default_headers()
  File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 563, in default_headers
    'User-Agent': default_user_agent(),
  File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 532, in default_user_agent
    _implementation = platform.python_implementation()
  File "/usr/lib/python2.7/platform.py", line 1521, in python_implementation
    return _sys_version()[0]
  File "/usr/lib/python2.7/platform.py", line 1486, in _sys_version
    repr(sys_version))
ValueError: failed to parse CPython sys.version: '2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 17:02:03) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]'

Looks like the correct libpython is being loaded

➜   ldd `which python`                                                                                9661-[12:25:36]
    linux-vdso.so.1 =>  (0x00007ffd24f53000)
    libpython2.7.so.1.0 => /home/bolster/anaconda/bin/../lib/libpython2.7.so.1.0 (0x00007f51b431e000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f51b4100000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f51b3efc000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f51b3cf9000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f51b39f1000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f51b3627000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f51b4701000)

No pesky PYTHONPATH (apologies for the messy PATH)

➜   env | sort                                                                                        9662-[12:28:56]
BAKE_HOME=/home/bolster/src/bake
CINNAMON_VERSION=2.2.16
COLORTERM=gnome-terminal
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-KGZteSNx1J,guid=e2986c34406501f93ac604ec55b74b19
DEFAULTS_PATH=/usr/share/gconf/cinnamon.default.path
DESKTOP_SESSION=cinnamon
DISPLAY=:0
GDM_LANG=en_GB
GDMSESSION=cinnamon
GIO_LAUNCHED_DESKTOP_FILE_PID=22625
GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/terminator.desktop
GJS_DEBUG_OUTPUT=stderr
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GPG_AGENT_INFO=/tmp/gpg-cLiqYv/S.gpg-agent:1773:1
GPG_TTY=/dev/pts/6
HOME=/home/bolster
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_COLLATE=en_GB.UTF-8
LC_CTYPE=en_GB.UTF-8
LC_MESSAGES=en_GB.UTF-8
*LD_LIBRARY_PATH=/home/bolster/anaconda/lib:/usr/local/lib:*
LESS=-R
LOGNAME=bolster
LSCOLORS=Gxfxcxdxbxegedabagacad
MANDATORY_PATH=/usr/share/gconf/cinnamon.mandatory.path
NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
OLDPWD=/home/bolster
ORBIT_SOCKETDIR=/tmp/orbit-bolster
PAGER=less
*PATH=/usr/local/heroku/bin:/home/bolster/.rvm/bin:/opt/cxoffice/bin/:/home/bolster/.local/bin:/home/bolster/bin:/home/bolster/anaconda/bin:/opt/cxoffice/bin/:/home/bolster/.local/bin:/home/bolster/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/bolster/src/bake:/home/bolster/src/bake*
PWD=/home/bolster
QT_ACCESSIBILITY=1
SDL_VIDEO_FULLSCREEN_DISPLAY=0
SDL_VIDEO_FULLSCREEN_HEAD=0
SESSION_MANAGER=local/yossarian.anrg.liv.ac.uk:@/tmp/.ICE-unix/1761,unix/yossarian.anrg.liv.ac.uk:/tmp/.ICE-unix/1761
SHELL=/bin/zsh
SHLVL=1
SSH_AGENT_PID=1906
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
TERMINATOR_UUID=urn:uuid:dcafe041-c005-4bfd-959e-0f0347fbc165
TERM=xterm
UPDATE_ZSH_DAYS=13
USER=bolster
_=/usr/bin/env
WINDOWID=67108868
XAUTHORITY=/home/bolster/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-cinnamon:/etc/xdg
XDG_CURRENT_DESKTOP=X-Cinnamon
XDG_DATA_DIRS=/usr/share/cinnamon:/usr/share/gnome:/usr/local/share/:/usr/share/
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/bolster
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SEAT=seat0
XDG_SESSION_DESKTOP=cinnamon
XDG_SESSION_ID=c2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
XDG_VTNR=7

Anything else I can do to check this before I go making hacky changes?

jbpoline commented 9 years ago

:+1: I seem to have the same/similar issue

~$ ldd which python
linux-vdso.so.1 => (0x00007ffd2a3f6000) libpython2.7.so.1.0 => /home/jb/miniconda/bin/../lib/libpython2.7.so.1.0 (0x00007fdc69fbb000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdc69d9d000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fdc69b99000) libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fdc69996000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdc69690000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdc692cb000) /lib64/ld-linux-x86-64.so.2 (0x00007fdc6a39d000)

~$ unset PYTHONPATH ~$ conda update conda

Fetching package metadata: An unexpected error has occurred, please consider sending the following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda/issues

Include the output of the command 'conda info' in your report.

Traceback (most recent call last): File "/home/jb/miniconda/bin/conda", line 5, in sys.exit(main()) File "/home/jb/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 202, in main args_func(args, p) File "/home/jb/miniconda/lib/python2.7/site-packages/conda/cli/main.py", line 207, in args_func args.func(args, p) File "/home/jb/miniconda/lib/python2.7/site-packages/conda/cli/main_update.py", line 40, in execute install.install(args, parser, 'update') File "/home/jb/miniconda/lib/python2.7/site-packages/conda/cli/install.py", line 253, in install offline=args.offline) File "/home/jb/miniconda/lib/python2.7/site-packages/conda/cli/common.py", line 531, in get_index_trap return get_index(_args, _kwargs) File "/home/jb/miniconda/lib/python2.7/site-packages/conda/api.py", line 42, in get_index unknown=unknown) File "/home/jb/miniconda/lib/python2.7/site-packages/conda/utils.py", line 86, in call value = self.func(_args, _kw) File "/home/jb/miniconda/lib/python2.7/site-packages/conda/fetch.py", line 228, in fetch_index session = CondaSession() File "/home/jb/miniconda/lib/python2.7/site-packages/conda/connection.py", line 59, in init super(CondaSession, self).init(_args, *_kwargs) File "/home/jb/miniconda/lib/python2.7/site-packages/requests/sessions.py", line 290, in init self.headers = default_headers() File "/home/jb/miniconda/lib/python2.7/site-packages/requests/utils.py", line 573, in default_headers 'User-Agent': default_user_agent(), File "/home/jb/miniconda/lib/python2.7/site-packages/requests/utils.py", line 542, in default_user_agent _implementation = platform.python_implementation() File "/usr/lib/python2.7/platform.py", line 1521, in python_implementation return _sys_version()[0] File "/usr/lib/python2.7/platform.py", line 1486, in _sys_version repr(sys_version)) ValueError: failed to parse CPython sys.version: '2.7.9 |Continuum Analytics, Inc.| (default, Apr 14 2015, 12:54:25) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]'

~$ conda info Current conda install:

         platform : linux-64
    conda version : 3.10.1

conda-build version : not installed python version : 2.7.9.final.0 requests version : 2.6.0 root environment : /home/jb/miniconda (writable) default environment : /home/jb/miniconda envs directories : /home/jb/miniconda/envs package cache : /home/jb/miniconda/pkgs channel URLs : https://repo.continuum.io/pkgs/free/linux-64/ https://repo.continuum.io/pkgs/free/noarch/ https://repo.continuum.io/pkgs/pro/linux-64/ https://repo.continuum.io/pkgs/pro/noarch/ config file : None is foreign system : False

gmarkall commented 9 years ago

Do you have any user site packages in sys.path (e.g. under /home/jb/.local)? Are there any .pth files in there that include /usr/lib?

jbpoline commented 9 years ago

thanks - I did find out that there was some remaining "easyinstall" .pth. On a related note, anaconda does not leave the path clean after exiting (contains the anaconda path). It would be great if it did, at the moment I have to remove it manually such that it does not conflict with other things.

DanielTakeshi commented 8 years ago

@gmarkall Would it be possible if you could clarify your comment? I'm running into the same issue presented by @andrewbolster , and here is my sys.path. There are no .pth files here, but should I be concerned with all the egg files or something?

In [3]: sys.path
Out[3]: 
['',
 '/code/anaconda/bin',
 '/code/deep_q_rl/build/pylearn2',
 '/home/seita/.local/lib/python2.7/site-packages/PyYAML-3.11-py2.7-linux-x86_64.egg',
 '/home/seita/.local/lib/python2.7/site-packages/six-1.10.0-py2.7.egg',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/dist-packages',
 '/code/anaconda/lib/python27.zip',
 '/code/anaconda/lib/python2.7',
 '/code/anaconda/lib/python2.7/plat-linux2',
 '/code/anaconda/lib/python2.7/lib-tk',
 '/code/anaconda/lib/python2.7/lib-old',
 '/code/anaconda/lib/python2.7/lib-dynload',
 '/home/seita/.local/lib/python2.7/site-packages',
 '/code/anaconda/lib/python2.7/site-packages',
 '/code/anaconda/lib/python2.7/site-packages/Sphinx-1.3.1-py2.7.egg',
 '/code/anaconda/lib/python2.7/site-packages/cryptography-0.9.1-py2.7-linux-x86_64.egg',
 '/code/anaconda/lib/python2.7/site-packages/setuptools-18.4-py2.7.egg',
 '/usr/lib/python2.7/dist-packages/IPython/extensions']

Note that here is the ldd output (default python gives the one in anaconda since I have that in my PATH variable):

$ ldd /code/anaconda/bin//python
    linux-vdso.so.1 =>  (0x00007fffbd5fc000)
    libpython2.7.so.1.0 => /code/anaconda/bin//../lib/libpython2.7.so.1.0 (0x00007f4bedc26000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4bed9e8000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4bed7e3000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f4bed5e0000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4bed2da000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4becf14000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4bee00b000)
rkmaddox commented 8 years ago

I had a similar issue. The solution for me was changing the line to ENABLE_USER_SITE = False in ~/anaconda2/lib/python2.7/site.py.

rosenfeldamir commented 8 years ago

@rkmaddox - thanks a million ! you solution worked for me :-)

cactiball commented 8 years ago

@rkmaddox thank you so much! Why is this happening though? Shouldn't it be OK if one is strictly following the anaconda installing steps?

wangkua1 commented 7 years ago

@rkmaddox thanks! Just leaving a comment here so other people realize there's a simple solution that works...

John1231983 commented 6 years ago

Thanks so much jbpoline. It worked well