Tox messes around with system-wide python install for no reason, breaks

Issue #179 on hold
T created an issue

What did I do:

I downloaded python 3.4. I compiled it (but didn't install it).

I did ./python -m venv --clear /home/jonas/Develop/miraclecrafter/py34venv/ to create a virtualenv.

I installed tox inside.

The tox.ini I am working with has this envlist: [tox] envlist=py34

.. and this interpreter info: [testenv:py34] basepython=/home/jonas/Develop/miraclecrafter/py34venv/bin/python

What happened?

When I try to run tox, it tries to access /usr/bin/python anyway which doesn't even have virtualenv installed. Unsurprisingly, it falls flat on the face:

(py34venv) jonas@cyberman#0: tox GLOB sdist-make: /home/jonas/Develop/miraclecrafter/setup.py py34 create: /home/jonas/Develop/miraclecrafter/.tox/py34 ERROR: invocation failed, logfile: /home/jonas/Develop/miraclecrafter/.tox/py34/log/py34-0.log ERROR: actionid=py34 msg=getenv cmdargs=['/usr/bin/python', '-mvirtualenv', '--setuptools', '--python', '/home/jonas/Develop/miraclecrafter/py34venv/bin/python', 'py34'] env={'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'LESSOPEN': '||/usr/bin/lesspipe.sh %s', 'QT_IM_MODULE': 'ibus', 'LOGNAME': 'jonas', 'USER': 'jonas', 'GNOME_KEYRING_CONTROL': '/run/user/1000/keyring-juNaSm', 'XDG_VTNR': '1', 'QTDIR': '/usr/lib/qt-3.3', 'PS1': '(py34venv) \u@\h#\l: ', 'WINDOWPATH': '1', 'LANG': 'en_US.UTF-8', 'QTLIB': '/usr/lib/qt-3.3/lib', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'XAUTHORITY': '/run/gdm/auth-for-jonas-tFALE0/database', 'SESSION_MANAGER': 'local/unix:@/tmp/.ICE-unix/1543,unix/unix:/tmp/.ICE-unix/1543', 'QTINC': '/usr/lib/qt-3.3/include', 'HISTSIZE': '1000', 'WINDOWID': '38070893', 'XMODIFIERS': '@im=ibus', 'PYTHONHASHSEED': '3820106888', 'SVN_EDITOR': '/usr/bin/vimx', 'HOME': '/home/jonas', 'USERNAME': 'jonas', 'XDG_RUNTIME_DIR': '/run/user/1000', 'SSH_AUTH_SOCK': '/run/user/1000/keyring-juNaSm/ssh', 'VIRTUAL_ENV': '/home/jonas/Develop/miraclecrafter/py34venv', 'VTE_VERSION': '3409', 'PATH': '/home/jonas/Develop/miraclecrafter/.tox/py34/bin:/home/jonas/Develop/miraclecrafter/py34venv/bin:/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin', 'XDG_MENU_PREFIX': 'gnome-', 'QT_GRAPHICSSYSTEM_CHECKED': '1', 'XDG_SESSION_ID': '1', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-z0Vg5HGDXS,guid=9a1dfc2cf5c2a67eb0def58253a3d9c2', '_': '/usr/bin/tox', 'GDMSESSION': 'gnome', 'DESKTOP_SESSION': 'gnome', 'GPG_AGENT_INFO': '/run/user/1000/keyring-juNaSm/gpg:0:1', 'DISPLAY': ':0', 'GNOME_KEYRING_PID': '1541', 'OLDPWD': '/home/jonas/Develop/miraclecrafter/py34venv', 'HOSTNAME': 'cyberman', 'GDM_LANG': 'en_US.UTF-8', 'HISTCONTROL': 'ignoreboth', 'SHLVL': '2', 'PWD': '/home/jonas/Develop/miraclecrafter', 'COLORTERM': 'gnome-terminal', 'MAIL': '/var/spool/mail/jonas', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:.xspf=00;36:', 'XDG_SEAT': 'seat0'} /usr/bin/python: No module named virtualenv

ERROR: InvocationError: /usr/bin/python -mvirtualenv --setuptools --python /home/jonas/Develop/miraclecrafter/py34venv/bin/python py34 (see /home/jonas/Develop/miraclecrafter/.tox/py34/log/py34-0.log) _____ summary ______ ERROR: py34: InvocationError: /usr/bin/python -mvirtualenv --setuptools --python /home/jonas/Develop/miraclecrafter/py34venv/bin/python py34 (see /home/jonas/Develop/miraclecrafter/.tox/py34/log/py34-0.log) (py34venv) jonas@cyberman#0:

So why is this? I didn't even install tox outside the virtualenv. The only test environment py34 I used has an explicit interpreter path to the virtualenv binary. Everything would be available inside there - but tox thinks it needs to touch the system python. Please fix or provide advise on how to avoid.

Comments (4)

  1. T reporter

    Hm I guess the problem is tox itself runs on Python 2.7? However, when I install virtualenv system-wide, I get this error:

    (py34venv) jonas@cyberman#0: tox
    GLOB sdist-make: /home/jonas/Develop/miraclecrafter/setup.py
    py34 create: /home/jonas/Develop/miraclecrafter/.tox/py34
    ERROR: invocation failed, logfile: /home/jonas/Develop/miraclecrafter/.tox/py34/log/py34-0.log
    ERROR: actionid=py34
    msg=getenv
    cmdargs=['/home/jonas/Python-3.4.1/python', '/usr/lib/python2.7/site-packages/virtualenv.py', '--distribute', 'py34']
    env={'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'LESSOPEN': '||/usr/bin/lesspipe.sh %s', 'QT_IM_MODULE': 'ibus', 'LOGNAME': 'jonas', 'USER': 'jonas', 'GNOME_KEYRING_CONTROL': '/run/user/1000/keyring-juNaSm', 'XDG_VTNR': '1', 'QTDIR': '/usr/lib/qt-3.3', 'PS1': '(py34venv) \\u@\\h#\\l: ', 'WINDOWPATH': '1', 'LANG': 'en_US.UTF-8', 'QTLIB': '/usr/lib/qt-3.3/lib', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'XAUTHORITY': '/run/gdm/auth-for-jonas-tFALE0/database', 'SESSION_MANAGER': 'local/unix:@/tmp/.ICE-unix/1543,unix/unix:/tmp/.ICE-unix/1543', 'QTINC': '/usr/lib/qt-3.3/include', 'HISTSIZE': '1000', 'WINDOWID': '38070893', 'XMODIFIERS': '@im=ibus', 'SVN_EDITOR': '/usr/bin/vimx', 'HOME': '/home/jonas', 'USERNAME': 'jonas', 'XDG_RUNTIME_DIR': '/run/user/1000', 'SSH_AUTH_SOCK': '/run/user/1000/keyring-juNaSm/ssh', 'VIRTUAL_ENV': '/home/jonas/Develop/miraclecrafter/py34venv', 'VTE_VERSION': '3409', 'PATH': '/home/jonas/Develop/miraclecrafter/.tox/py34/bin:/home/jonas/Develop/miraclecrafter/py34venv/bin:/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin', 'XDG_MENU_PREFIX': 'gnome-', 'QT_GRAPHICSSYSTEM_CHECKED': '1', 'XDG_SESSION_ID': '1', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-z0Vg5HGDXS,guid=9a1dfc2cf5c2a67eb0def58253a3d9c2', '_': '/usr/bin/tox', 'GDMSESSION': 'gnome', 'DESKTOP_SESSION': 'gnome', 'GPG_AGENT_INFO': '/run/user/1000/keyring-juNaSm/gpg:0:1', 'DISPLAY': ':0', 'GNOME_KEYRING_PID': '1541', 'OLDPWD': '/home/jonas/Develop/miraclecrafter/py34venv', 'HOSTNAME': 'cyberman', 'GDM_LANG': 'en_US.UTF-8', 'HISTCONTROL': 'ignoreboth', 'SHLVL': '2', 'PWD': '/home/jonas/Develop/miraclecrafter', 'COLORTERM': 'gnome-terminal', 'MAIL': '/var/spool/mail/jonas', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:', 'XDG_SEAT': 'seat0'}
    Using base prefix '/usr/local'
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/virtualenv.py", line 2308, in <module>
        main()
      File "/usr/lib/python2.7/site-packages/virtualenv.py", line 821, in main
        symlink=options.symlink)
      File "/usr/lib/python2.7/site-packages/virtualenv.py", line 956, in create_environment
        site_packages=site_packages, clear=clear, symlink=symlink))
      File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1151, in install_python
        copy_required_modules(home_dir, symlink)
      File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1089, in copy_required_modules
        dst_filename = change_prefix(filename, dst_prefix)
      File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1054, in change_prefix
        (filename, prefixes)
    AssertionError: Filename /home/jonas/Python-3.4.1/Lib/os.py does not start with any of these prefixes: ['/usr/local', '/usr/local']
    
    ERROR: InvocationError: /home/jonas/Python-3.4.1/python /usr/lib/python2.7/site-packages/virtualenv.py --distribute py34 (see /home/jonas/Develop/miraclecrafter/.tox/py34/log/py34-0.log)
    ___________________________________ summary ____________________________________
    ERROR:   py34: InvocationError: /home/jonas/Python-3.4.1/python /usr/lib/python2.7/site-packages/virtualenv.py --distribute py34 (see /home/jonas/Develop/miraclecrafter/.tox/py34/log/py34-0.log)
    (py34venv) jonas@cyberman#0:
    

    All I really want to do is to make tox work for a Python 3.4 project. But I guess I'm out of luck..

  2. Log in to comment