Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible problem with python3.4? #127

Closed
pytoxbot opened this issue Sep 17, 2016 · 6 comments
Closed

Possible problem with python3.4? #127

pytoxbot opened this issue Sep 17, 2016 · 6 comments

Comments

@pytoxbot
Copy link

I just installed Python 3.4a3 this morning on Mac OS X 10.8.5 and when I try to use it with tox, I get some strange errors:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/locale.py", line 17, in <module>
    import re
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/re.py", line 124, in <module>
    import functools
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/functools.py", line 21, in <module>
    from collections import namedtuple
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/collections/__init__.py", line 8, in <module>
    __all__ += collections.abc.__all__
AttributeError: 'module' object has no attribute 'abc'
Already using interpreter /usr/local/bin/python3.4
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.4'
New python executable in py34/bin/python3.4
Also creating executable in py34/bin/python
ERROR: The executable py34/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/Users/marca/dev/git-repos/tox-test/.tox' (should be '/Users/marca/dev/git-repos/tox-test/.tox/py34')
ERROR: virtualenv is not compatible with this system or executable

ERROR: InvocationError: /usr/local/bin/python3.4 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --setuptools --python /usr/local/bin/python3.4 py34 (see /Users/marca/dev/git-repos/tox-test/.tox/py34/log/py34-0.log)

that I do not get with Python 2.7 or Python 3.3. Observe:

marca@marca-mac:~/dev/git-repos/tox-test$ tox -e py27,py33,py34
GLOB sdist-make: /Users/marca/dev/git-repos/tox-test/setup.py
py27 inst-nodeps: /Users/marca/dev/git-repos/tox-test/.tox/dist/foo-0.0.0.zip
py27 runtests: commands[0] | py.test -v
============================================================================== test session starts ===============================================================================
platform darwin -- Python 2.7.3 -- pytest-2.4.2 -- /Users/marca/dev/git-repos/tox-test/.tox/py27/bin/python
collected 1 items

test_foo.py:3: test_foo PASSED

============================================================================ 1 passed in 0.01 seconds ============================================================================
py33 create: /Users/marca/dev/git-repos/tox-test/.tox/py33
py33 installdeps: pytest
py33 inst: /Users/marca/dev/git-repos/tox-test/.tox/dist/foo-0.0.0.zip
py33 runtests: commands[0] | py.test -v
============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.3.2 -- pytest-2.4.2 -- /Users/marca/dev/git-repos/tox-test/.tox/py33/bin/python3.3
collected 1 items

test_foo.py:3: test_foo PASSED

