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

error with virtualenv and python 3.4a1 #463

Closed
dhellmann opened this issue Aug 11, 2013 · 17 comments
Closed

error with virtualenv and python 3.4a1 #463

dhellmann opened this issue Aug 11, 2013 · 17 comments

Comments

@dhellmann
Copy link

I'm having trouble getting virtualenv to work with python 3.4a1. It's entirely possible this has something to do with my setup, although I don't think I have anything unusual installed. It does work with 2.6-3.3.

hubert:tmp$ uname -a
Darwin hubert.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64

hubert:~$ virtualenv --version
1.10.1

hubert:tmp$ which python3.4
/usr/local/bin/python3.4

hubert:tmp$ python3.4 --version
Python 3.4.0a1

hubert:tmp$ virtualenv --python=/usr/local/bin/python3.4 testenv34
Running virtualenv with interpreter /usr/local/bin/python3.4
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.4'
New python executable in testenv34/bin/python3.4
Also creating executable in testenv34/bin/python
Failed to import the site module
Traceback (most recent call last):
File "/private/tmp/testenv34/bin/../lib/python3.4/site.py", line 703, in
main()
File "/private/tmp/testenv34/bin/../lib/python3.4/site.py", line 670, in main
virtual_install_main_packages()
File "/private/tmp/testenv34/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 "/private/tmp/testenv34/bin/../lib/python3.4/locale.py", line 17, in
import re
File "/private/tmp/testenv34/bin/../lib/python3.4/re.py", line 124, in
import functools
File "/private/tmp/testenv34/bin/../lib/python3.4/functools.py", line 21, in
from collections import namedtuple
File "/private/tmp/testenv34/bin/../lib/python3.4/collections/init.py", line 8, in
all += collections.abc.all
AttributeError: 'module' object has no attribute 'abc'
ERROR: The executable testenv34/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/private/tmp' (should be '/private/tmp/testenv34')
ERROR: virtualenv is not compatible with this system or executable

@dhellmann
Copy link
Author

Oh, one possible factor is that I'm running virtualenv from my user-directory:

hubert:tmp$ which virtualenv
/Users/dhellmann/Library/Python/2.7/bin/virtualenv

It also fails from tox, but I don't know if tox uses that same virtualenv executable or not.

@jonathaneunice
Copy link

I don't think it's just you. I have a similar setup and problem.

@macobo
Copy link

macobo commented Aug 18, 2013

I can also reproduce, with identical stack trace.

@lparkes
Copy link

lparkes commented Oct 1, 2013

The problem is that virtualenv isn't copying over the "operator" module.

@msabramo
Copy link

msabramo commented Oct 8, 2013

I am having this problem too on OS X 10.8.5

marca@marca-mac:~/python/virtualenvs$ /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenv-3.4 py34.venv
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.4'
New python executable in py34.venv/bin/python3.4
Not overwriting existing python script py34.venv/bin/python (you must use py34.venv/bin/python3.4)
Failed to import the site module
Traceback (most recent call last):
  File "/Users/marca/python/virtualenvs/py34.venv/bin/../lib/python3.4/site.py", line 703, in <module>
    main()
  File "/Users/marca/python/virtualenvs/py34.venv/bin/../lib/python3.4/site.py", line 670, in main
    virtual_install_main_packages()
  File "/Users/marca/python/virtualenvs/py34.venv/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/python/virtualenvs/py34.venv/bin/../lib/python3.4/locale.py", line 17, in <module>
    import re
  File "/Users/marca/python/virtualenvs/py34.venv/bin/../lib/python3.4/re.py", line 124, in <module>
    import functools
  File "/Users/marca/python/virtualenvs/py34.venv/bin/../lib/python3.4/functools.py", line 21, in <module>
    from collections import namedtuple
  File "/Users/marca/python/virtualenvs/py34.venv/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.venv/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/Users/marca/python/virtualenvs' (should be '/Users/marca/python/virtualenvs/py34.venv')
ERROR: virtualenv is not compatible with this system or executable
marca@marca-mac:~/python/virtualenvs$ py34.venv/bin/python
Failed to import the site module
Traceback (most recent call last):
  File "/Users/marca/python/virtualenvs/py34.venv/bin/../lib/python3.4/site.py", line 67, in <module>
    import os
  File "/Users/marca/python/virtualenvs/py34.venv/bin/../lib/python3.4/os.py", line 634, in <module>
    from collections.abc import MutableMapping
  File "/Users/marca/python/virtualenvs/py34.venv/bin/../lib/python3.4/collections/__init__.py", line 11, in <module>
    from operator import itemgetter as _itemgetter, eq as _eq
ImportError: No module named 'operator'

@pnasrat
Copy link

pnasrat commented Oct 8, 2013

collections in 3.4 is a module and we're not recursively copying it.

@pnasrat
Copy link

pnasrat commented Oct 8, 2013

Investigating.

@msabramo
Copy link

msabramo commented Oct 8, 2013

I will have a PR shortly...

msabramo added a commit to msabramo/virtualenv that referenced this issue Oct 8, 2013
pnasrat added a commit to pnasrat/virtualenv that referenced this issue Oct 8, 2013
@pnasrat
Copy link

pnasrat commented Oct 8, 2013

Ah I just did the same, also pulling in all the 3.3 modules. I'll merge mine thanks for the PR though

@msabramo
Copy link

msabramo commented Oct 8, 2013

Cool, good to see it fixed!

