165

I upgraded from ubuntu 14.04 to ubuntu 16.04 a few days ago. When I try to create a virtual env by using

pyvenv .venv

or

python3 -m venv .venv

There is an error:

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/user/.venv/bin/python3.5', '-Im', 'ensurepip', '--upgrade', '--default-pip']

I tried running both

sudo apt-get install python3-venv

and

sudo apt-get install python3.5-venv

but it did not solve my problem.

ankostis
  • 8,579
  • 3
  • 47
  • 61
Louis M
  • 4,036
  • 4
  • 21
  • 25
  • My problem is solved on OS with release info: Distributor ID: LinuxMint Description: Linux Mint 18.3 Sylvia Release: 18.3 – nix Jan 18 '18 at 06:38
  • 2
    none of the answers solved it for me. still stuck on same error – Shoaib Iqbal May 18 '18 at 11:42
  • Possible duplicate of [Python locale error: unsupported locale setting](https://stackoverflow.com/questions/14547631/python-locale-error-unsupported-locale-setting) – S.S. Anne Sep 16 '19 at 11:51
  • Advice for similar Qs: problems related to `python3-venv` need the exception from the `Failing command: ['/home/user/...` and are highly sensitive to: a) to the specific Debian/Ubuntu release we're talking about, b) whether the asked `venv` to install is the default for that distribution-release or an older/later one, and c) any customized apt-repos in /etc/apt/sources.list. – ankostis Jan 22 '21 at 16:00
  • use virtualenv instead; `python3 -m pip install virtualenv` – Elijah May 30 '22 at 04:22
  • I posted an answer and now noticed it is the same as @Elijah comment ... this is the solution if you do not want to install any apt packages. Remember to use the script `virtualenv` afterwards, **not** `python3 -m venv` ... as that will still be broken. – Pykler Feb 22 '23 at 18:14

32 Answers32

223

try installing python3.6-venv:

sudo apt-get install python3.6-venv
jnicho02
  • 2,567
  • 1
  • 15
  • 10
  • 3
    Thanks for the solution. It worked on 16.04 (given that python3.6 was installed already of course). What I do NOT understand is that: 1. venv should precisely make using apt-get unecessary. It's part of the standard library. 2. why is the default version of pip using venv not the latest version? – Lionel Trebuchon Jun 04 '18 at 16:03
  • 59
    ...or `sudo apt-get install python3.7-venv` if you use python 3.7 – Alleo Sep 27 '18 at 02:03
  • 46
    ...or `sudo apt-get install python3.8-venv` if you use python 3.8 – cowlinator Jan 22 '20 at 00:58
  • 24
    ...or `sudo apt-get install python3.9-venv` if you use python 3.9 (for future) – Andrey Semakin May 24 '20 at 14:41
  • 58
    ...or `sudo apt-get install python3.10-venv` if you use python 3.10 (in case we survive 2020) – MadHatter365 Aug 28 '20 at 19:44
  • This format works for my python installation on a linux mint 20 environment – Akah Jul 08 '21 at 13:06
  • 1
    Hmm, in my ubuntu 18.04, `sudo apt-get install python3-venv` printed: `The following NEW packages will be installed: python3-venv python3.6-venv`, so it worked automatically. – wisbucky Sep 02 '21 at 20:48
  • @AndreySemakin My saviour! Re: wisbucky's comment... I installed python3-venv, but it didn't work. The ensurepip module was only found after I installed python3.9-venv (in my case). Does anyone know why you have to install the specific version (3.9) of the package vs the general python3-venv? – Cornel Masson Jan 27 '22 at 08:50
  • 1
    I think we get the pattern now. – odigity Mar 21 '22 at 21:55
  • ...or `sudo apt-get update -y && sudo apt-get install pythonX.X-venv` if it still cannot find pythonX.X-venv – orpheus Apr 19 '22 at 17:54
  • Isn't the point of pyenv to not have to install every python version under the sun through the package manager? – Marcel Jun 18 '22 at 05:28
  • ...or sudo apt-get install python3.11-venv we are still alive this is 2023 – Samad Aug 06 '23 at 13:32
144

It seems that it was a locale problem. Solved by executing:

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales

found on this thread Python locale error: unsupported locale setting

Community
  • 1
  • 1
Louis M
  • 4,036
  • 4
  • 21
  • 25
  • 45
    It's crazy but it's true – user1703761 Sep 21 '16 at 12:42
  • 9
    Really curious, but someone knows what is the reason? – Juan Antonio May 24 '17 at 21:52
  • did not work for me on OS with distro info :Distributor ID: LinuxMint Description: Linux Mint 18.3 Sylvia Release: 18.3 – nix Jan 18 '18 at 06:40
  • 2
    Thanks, running a minimal docker setup here. I'd **never** have guessed. – Antti Haapala -- Слава Україні Feb 22 '18 at 12:14
  • This worked on Ubuntu 16.04 running both Python3.5 and Python3.7. – Andreas Bergström Dec 11 '18 at 10:23
  • 1
    @JuanAntonio It seems Ubuntu (at least 16.04) is a non-unicode bistro out of the box, as mentioned in this issue: https://tickets.puppetlabs.com/browse/IMAGES-498 Guess we should add locale settings to our server bootstrapping... – Andreas Bergström Dec 11 '18 at 10:27
  • I did this command on ubuntu 16.04. I didn't solve the problem, and now the terminal won't start (the mouse shows a spinner indefinitely when I try to start the term). Xterm does start though. – Benjamin Crouzier May 07 '19 at 16:55
  • didn't work for me - solution was to 'sudo apt-get install python3.6-venv' as suggested by jnicho02 – Octave Sep 24 '19 at 15:04
  • In some circumstances, this can fail with `setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory` – cowlinator Jan 22 '20 at 00:56
  • Only this option worked for me. All above options didn't worked. – codeomascot Jul 15 '20 at 12:31
  • 4
    I always run into problems like this when using Python and Pip. Either something isn't available / installed, a virtualenv isn't working, etc. Then you have to spend half an hour debugging stuff in a language where you may not be an expert. On top of that you get ambiguous suggestions like "You may need to use sudo with that command." which opens up a whole new rats nest. – Snowcrash Jan 14 '21 at 09:04
  • what if we're not in the US? – joel Feb 05 '21 at 01:44
  • 3
    It's crazy but *this doesn't always solve the problem* – JDiMatteo Feb 18 '21 at 00:40
  • Be careful while running the command. Those are environment variables that could screw up applications depending on them. – Miebaka Oct 24 '22 at 00:03
  • You are wonderful. This made catkin_make on RPi3 run successfully to build an obscure nmea_navast_driver that was driving me crazy. Arcane and cryptic. – tobi delbruck May 07 '23 at 14:48
80

Under Windows Linux Subsystem and Ubuntu 18.04, this was caused by my not having upgraded recently.

I ran:

sudo apt update
sudo apt upgrade

Then sudo apt install python3-venv worked.

Note that I had also tried the UTF-8 solution beforehand (I made it part of my .bashrc), so that could have been a contributing factor.

Eponymous
  • 6,143
  • 4
  • 43
  • 43
  • 7
    I don't think the UTF-8 solution matters. I'm also on WSL Ubuntu 18.04 and the steps `sudo apt update` and `sudo apt install python3-venv` were sufficient. – Theja Jun 06 '19 at 13:07
  • 1
    This is the only solution that worked for me! I tried changing locale and installing newer version of Python to no avail – arctic.queenolina Apr 12 '20 at 11:17
  • 2
    this worked for me too, I tried several other options .. it did not work , – Learner Apr 20 '20 at 08:59
  • 2
    Same here. I tried `sudo apt install python3-venv` several times without success. But everything worked after the update/upgrade. – joctee Jun 01 '21 at 10:21
  • This is a simple answer but this helped me. – Arefe Oct 20 '21 at 15:51
  • 1
    This worked on my WSL installation which I just installed today `5.15.79.1-microsoft-standard-WSL2`. I did not need any of the other solutions. – Ð.. Jan 10 '23 at 02:58
  • properly worked at my end also, thanks – Habibul Hasan Aug 04 '23 at 06:36
62

One of the other answers fixed it for me last time, but with Python 3.7 I had to do:

apt install python3-pip python3-setuptools python3.7-venv

Followed by

python3.7 -m venv /path/to/venv
Aaron F
  • 1,146
  • 12
  • 11
13

Resolved similar problems on Ubuntu18 when came upon this answer. It is similar to the one that worked for @Niko Rikken, except it doesn't really need any new PPA's and "python3.8-distutils" package. I was installing new python3.8 environment with venv and I already had "python3-venv" installed and up to date, so my solution was to install only "python3.8-venv":

% sudo apt-get install python3.8-venv

And that got this lines working:

% python3.8 -m venv ~/envs/new_env
% source ~/envs/new_env/bin/activate
Rustam A.
  • 809
  • 8
  • 15
11

In my case the next steps worked:

  • Ubuntu 18.04.4 LTS
 $ sudo apt-get install python3-venv python3.7-venv
 $ python3.7 -m venv [your_path_to_virtual_env_here]
Eduardo RE
  • 171
  • 1
  • 5
9

In case this helps anyone down the line, I was getting the same error on Ubuntu 18.04. Setting the locales didn't work and trying to install python3-venv gave the error:

$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-venv : Depends: python3.6-venv (>= 3.6.5-2~) but it is not going to be installed
                Depends: python3 (= 3.6.5-3) but 3.6.7-1~18.04 is to be installed
E: Unable to correct problems, you have held broken packages.

And it looks like the apt repository had two versions of python:

$ apt list python3 -a
python3/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
python3/bionic 3.6.5-3 amd64

I tried to install Python3.6.5-3 but apt wanted to uninstall every dependency. I was able to solve the problem by installing Python3.7 and creating the venv with that:

$ sudo apt-get install python3.7 python3.7-venv
$ python3.7 -m venv my_venv
nbwoodward
  • 2,816
  • 1
  • 16
  • 24
  • 1
    This worked for me. Did `sudo apt install python3.8 python3.8-venv` and created the virtual environment using `python3.8 -m venv venv_name`. Thanks! – Amir Shabani Dec 06 '19 at 18:14
9

I encountered this problem on Ubuntu 18.04 for the recent release of Python-3.8. My solution was to add the Deadsnakes PPA which supplies the required python3.8-distutils package. The python3.8-venv package is already in the repository. Thanks to this blogpost:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8
sudo apt install python3.8-distutils
sudo apt install python3.8-venv

Note: This is only a temporary solution. In the near future the required python3.8-distutils package will probably be available in the default Ubuntu repository.

Edit:

For Ubuntu 20.04 LTS the python3-distutils package is based on Python 3.8. As of yet there is no Python 3.8 package distutils package available for Ubuntu 18.04 LTS.

As mentioned in other comments on this thread, distutils might not be required. It was for my use-case, but please consider that solution before adding additional PPA's.

Nico Rikken
  • 2,229
  • 1
  • 6
  • 6
  • 1
    `sudo apt install python3.8-venv` was the winner for me. All the other help I could find had me trying to install `python3-venv` instead. – user1717828 Sep 19 '20 at 00:38
6

Python updated or Default python changed and venv already installed

the venv installed on your system is installed by your previous python version(let say python3.6). that's why venv is not working with current python version(lets say 3.8).

so first check your default python or python3 version,( suppose ur current version is python3.8).

reinstall virtual environment by mentioning current python version(3.8) as follow

sudo apt-get install python3.xx-venv        >> replace xx with your current/default python version

if this helps you plz upvote, I'm new on this platform.

  • But the last command you suggested is that it doesn't work. You seem to solve another problem, that of an existing venv being broken when underlying python-interpreter gets updates, while the OP asks for help how to create a new venv. – ankostis Jan 20 '21 at 20:55
  • Question was asked in 2016 and his problem has been solved also in 2016. So its obvious i'm not answering for him. I got same problem due to mention reason, and i came to here, but its take 2days to realise and solve problem. So i have mentioned problem before answering. Thanks for comments. – RavinderSinghPB Jan 22 '21 at 02:46
  • This site does is not a forum, that is why it discourages irrelevant talk and not to-the-point solutions. – ankostis Jan 22 '21 at 15:53
6
  1. First, make a directory :
mkdir testing
  1. Then, moved to this directory named testing :
cd testing
  1. When you type following command in this directory:
python3 -m venv env

You got error like :

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 install python3.8-venv
  1. Type the following command but before that keep an eye on the version of python you installed on the machine; in my case its python3.8
sudo apt install python3.8-venv
  1. Now, we can create a virtual environment and store its tools in the "bhandari" folder .
python3 -m venv bhandari   

Note: you can named this "bhandari" folder; anyname you like( Standard practice is to name it "env" ...)

  1. Now to activate your virtual environment, from the directory of your folder, type the following command this will activate our virtual environment in the “bhandari” folder
source bhandari/bin/activate
  1. If you have successfully activated your virtual environment, you should see the (bhandari) word indicating that we are working in a virtual environment.

After this, we can install anything that will be isolated from the rest of the system....

Blairg23
  • 11,334
  • 6
  • 72
  • 72
Biku Shah
  • 107
  • 2
  • 5
6

I had to mention the specific version of python and replace python3.10 with you version

 $ sudo apt-get update -y && sudo apt-get upgrade -y
 $ sudo apt-get install python3.10-venv

Creating a virtual environment

$ python3.10 -m venv --system-site-packages Project_Name
Udesh
  • 2,415
  • 2
  • 22
  • 32
  • I using Ubuntu22.04, when running "sudo apt-get install python3.10-venv", I got the following errors: " ....... The following packages have unmet dependencies: python3.10-venv : Depends: python3.10 (= 3.10.6-1~22.04) but 3.10.6-1~22.04.1 is to be installed E: Unable to correct problems, you have held broken packages. " Too many bugs in the python&ubuntu pakcage version management. – Clock ZHONG Dec 29 '22 at 15:46
  • python3.10 works with this solution. – Jalil Nourmohammadi Khiarak Feb 02 '23 at 09:46
  • installing venv with specific version `apt-get install python3.7-venv` and then creating venv `python3 -m venv .venv` worked. Thanks – Sukhmeet Sethi Jun 12 '23 at 10:31
5

I was faced with the same problem and I am searching for a solution. It is about the problem:

ensurepip is disabled in Debian/Ubuntu for the system python.

And this my solution:

python3 -m venv myvenv --without-pip --system-site-packages
flaxel
  • 4,173
  • 4
  • 17
  • 30
hichem
  • 121
  • 1
  • 3
  • 7
5

Try the following commands:

sudo apt install python-virtualenv
virtualenv --python=python3.6 myenv

These commands might work for you.

If you get any error like E: Unable to locate package python3-venv Then try the following commands:

sudo apt install python3.6-venv
Jake Peralta
  • 408
  • 3
  • 9
4

Try : python3.* -m venv myvenv -

And don't forget to replace * with your specific version of python

Alexandre B.
  • 5,387
  • 2
  • 17
  • 40
Nax
  • 41
  • 4
3

If your intention was to get python3.8 incl. pip and venv on Ubuntu 18.04:

  • sudo apt install python3.8 python3.8-venv python3-pip # there is no python3.8-pip package
  • python3.8 -m venv venv
  • source venv/bin/activate
  • python --version # -> python 3.8.0
  • pip --version # -> pip 9.0.1 from /home/user/venv/lib/python3.8/site-packages (python 3.8)
langlauf.io
  • 3,009
  • 2
  • 28
  • 45
3

Try installing python3-distutils as well.
Altogether, for python 3.8, the following worked for me.

$ apt-get install python3.8 python3.8-venv python3.8-distutils python3.8-dev

xanjay
  • 561
  • 6
  • 20
3

I just ran across this issue on several Debian/Ubuntu systems. Same error as above.

Findings

I tried to create a venv manually with:

python -m venv venvdir

This failed in the same way as others have mentioned. But it did create the shell of the venv. So I tried running ensurepip:

venvdir/bin/python -m ensurepip

Traceback (most recent call last):
    File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main                       
        return _run_code(code, main_globals, None,                                             
    File "/usr/lib/python3.9/runpy.py", line 87, in _run_code                                  
        exec(code, run_globals)                                                                
    File "/usr/lib/python3.9/ensurepip/__main__.py", line 5, in <module>                       
        sys.exit(ensurepip._main())                                                            
    File "/usr/lib/python3.9/ensurepip/__init__.py", line 266, in _main                        
        return _bootstrap(                                                                     
    File "/usr/lib/python3.9/ensurepip/__init__.py", line 166, in _bootstrap                  
         copy_wheels(dependencies, venv_wheel_dir, sys.path)                                    
    File "/usr/lib/python3.9/ensurepip/__init__.py", line 144, in copy_wheels                  
        assert len(wheel_names) == 1, wheel_names                                            

AssertionError: ['/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl', '/usr/s
hare/python-wheels/pyparsing-2.4.7-py2.py3-none-any.whl']

This seemed odd. A quick look into /usr/share/python-wheels/ revealed - indeed - multiple versions of the same wheel as the error suggests. I have no clue why ensurepip is also ensuring that it only finds one wheel file, go figure.

Solution

A check of dpkg -S /usr/share/python-wheels indicated that the python-pip-whl package is the source of those files. This appears to be true for both Ubuntu and Debian.

So, I did:

cd /usr/share
sudo mv python-wheels python-wheels.old
sudo apt reinstall python-pip-whl

And it worked - no more errors. There are no longer duplicates in /usr/share/python-wheels

Absolutely no clue how there were duplicates or why ensurepip is so sensitive to duplicates there... Probably a package upgrade gone wrong somewhere.

2

I had the same problem - the python env has 2 versions for 2.7 and 3.6.

All you need to do is:

  1. Install the latest version of pip by installing pyenv installer
  2. Make sure you follow the steps of installing pyenv found here

Good Luck!

Rann Lifshitz
  • 4,040
  • 4
  • 22
  • 42
2

The solution for installing python3-venv is accurate since debian/ubuntu split the python distribution across multiple packages, so you do not actually have a full python install. If you really do not want to install this apt package, here is an alternative

python3 -m pip install virtualenv
virtualenv .venv

This will create fully functioning venv.

Pykler
  • 14,565
  • 9
  • 41
  • 50
1

I had the same problem for an existing project when executing python3 -m venv venv. I had just updated my Ubuntu and Python versions. After removing the already existing venv folder the issue was solved. (I have also tried the UTF-8 solution.)

Sparwer
  • 197
  • 2
  • 4
  • 13
1

My problem were related to permissions and ownership. I was logged in with a different user as the owner of the current directory, which led to this error. After reviewing and fixing all permissions I was able to install the venv regularl

  • This was my problem exactly. When I changed to the current users home directory the command ran fine. This must be a bug where it assumes python3-venv isn't installed when it's actually hitting a permissions issue. – Cosmicnet Oct 12 '20 at 15:43
1

This worked for me... Firstly, I ran

sudo apt-get update

Then

sudo apt-get install -y python3-venv zip

itslogique
  • 11
  • 2
1

Ran into the same issue recently. None of the solutions mentioned above worked for me. I eventually get it to working by installing pip3.

apt-get install python3-pip

# then run
python3.8 -m venv env
jdsantiagojr
  • 476
  • 7
  • 10
1

If you came across this issue while trying to run python -m build to build a python package, this means there probabaly is a syntax issue in your setup.cfg or setup.py file that causes an error creating the temporary venv required for installing dependencies.

Using pip wheels . will give you a less misleading error message.

toing_toing
  • 2,334
  • 1
  • 37
  • 79
1

For Linux, it is not installed by default you have to install venv

// at first check python version
python --version

// install 
sudo apt update
sudo apt install python3.8-venv
sudo apt install python3.8-distutils

// create new env
python3 -m venv project-name
source project-name/bin/activate
MD SHAYON
  • 7,001
  • 45
  • 38
0

All of these suggestions didn't help me.

$ apt list python3 -a
python3/now 3.6.7-1~18.04 amd64 [installed,local]
python3/bionic 3.6.5-3 amd64

So I did: sudo apt-get install python3/bionic

Now I have python 3.6.5 and apt-list showed a better list: $ apt list python3 -a python3/bionic 3.6.5-3 amd64

With sudo apt-get install python3-venv/bionic I could install pythno3-venv and everything worked.

Stefan
  • 170
  • 3
  • 9
  • I'm using ubuntu about 5 years actively but I never seen before that syntax "python3/bionic" :O your answer solved my problem thanks. – kodmanyagha Feb 26 '20 at 19:07
  • Glad it works, I didn't know that syntax either, I simply tried because "apt list" did show the packages that way ;-) If that answer helped you, you might hit the "up"-button. – Stefan Mar 02 '20 at 14:58
  • If you can use nonstandard package names, it means you have nonstandard package sources configured. `apt-cache policy python3/bionic` might help you figure out where this package is coming from. It's not from Ubuntu. – tripleee May 07 '20 at 09:25
0

In my case, running sudo apt-get install python3.8-venv succeeds but it shows the same error when running python3 -m venv .venv.

Finally, this command works out without changing locale.

python3.8 -c 'import venv; venv.create(".venv", with_pip=True)'

Wang
  • 35
  • 1
  • 8
0

Here is my answer for Ubuntu 14.04. I was able to make venv and pip work with various Python versions. Details:

  • 3.4: Ubuntu 14.04 has Python 3.4 (as package python3.4 etc.). It works:

    $ sudo apt-get install python3.4 python3.4-dev python3.4-venv gcc libc6-dev
    $ mkdir /tmp/try3.4
    $ python3.4 -m venv /tmp/try3.4
    $ . /tmp/try/bin/activate
    (try3.4) $ pip install print-hello-world
    ...
    (try3.4) $ print-hello-world
    Hello World!
    

    If python3.4-venv is removed from the apt-get install command above, then python3.4 -m venv displays the same error message as in the question. However, the error message mentions apt-get install python3-venv to solve it, but that doesn't work, there is no such package. (The correct package name is python3.4-venv.)

    Please note that Python 3.4 is fairly old, and some Python packages available in PyPI (via pip) don't work with it.

  • 3.5: It can be installed from the deadsnakes repository. It works:

    $ sudo add-apt-repository ppa:deadsnakes/ppa
    $ sudo apt-get update
    $ sudo apt-get install python3.5 python3.5-dev python3.5-venv gcc libc6-dev
    $ mkdir /tmp/try3.5
    $ python3.5 -m venv /tmp/try
    $ . /tmp/try/bin/activate
    (try3.5) $ pip install print-hello-world
    ...
    (try3.5) $ print-hello-world
    Hello World!
    
  • 3.6: Ditto, it can be installed from the deadsnakes repository. It works:

    $ sudo add-apt-repository ppa:deadsnakes/ppa
    $ sudo apt-get update
    $ sudo apt-get install python3.6 python3.6-dev python3.6-venv gcc libc6-dev
    $ mkdir /tmp/try3.6
    $ python3.6 -m venv /tmp/try3.6
    $ . /tmp/try3.6/bin/activate
    (try3.6) $ pip install print-hello-world
    ...
    (try3.6) $ print-hello-world
    Hello World!
    
  • 3.7: It doesn't work, because pip install fails with import _ssl, and python3.7 in the deadsnakes repo doesn't have that module, because Ubuntu 14.04 ships with on old version of OpenSSL which Python 3.7 doesn't support. See more details in this bug.

  • 3.8--: No Ubuntu 14.04 package for these Python versions in the Ubuntu or deadsnakes repositories.

pts
  • 80,836
  • 20
  • 110
  • 183
  • FYI, this late answer, while technically correct and useful for Ubuntu-14.04, does not answer the original Q for Ubuntu-16.04 :-( – ankostis Jan 22 '21 at 15:57
0

In my case, the command failed because I was still in a virtual env but did not notice it very quickly.

If it is the case, try calling deactivate.

SylvainD
  • 1,743
  • 1
  • 11
  • 27
0

I do not have sudo rights and I have to use python3.5:

  1. Install virtualenv: pip3 virtualenv
  2. Create virtualenv without pip: python3 -m venv --without-pip <path>
  3. Downloaded the proper pip bootstrap: https://bootstrap.pypa.io/pip/3.5/get-pip.py
  4. Run: <path>/bin/python3 get-pip.py

I did 'source <path>/bin/activate' and I got a working environment.

uuu777
  • 765
  • 4
  • 21
-1
sudo apt-get update 

Worked for me.

Edit: I would love to know what exactly what was the issue, but I don't know. I tried running commands as described by the questioner and it was giving error then I updated and it worked. :-D

user1953366
  • 1,341
  • 2
  • 17
  • 27
-2

None of this worked for me. I am using ubuntu 18.04. Just uninstalled anaconda completely and everything worked. Posted just in case it helps anyone. For commands to uninstall: https://linuxize.com/post/how-to-install-anaconda-on-ubuntu-18-04/

rm -rf ~/anaconda3
export PATH="/home/linuxize/anaconda3/bin:$PATH" 
rm -rf ~/.condarc ~/.conda ~/.continuum
  • 1
    Your `export PATH="..."` command is very unlikely to be needed for removing anaconda. – pts Nov 25 '20 at 20:52