18

I am trying to create virtual env with python2 in mac os from here. While running pip install virtualenv command in terminal I am getting following error.

Could not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv
user513951
  • 12,445
  • 7
  • 65
  • 82
sshah
  • 263
  • 1
  • 4
  • 9

9 Answers9

16

If you are using python 3.x, Please try this commands

sudo pip3 install --upgrade pip

sudo pip3 install virtualenv

Community
  • 1
  • 1
Bharath KM
  • 211
  • 2
  • 6
15

Please try below commands

pip install --upgrade virtualenv
Kamal
  • 309
  • 2
  • 5
14

Run this command and try again

curl https://bootstrap.pypa.io/get-pip.py | python

The detailed description can be found in the link shared by Anupam in the comments.

shammerw0w
  • 1,931
  • 1
  • 13
  • 10
  • 1
    the above commands for my windows 10 and python 3.6.5 gave error `The target principal name is incorrect.` how did get this one working. – Nitish Kumar Pal Jul 03 '18 at 11:08
  • 5
    I had todo `curl https://bootstrap.pypa.io/get-pip.py | sudo python` for it to work on my machine (note the `sudo` before the `python`) – James111 Aug 02 '18 at 05:05
  • Thanks. Doing this solves my problem. One thing I noticed before/after was that pip seems to talk to "pypi.python.org" before and "pypi.org" after. Seems like some new packages are maintained in a new repo perhaps ???... In particular, I was trying to install scikit-learn. – tuan.dinh Nov 30 '18 at 05:14
2

We tried the above but they didn't work in our case because we had two versions of python3 on the systems. One via a normal install a few months back and one via brew (on a Mac). When we discovered that, we downloaded and installed the latest version from python.org and as a result the pip was updated too. Once the pip was installed the sudo pip3 install virturaenv command worked fine.

Anthony Petrillo
  • 365
  • 1
  • 4
  • 13
0

pip install --upgrade virtualenv

This solution works for me in Centos8

  • 1
    This solution has already been posted, see [Kamal's answer](https://stackoverflow.com/a/55620248/2227743). – Eric Aya Jan 26 '21 at 09:49
-1

Try Below commands:

pip install --upgrade pip

pip install <'package-name'>

example: pip install locust_plugins

To check the list of packages installed, use below command:

pip list

I tried the same and it worked for me

-1

It is sometimes because of connectivity issue. Re-running the same command when connectivity is okay solves it.

pip install virtualenv

Initial Output:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000023A91A94190>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/virtualenv/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000023A922B3390>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/virtualenv/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000023A922B0850>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/virtualenv/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000023A922C5990>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/virtualenv/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000023A922C64D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/virtualenv/
ERROR: Could not find a version that satisfies the requirement virtualenv (from versions: none)
ERROR: No matching distribution found for virtualenv
WARNING: There was an error checking the latest version of pip.

Output after re-run when connectivity is okay:

Collecting virtualenv
  Using cached virtualenv-20.17.0-py3-none-any.whl (8.8 MB)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/distlib/
Collecting distlib<1,>=0.3.6
  Using cached distlib-0.3.6-py2.py3-none-any.whl (468 kB)
Collecting filelock<4,>=3.4.1
  Using cached filelock-3.8.0-py3-none-any.whl (10 kB)
Collecting platformdirs<3,>=2.4
  Using cached platformdirs-2.5.4-py3-none-any.whl (14 kB)
Installing collected packages: distlib, platformdirs, filelock, virtualenv
Successfully installed distlib-0.3.6 filelock-3.8.0 platformdirs-2.5.4 virtualenv-20.17.0

[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
-1

One of the important reasons for this problem is the lack of proper connection to the Internet. If you have this error to install other modules, try to make sure of your internet connection.

Note: If you use vpn, try to connect and disconnect it once, the problem may be with vpn.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 31 '23 at 13:39
-5

If you are using Windows, you have to run cmd as admin.

double-beep
  • 5,031
  • 17
  • 33
  • 41
sk3k
  • 1
  • 3
    This is not an answer to the question. It should be a comment on the related answer instead. – walnut Sep 07 '19 at 10:44