Using snap I installed python38 on an Ubuntu 18 server. now I want to create a new virtual environment but I fail as these commands fail:
virtualenv --python /snap/bin/python38 myvenv
Running virtualenv with interpreter /snap/bin/python38
python3.8: can't open file '/usr/lib/python3/dist-packages/virtualenv.py': [Errno 2] No such file or directory
test -f /usr/lib/python3/dist-packages/virtualenv.py; echo "it exists!"
# OUTPUT: it exists!
# --------------------------------------------------------------------------------
python38 -m venv myvenv
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/tmp/myvenv/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']
This is my first experience with snap, and I'm unsure how I can install python3-venv to make it work.
Any help would be appreciated
Related
I want to create a venv having python3.8 as python3
On Ubuntu 18.04
I did:
> sudo apt install python3.8 python3.8-venv
Now, when I try:
> python3.8 -m venv env
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/pushp/vizio-backend/env/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']
My application depends on python3.8. What am I missing here?
Resolved, what I did? :
apt install python3.8 python3.8-venv python3-venv
Dont know how but installing both the venv packages python3.8-venv python3-venv resolved it from me. Now when I do:
python3.8 -m venv env
source env/bin/activate
python3 --version
> Python 3.8.0
first:
sudo pip3 install virtualenv
then cd to the directory where you want your virtual environment to be:
virtualenv "name of env" for ex: sudo virtualenv myProject-env
then to activate:
sudo source myProject-env/bin/activate
to make sure that it is work:
sudo which python
Installing python3-distutils also works around the problem.
You might miss the virtual environment installation in your machine.
You can install virtualenv using the following command,
sudo apt-get install python3.8-venv python3-venv
or
python3 -m pip install virtualenv
Referring this document from digitalOcean i got the same error but here in this linein this image change python3.6 to python3.8 then it will work fine.
change python3.6 -m venv my_env to python3.8 -m venv my_env
How to install virtualenv properly on AWS Ubuntu 18.04 AMI. I have tried various ways such as through pip and through apt-get but I am not able to either properly install or configure it. Whenever I am running command virtualenv --python=python3.6 .venv or virtualenv --version it is giving me this error:
ERROR:root:failed to read config file /home/ubuntu/.config/virtualenv/virtualenv.ini because PermissionError(13, 'Permission denied')
How to properly install and configure virtualenv?
First check if Python3 is installed
apt list installed | grep -i python3
After that
python3 -m venv my_app/env
For some reason when I run pipenv install it tries to execute my Windows python.exe:
OSError: [Errno 8] Exec format error: '/mnt/c/Users/<MY_USER_NAME>/AppData/Local/
Microsoft/WindowsApps/python.exe'
I am running WSL Ubuntu 18.04. I have installed Pipenv with the following commands:
sudo apt install python3-pip
pip3 install --user pipenv
python3 -m site --user-base
Added ~/.local/bin to ~/.profile PATH, and then source ~/.profile
This worked for me:
pipenv install --python=/usr/bin/python3.6
Explanation: https://github.com/pypa/pipenv/issues/3488
The python version on Windows is higher than that on WSL, making it
come before the latter one..
Specify python path explicitly can fix the problem:
$ pipenv --python /usr/bin/python3
I'm a complete beginner to Ubuntu and I'm trying to create a virtual environment on Ubuntu 18.04. I had one running and it was working just fine, but I don't know what I did and know I cant get it to run.
I deleted my old env/ file and now I'm trying to create a new one using
python3 -m venv env
but I get the following error
Error: Command '['/home/user/app/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit s
tatus 1.
What gives?
Do you have the python3-venv package installed?
If not - install it with apt-get install python3-venv and try again python3 -m venv env
just reinstall your python3-venv
apt-get purge python3-venv
apt-get install python3-venv
and then create the virtualenv
python3.7 -m venv venvTest
if you have different version of python3, you should mention the exact python3 version.
you can also migrate your python3.6 to python3.7 by following guide migrate python3.6 to python3.7
I have python virtualenv and trying to install nodeenv it throws
"no python virtualenv is available"
inside my activated python virtual env with . bin/activate
I run the following commands
pip install nodeenv
nodeenv -p
And it throws the error... I'm currently trying to install less with django-compressor
This also happened to me, it's because nodeenv is not installed in your virtual environment. The following solved it for me:
sudo pip uninstall nodeenv
# Source your virtual environment.
source /path/to/virtualenv
pip install nodeenv
nodeenv -p
This happened to me on Mac OSX Yosemite.
I had installed nodeenv as a user. The solution was to install it as root:
pip uninstall nodeenv
sudo pip install nodeenv
# Source the virtual environment or use workon for virtualenvwrapper
workon <virtualenv name>
nodeenv -p