============================================================================ 1 passed in 0.03 seconds ============================================================================
py34 create: /Users/marca/dev/git-repos/tox-test/.tox/py34
ERROR: invocation failed, logfile: /Users/marca/dev/git-repos/tox-test/.tox/py34/log/py34-0.log
ERROR: actionid=py34
msg=getenv
cmdargs=['/usr/local/bin/python3.4', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py', '--setuptools', '--python', '/usr/local/bin/python3.4', 'py34']
env={'HISTFILE': '/Users/marca/.bash_history-', 'PYMSSQL_TEST_DATABASE': 'pymssql_dev', 'TDSPWDPWD': 'M0nk3y$', 'LOGNAME': 'marca', 'USER': 'marca', 'TDSPWDSRV': 'localhost', 'TDSPWDUID': 'sa_monkey', 'HOME': '/Users/marca', 'PS1': '${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$ ', 'DISPLAY': '/tmp/launch-3QN6DX/org.macosforge.xquartz:0', 'TERM_PROGRAM': 'iTerm.app', 'LANG': 'en_US.UTF-8', '__CF_USER_TEXT_ENCODING': '0x1F6:0:0', 'TERM': 'xterm-256color', 'Apple_PubSub_Socket_Render': '/tmp/launch-3zOWu2/Render', 'COLORFGBG': '7;0', 'SHLVL': '1', 'SHMUX_SSH_OPTS': '', 'LESS': '-ich4MP%t?f%f :stdin .?pb%pb\\%:?lbLine %lb:?bbByte %bb:-...', 'SECURITYSESSIONID': '186a4', 'TDSPWDDB': 'pymssql_dev', 'ITERM_SESSION_ID': 'w0t6p0', 'EDITOR': 'vim', 'HISTIGNORE': '&:ls:mutt:[bf]g:exit', 'SSH_AUTH_SOCK': '/tmp/launch-4nnSVt/Listeners', 'PYMSSQL_TEST_SERVER': 'localhost', 'PATH': '/Users/marca/dev/git-repos/tox-test/.tox/py34/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/marca/bin:/usr/local/opt/ruby/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/Users/marca/ruby/bin:/sbin:/bin:/usr/sbin/:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/X11R6/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin', 'SHELL': '/bin/bash', 'P4CONFIG': '.p4config', 'CLICOLOR': 'true', 'ITERM_PROFILE': 'Default', '_': '/Library/Frameworks/Python.framework/Versions/2.7/bin/tox', 'CVSEDITOR': 'vim', 'PERL5LIB': '/Users/marca/lib/perl', 'LSCOLORS': 'ExGxCxDxCxegedabagacad', 'PYMSSQL_TEST_USERNAME': 'sa_monkey', 'TMPDIR': '/var/folders/nk/8f8f6wjn7v3b9cb2gjqf6vph0000gp/T/', 'OLDPWD': '/Users/marca/dev/git-repos', 'NODE_PATH': '/usr/local/lib/node', 'PYMSSQL_TEST_IPADDRESS': '127.0.0.1', 'Apple_Ubiquity_Message': '/tmp/launch-9ggFY6/Apple_Ubiquity_Message', 'PWD': '/Users/marca/dev/git-repos/tox-test', 'PIP_DOWNLOAD_CACHE': '/Users/marca/.pip/download-cache', 'PYMSSQL_TEST_PASSWORD': 'M0nk3y$', 'TDSPWDSKIPCOMPUTE': '1', 'PAGER': 'less', 'COMMAND_MODE': 'unix2003'}
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/locale.py", line 17, in <module>
    import re
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/re.py", line 124, in <module>
    import functools
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/functools.py", line 21, in <module>
    from collections import namedtuple
  File "/Users/marca/dev/git-repos/tox-test/.tox/py34/bin/../lib/python3.4/collections/__init__.py", line 8, in <module>
    __all__ += collections.abc.__all__
AttributeError: 'module' object has no attribute 'abc'
Already using interpreter /usr/local/bin/python3.4
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.4'
New python executable in py34/bin/python3.4
Also creating executable in py34/bin/python
ERROR: The executable py34/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/Users/marca/dev/git-repos/tox-test/.tox' (should be '/Users/marca/dev/git-repos/tox-test/.tox/py34')
ERROR: virtualenv is not compatible with this system or executable

ERROR: InvocationError: /usr/local/bin/python3.4 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --setuptools --python /usr/local/bin/python3.4 py34 (see /Users/marca/dev/git-repos/tox-test/.tox/py34/log/py34-0.log)
____________________________________________________________________________________ summary _____________________________________________________________________________________
  py27: commands succeeded
  py33: commands succeeded
ERROR:   py34: InvocationError: /usr/local/bin/python3.4 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --setuptools --python /usr/local/bin/python3.4 py34 (see /Users/marca/dev/git-repos/tox-test/.tox/py34/log/py34-0.log)

Here's the tiny little test package that I was testing with:

https://github.com/msabramo/tox-test

I do not have a problem using Python 3.4 with this package without tox:

marca@marca-mac:~/dev/git-repos/tox-test$ python3.4
Python 3.4.0a3 (v3.4.0a3:dd9cdf90a507, Sep 28 2013, 17:22:38)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from foo import add
>>> add(1, 1)
2
@pytoxbot
Copy link
Author

Original comment by @Bengt

Thanks from me, too. Using the latest development version of virtualenv as suggested solved a weird error with tox for me, which was something like this:

ERROR: py33: InvocationError: /usr/bin/python3.3 /usr/lib/python2.7/site-packages/virtualenv.py

@pytoxbot
Copy link
Author

Original comment by @hpk42

thanks for finding this out!

@pytoxbot
Copy link
Author

Original comment by @msabramo

The aforementioned virtualenv problem (pypa/virtualenv#463) is fixed by:

pypa/virtualenv#478

marca@marca-mac:~/dev/hg-repos/distlib$ pip freeze | grep virtualenv
virtualenv==1.10.1
marca@marca-mac:~/dev/hg-repos/distlib$ tox -e py34
...
______________________________________________________________________________________ summary __________________________________________________________________________________________________________________________________________________________
ERROR:   py34: InvocationError: /usr/local/bin/python3.4 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py --setuptools --python /usr/local/bin/python3.4 py34 (see /Users/marca/dev/hg-repos/distlib/.tox/py34/log/py34-0.log)

marca@marca-mac:~/dev/hg-repos/distlib$ sudo pip install -e git+https://github.com/pypa/virtualenv.git@develop#egg=virtualenv-develop
...
Successfully installed virtualenv-develop
Cleaning up...

marca@marca-mac:~/dev/hg-repos/distlib$ tox -e py34
GLOB sdist-make: /Users/marca/dev/hg-repos/distlib/setup.py
py34 create: /Users/marca/dev/hg-repos/distlib/.tox/py34
py34 inst: /Users/marca/dev/hg-repos/distlib/.tox/dist/distlib-0.1.3.dev0.zip
py34 runtests: commands[0] | python setup.py test
running test
..................................................................................................................ss.ss......s.....s........................s.........s..............s........ss.s.......ss..........
----------------------------------------------------------------------
Ran 213 tests in 63.629s

OK (skipped=14)
_________________________________________________________________________________________________________________________________________________________ summary __________________________________________________________________________________________________________________________________________________________
  py34: commands succeeded
  congratulations :)

@pytoxbot
Copy link
Author

Original comment by @msabramo

This a virtualenv problem; not a tox problem.

@pytoxbot
Copy link
Author

Original comment by @msabramo

In fact, this is the exact problem:

pypa/virtualenv#463 (comment)

@pytoxbot
Copy link
Author

Original comment by @msabramo

Hmmm. It looks like this is a virtualenv problem.

marca@marca-mac:~/dev/git-repos/tox-test$ /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenv-3.4 --python /usr/local/bin/python3.4 py34
Already using interpreter /usr/local/bin/python3.4
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.4'
New python executable in py34/bin/python3.4
Also creating executable in py34/bin/python
Failed to import the site module
Traceback (most recent call last):
  File "/Users/marca/dev/git-repos/tox-test/py34/bin/../lib/python3.4/site.py", line 703, in <module>
    main()
  File "/Users/marca/dev/git-repos/tox-test/py34/bin/../lib/python3.4/site.py", line 670, in main
    virtual_install_main_packages()
  File "/Users/marca/dev/git-repos/tox-test/py34/bin/../lib/python3.4/site.py", line 553, in virtual_install_main_packages
    f = open(os.path.join(os.path.dirname(__file__), 'orig-prefix.txt'))
  File "/Users/marca/dev/git-repos/tox-test/py34/bin/../lib/python3.4/locale.py", line 17, in <module>
    import re
  File "/Users/marca/dev/git-repos/tox-test/py34/bin/../lib/python3.4/re.py", line 124, in <module>
    import functools
  File "/Users/marca/dev/git-repos/tox-test/py34/bin/../lib/python3.4/functools.py", line 21, in <module>
    from collections import namedtuple
  File "/Users/marca/dev/git-repos/tox-test/py34/bin/../lib/python3.4/collections/__init__.py", line 8, in <module>
    __all__ += collections.abc.__all__
AttributeError: 'module' object has no attribute 'abc'
ERROR: The executable py34/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/Users/marca/dev/git-repos/tox-test' (should be '/Users/marca/dev/git-repos/tox-test/py34')
ERROR: virtualenv is not compatible with this system or executable

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant