1. Holger Krekel
  2. tox
  3. Issues

Issues

Issue #17 on hold

Virtualenv creation fails if PYTHONHOME is set in environment

Olivier Olivier
created an issue

{{{ $ export PYTHONHOME=/opt/local/Library/Frameworks/Python.framework/Versions/2.7 $ export PATH=$PYTHONHOME/bin:$PATH $ export DYLD_LIBRARY_PATH=$PYTHONHOME/lib:$DYLD_LIBRARY_PATH

$ tox -e py32 [...] [TOX] ERROR: invocation failed, logfile: /Users/olivier/Workspace/src/python-nose/.tox/py32/log/0.log [TOX] ERROR: /Users/olivier/Workspace/src/python-nose/.tox$ /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 ../../../../../../opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tox-1.1-py2.7.egg/tox/virtualenv.py --no-site-packages py32 >py32/log/0.log Fatal Python error: Py_Initialize: unable to load the file system codec LookupError: no codec search functions registered: can't find encoding

[TOX] ERROR: InvocationError: /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 ../../../../../../opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tox-1.1-py2.7.egg/tox/virtualenv.py --no-site-packages py32 (see /Users/olivier/Workspace/src/python-nose/.tox/py32/log/0.log)

$ unset PYTHONHOME $ tox -e py32 [...] [TOX] py32: commands succeeded [TOX] congratulations :)

}}}

Comments (6)

  1. Holger Krekel repo owner

    Could you try the current trunk version with "pip install -i http://pypi.testrun.org -U tox"? If installed you should see "tox --version" resulting in 1.2.dev5 at least. This version now again depends on virtualenv instead of shipping it. I'd like to know if that might already fix your problem. thanks, holger

  2. Olivier Olivier reporter

    I updated to the trunk version:

    $ tox --version
    1.2.dev5 imported from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tox/__init__.pyc
    

    The problem is still there:

    $ tox -e py32
    _____________________________________________________________________________________________ [tox sdist] _____________________________________________________________________________________________
    [TOX] ***creating sdist package
    [TOX] /Users/olivier/Workspace/src/python-nose$ /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python setup.py sdist --formats=zip --dist-dir .tox/dist >.tox/log/0.log
    [TOX] ***copying new sdistfile to '/Users/olivier/.tox/distshare/nose-1.1.3.dev.zip'
    _________________________________________________________________________________________ [tox testenv:py32] __________________________________________________________________________________________
    [TOX] ***recreating virtualenv py32 (configchange/incomplete install detected)
    [TOX] /Users/olivier/Workspace/src/python-nose/.tox$ /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --no-site-packages py32 >py32/log/0.log
    [TOX] ERROR: invocation failed, logfile: /Users/olivier/Workspace/src/python-nose/.tox/py32/log/0.log
    [TOX] ERROR: /Users/olivier/Workspace/src/python-nose/.tox$ /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --no-site-packages py32 >py32/log/0.log
    Fatal Python error: Py_Initialize: unable to load the file system codec
    LookupError: no codec search functions registered: can't find encoding
    
    [TOX] ERROR: InvocationError: /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --no-site-packages py32 (see /Users/olivier/Workspace/src/python-nose/.tox/py32/log/0.log)
    ____________________________________________________________________________________________ [tox summary] ____________________________________________________________________________________________
    [TOX] ERROR: py32: InvocationError: /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --no-site-packages py32 (see /Users/olivier/Workspace/src/python-nose/.tox/py32/log/0.log)
    

    Seems invoking the python3.2 executable with the 2.7's packages.

    Maybe using the python launching tox to create the virtualenv with --python=/path/to/target/exe option and setting the right (or unsetting) PYTHONHOME when calling executables located in virtualenv ?

  3. Anonymous

    Yes, it's still there with the following version:

    $ tox --version
    1.4.dev9 imported from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tox-1.4.dev9-py2.7.egg/tox/__init__.pyc
    

    Please find the full log bellow:

    $ tox -e py32
    GLOB prepare sdist package 
    GLOB sdist-make: using /Users/olivier/Workspace/src/nose/setup.py
    py32 prepareenv /Users/olivier/Workspace/src/nose/.tox/py32
    py32 create: no existing environment found
    ERROR: invocation failed, logfile: /Users/olivier/Workspace/src/nose/.tox/py32/log/py32-0.log
    ERROR: actionid=py32
    msg=prepareenv
    cmd=/Users/olivier/Workspace/src/nose/.tox$ /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py py32
    env={'CPPFLAGS': '-I/opt/local/include', 'PIP_RESPECT_VIRTUALENV': 'true', 'TERM_PROGRAM_VERSION': '303.2', 'TMPDIR': '/var/folders/t1/ptpyht917vqdyhrfzhm0txj00000gn/T/', 'LOGNAME': 'olivier', 'USER': 'olivier', 'HOME': '/Users/olivier', 'PATH': '/Users/olivier/Workspace/src/nose/.tox/py32/bin:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin:/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:/Users/olivier/Workspace/bin:/Users/olivier/Workspace/bin/maven/current/bin:/opt/subversion/bin:/opt/local/bin:/opt/local/sbin:/Applications/VirtualBox.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin', 'DISPLAY': '/tmp/launch-BTrbBS/org.x:0', 'TERM_PROGRAM': 'Apple_Terminal', 'LANG': 'fr_FR.UTF-8', 'TERM': 'xterm-256color', 'SHELL': '/bin/bash', 'VIRTUALENVWRAPPER_PYTHON': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7', 'SHLVL': '1', 'EDITOR': 'vi', 'LDFLAGS': '-L/opt/local/lib', 'M2_HOME': '/Users/olivier/Workspace/bin/maven/current', 'JAVA_HOME': '/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home', 'WORKON_HOME': '/Users/olivier/Workspace/bin/virtualenv', 'TERM_SESSION_ID': 'C523F0D6-E9B9-44A9-8177-D08B41D2A82F', 'SSH_AUTH_SOCK': '/tmp/launch-58PjNY/Listeners', 'DYLD_LIBRARY_PATH': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib:', 'Apple_PubSub_Socket_Render': '/tmp/launch-Slg3fJ/Render', 'LC_ALL': 'en_US.UTF-8', '_': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/tox', 'VIRTUALENVWRAPPER_HOOK_DIR': '/Users/olivier/Workspace/bin/virtualenv', 'VIRTUALENVWRAPPER_PROJECT_FILENAME': '.project', 'VIRTUALENVWRAPPER_LOG_DIR': '/Users/olivier/Workspace/bin/virtualenv', 'OLDPWD': '/Users/olivier/Workspace/src', 'PYTHONHOME': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'Apple_Ubiquity_Message': '/tmp/launch-BymVI1/Apple_Ubiquity_Message', 'PWD': '/Users/olivier/Workspace/src/nose', 'PIP_VIRTUALENV_BASE': '/Users/olivier/Workspace/bin/virtualenv', 'VIRTUALENVWRAPPER_VIRTUALENV': 'virtualenv-2.7', 'CFLAGS': '-I/opt/local/include', 'COMMAND_MODE': 'unix2003'}
    Fatal Python error: Py_Initialize: unable to load the file system codec
    ImportError: No module named encodings
    
    ERROR: InvocationError: /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py py32 (see /Users/olivier/Workspace/src/nose/.tox/py32/log/py32-0.log)
    py32 runtests 
    GLOB test summary 
    ERROR:   py32: InvocationError: /opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py py32 (see /Users/olivier/Workspace/src/nose/.tox/py32/log/py32-0.log)
    
    
  4. Log in to comment