Search code examples
pipvirtualenvubuntu-20.04cpythonpython-3.10

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


I am running Ubuntu 20.04.6 LTS and wanted to create a project with python3.10, so I installed the python using the deadsnakes PPA, it works fine

$ python3.10 Python 3.10.13 (main, Aug 25 2023, 13:20:03) [GCC 9.4.0] on linux Type 
"help", "copyright", "credits" or "license" for more information.
>>>

but when I try to create a virtualenv using the command

$ virtualenv -p python3.10 test_env

I get the error

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

Solution

  • Had this error message show up in PyCharm while trying to build venv's for my project.

    I rolled back virtualenv in my local Python3.9.1 install to version 20.23.0, then restarted PyCharm which fixed my problem.

    pip uninstall virtualenv

    pip install virtualenv==20.23.0