@msabramo
Copy link

msabramo commented Oct 8, 2013

This should be marked resolved?

@gawry
Copy link

gawry commented Apr 23, 2014

I have seen what seems the same error on python 3.4/ubuntu 14.04.

Is this the same error? Shouldn't this be fixed?

Running virtualenv with interpreter /usr/bin/python3.4
Using base prefix '/usr'
New python executable in af_py3/bin/python3.4
Also creating executable in af_py3/bin/python
Failed to import the site module
Traceback (most recent call last):
  File "/home/user/af_py3/lib/python3.4/site.py", line 67, in <module>
    import os
  File "/home/user/af_py3/lib/python3.4/os.py", line 614, in <module>
    from _collections_abc import MutableMapping
ImportError: No module named '_collections_abc'
ERROR: The executable af_py3/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/home/user' (should be '/home/user/af_py3')
ERROR: virtualenv is not compatible with this system or executable 

@msabramo
Copy link

Hmmm, yeah it seems like pnasrat@8ce3fcf (line 133 in particular) fixes this. I wonder if your virtualenv has this -- what does virtualenv --version say?

@gawry
Copy link

gawry commented Apr 23, 2014

@msabramo
virtualenv --version
1.10.1

@msabramo
Copy link

@gawry: That doesn't have the fix:

$ git clone git@github.com:pypa/virtualenv.git
...
$ git checkout 1.10.1
...
HEAD is now at b8e43e7... Bump version to 1.10.1
$ git blame virtualenv.py | grep ' 133)'
29682202 (Carl Meyer             2011-03-18 19:05:49 -0400  133)     if minver == 3:

1.11.1 changelog:

1.11.1 (2014-01-20)

Fixed an issue where pip and setuptools were not getting installed when using the --system-site-packages flag.
Updated setuptools to fix an issue when installed with easy_install
Fixed an issue with Python 3.4 and sys.stdout encoding being set to ascii
Upgraded pip to v1.5.1
Upgraded setuptools to v2.1
$ git checkout 1.11.1
Previous HEAD position was b8e43e7... Bump version to 1.10.1
HEAD is now at ef04aed... Version bump and changelog
$ git blame virtualenv.py | grep ' 133)'
8ce3fcf1 (Paul Nasrat            2013-10-08 13:48:05 -0400  133)     if minver >= 3:

Note that this has @pnasrat's commit 8ce3fcf, which changes the == to a >= which should make it install the collections module in 3.4 (8ce3fcf1#diff-7e83770aa980bd4327db90f4eafeffdfR133).

so therefore I would suggest that you upgrade to the latest version of virtualenv (at least 1.11.1 but might as well go with the latest probably):

pip install --upgrade virtualenv

and see if that fixes the problem.

@gawry
Copy link

gawry commented Apr 23, 2014

for some reason pip install --upgrade virtualenv was not getting the most recent version. Now it's working. Thanks!

@russellballestrini
Copy link

@msabramo I tried sudo pip install --upgrade virtualenv but it had its own errors.

I fixed my Ubuntu 14.04 by doing the following:

sudo apt-get remove python-virtualenv
sudo apt-get autoremove
sudo apt-get python-pip
sudo pip install --upgrade -e "git+https://github.com/pypa/virtualenv.git#egg=virtualenv"

Now I'm able to create virtualenvs for python3 again using:

virtualenv env3 --python=/usr/bin/python3

Some bits stolen from the Pyramid guys here: Pylons/pyramid#1188

sharidas pushed a commit to sharidas/meta-mentor that referenced this issue Dec 21, 2016
There is a potential bug in the virtualenv residing in
RHEL 7.3 version. The bug is listed here:
pypa/virtualenv#463

So inorder to overcome this issue, a work around created.

JIRA: SB-8485

Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
sharidas pushed a commit to sharidas/meta-mentor that referenced this issue Dec 22, 2016
There is a potential bug in the virtualenv residing in
RHEL 7.3 version. The bug is listed here:
pypa/virtualenv#463

So inorder to overcome this issue, a work around created.

JIRA: SB-8485

Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
sharidas pushed a commit to sharidas/meta-mentor that referenced this issue Dec 23, 2016
There is a potential bug in the virtualenv residing in
RHEL 7.3 version. The bug is listed here:
pypa/virtualenv#463

So inorder to overcome this issue, a work around created.

JIRA: SB-8485

Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
sharidas pushed a commit to sharidas/meta-mentor that referenced this issue Dec 23, 2016
There is a potential bug in the virtualenv residing in
RHEL 7.3 version. The bug is listed here:
pypa/virtualenv#463

So inorder to overcome this issue, a work around created.

JIRA: SB-8485

Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Mar 12, 2020
el7 now ships python36-virtualenv-15.1.0-4 which contains the fix of
pypa/virtualenv#463

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Mar 12, 2020
el7 now ships python36-virtualenv-15.1.0-4 which contains the fix of
pypa/virtualenv#463

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Mar 12, 2020
el7 now ships python36-virtualenv-15.1.0-4 which contains the fix of
pypa/virtualenv#463

Signed-off-by: Kefu Chai <kchai@redhat.com>
pritha-srivastava pushed a commit to ceph/ceph-ci that referenced this issue May 7, 2020
el7 now ships python36-virtualenv-15.1.0-4 which contains the fix of
pypa/virtualenv#463

Signed-off-by: Kefu Chai <kchai@redhat.com>
@pypa pypa 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

8 participants