10

I have successfully setup WSL on my Windows 10. I have also successfully downloaded and installed Python3. However, I am unable to get pip. How do I get pip?

gyu@LAPTOP-PR3:/mnt/c/Windows/system32$ python3 --version
Python 3.8.2
gyu@LAPTOP-PR3:/mnt/c/Windows/system32$ python3 -m pip list
/usr/bin/python3: No module named pip
gyu@LAPTOP-PR3:/mnt/c/Windows/system32$ sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3-pip' has no installation candidate
gyu@LAPTOP-PR3:/mnt/c/Windows/system32$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip

EDIT:

Here is the output from the sudo apt-get update

Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out
Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
Err:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
Err:4 http://security.ubuntu.com/ubuntu focal-security InRelease
  Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
quantum231
  • 201
  • 1
  • 2
  • 6
  • 1
    Have you run `sudo apt-get update` yet? What's the output? – muru Dec 30 '21 at 15:22
  • Is the apt-get update supposed to work in the WSL? – quantum231 Dec 30 '21 at 16:11
  • Looks like you have two separate, unrelated problems. 1) You have a networking problem. Solve that first. 2) python3-pip is in the `universe` pocket of the Ubuntu repositories. Looks like you don't have that pocket enabled. [How to enable the Universe pocket](https://askubuntu.com/questions/148638/how-do-i-enable-the-universe-repository) – user535733 Dec 30 '21 at 17:04
  • @quantum231 And yes, to be clear, `sudo apt update` should work on WSL (all versions). As noted, if it isn't, there's a more general issue going on. Can you access other sites? E.g. `ping stackoverflow.com`? – NotTheDr01ds Dec 30 '21 at 18:51
  • Yes, ping works fine. There is no VPN. This is the first time I am using WSL. I only installed in today you see. – quantum231 Dec 30 '21 at 21:29
  • I just tried ping command with security.ubuntu.com and archive.ubuntu.com, both work with ping but the apt-get update still does not work, I am lost. – quantum231 Dec 30 '21 at 21:32
  • Does this answer your question? [0% \[Connecting to archive.ubuntu.com (2001:67c:1360:8001::17)\]](https://askubuntu.com/questions/949663/0-connecting-to-archive-ubuntu-com-200167c1360800117) – karel Dec 31 '21 at 01:11
  • ok what I can see is that using ping6 does not work, ping6 www.google.com fails – quantum231 Dec 31 '21 at 12:55
  • I would wipe my python install and try the instructions here. https://askubuntu.com/a/1459889/1682329 I had a similar issue, different error message. This should work. The benefit of this approach is that you are only installing pip for the version of python you want, whereas the normal apt command will cause it to install pip with the latest python. – dboggs95 Mar 19 '23 at 18:57
  • Can you get a `pip` update package so you can update locally if the network is blocked? – NeilG May 04 '23 at 17:05

1 Answers1

15

Run sudo apt-get update after that Run sudo apt install python3-pip it will install a lot of missing components... and python pip is installed.

Frankthetank
  • 151
  • 1
  • 3