Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am unable to create a new virtualenv in ubuntu?

So, I installed virtualenv in ubuntu terminal. I installed using the following commands:

sudo apt install python3-virtualenv
pip install virtualenv

But when I try creating a new virtualenv using:

virtualenv -p python3 venv

I am getting the following error:

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

How can I solve it?

like image 954
Phoenix Avatar asked Dec 10 '25 17:12

Phoenix


2 Answers

I had a similar experience. The reason for this is that I did it by installing two virtualenv with apt and pip3. This seems to be a known bug (See also here)

Another way a second (or third) instance of virtualenv might have come to your system is via sudo pip install.

So, to be sure you only have one version, you can remove all of them:

pip3 upip3 uninstall virtualenvninstall virtualenv
sudo pip3 uninstall virtualenv
sudo apt purge python3-virtualenv

...and then pick one and re-install it (my preference is userspace pip install virtualenv).

like image 164
daesoo9200 Avatar answered Dec 12 '25 07:12

daesoo9200


You don't need to use virtualenv. You can use this:

python3 -m venv ./some_env
like image 22
bichanna Avatar answered Dec 12 '25 07:12

bichanna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!