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

stdout: AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython3macOsFramework' #1740

Closed
ssbarnea opened this issue Mar 19, 2020 · 10 comments

Comments

@ssbarnea
Copy link
Contributor

ssbarnea commented Mar 19, 2020

Apparently virtualenv==20.0.10 got us a new breaking bug.

centos-8 |     AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython3macOsFramework'

Something really bad slipped into this release as I can see a macos related exception on a linux platform.

Example: https://c549f30e8d3868372e7a-306bf88b8b0223e04364eb41d42ffe2c.ssl.cf5.rackcdn.com/713904/5/check/tripleo-ansible-centos-8-role-addition/3c03c6d/job-output.txt

If this really proves to be 20.0.10 regression, I would be happy to see it removed from pypi due to its nature.

@ssbarnea ssbarnea added the bug label Mar 19, 2020
ssbarnea added a commit to ssbarnea/pre-commit that referenced this issue Mar 19, 2020
Avoids regression pypa/virtualenv#1740
from latest version of virtualenv.

Fixes: pre-commit#1370
@gaborbernat
Copy link
Contributor

How did you install things? This feels like you have a bad install there.

@gaborbernat
Copy link
Contributor

Is it still the case with 20.0.12?

@gaborbernat
Copy link
Contributor

That class was added with 20.0.11; so it's right to be missing with 20.0.10. See 3816e7c

How do you pull it in from 20.0.10 when it's a 20.0.11 addition?

@gaborbernat
Copy link
Contributor

This feels mostly like a bad install; something that installed 20.0.10 over 20.0.12 or something like that and did not clear up correctly the old files. I'll close this for now without a reproducible example.

@rsslldnphy
Copy link

Hi, is it possible to reopen this? I'm running into the same problem with my circleci build, which uses this circleci docker image: https://github.com/CircleCI-Public/circleci-dockerfiles/blob/master/python/images/3.7.7/Dockerfile

Error happens when i run:

pip install pipenv --user
pipenv install

Error:

AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython3macOsFramework'

@gaborbernat
Copy link
Contributor

As explained above the only way this can happen is to have a faulty installation of virtualenv. If that's the case it's either a pip or the docker images bug. I'd try looking into it and opening issues there. If you can provide a simplified docker image that replicates the issue that could help though to identify the faulty element.

@ssbarnea
Copy link
Contributor Author

This is no longer a problem but I will post the investigation discoveries, so we maybe find a way to avoid it in the future. OpenStack is using an upper-constrains installation method for keeping its requirements under control and at that point it this was virtualenv==20.0.10, one week later it was bumped to 20.0.13. These bumps mostly automated and based on periodic jobs that look for new versions, performs some minimal testing and propose a bumping change to refresh them.

Now the funny part is that regardless our attempt to pin virtualenv to a newer version inside tox.ini file, we ended up getting the older broken version.

I am almost sure this was not a faulty installation of virtualenv but more likely a failed upgrade, maybe related to pip. Still, this seems to happen on CI on totally different users, so we should probably try to find what is causing it and how we can prevent it from happening.

I am not so much worried about the specific error here because we know this can happen if a newer version is installed without a full cleanup of the old version. Now the question is what can cause this? Because this happened on CI and was reproducible enough, I would rule out acts-of-god causes, I bet there is a bug somewhere.

I am worried because bigger projects do have a natural-lag in bumping versions, so they will be affected by regression in a release of virtualenv and it would not be uncommon for them to endup upgrading to an already outdated version of virtualenv, without them even knowing it. For example on openstack merging a single change can take one day, and when waiting-for review is close to zero. The real numbers are more like 1 week-ish and during last week we had 3-4 new virtualenv releases, we cannot really cope with that.

It may worth mentioning that this is not a complaint, I really appreciate all the time @gaborbernat is investing in virtualenv project, I am just trying to find ways to limit the amount of surprises from newer releases.

@gaborbernat
Copy link
Contributor

Just to be clear here. There was no faulty release here. The error you're describing can only come to life if somehow the installer pulled in the latest version, tried to install the older version and this somehow passed, but failed to uninstall the new version correctly. Both releases work fine, however you seem to have an installation that has some files from latest, some from the pinned version 🤷‍♂️

@monkut
Copy link

monkut commented Mar 25, 2020

Just hit this issue today in circleci...

Related circleci issue.
https://discuss.circleci.com/t/python-tox-doesnt-build-anymore/35059/6

I guess a cache issue with circleci?

In my case it happens when pipenv tries to create the virtualenv:

pipenv sync --dev
Creating a virtualenv for this project…
Pipfile: /home/********/app/Pipfile
Using /usr/local/bin/python3 (3.7.7) to create virtualenv…
AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython3macOsFramework'

Updated my circleci config to upgrade virtualenv as well during the setup process and it seemed to resolve the issue:

pip install pip -U
pip install pipenv -U
pip install virtualenv -U

@kalpeshtawde
Copy link

Thank you. It has solve the problem for me as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants