In wsl2 - Ubuntu 24.04. when try to install sudo apt install python3-pip
it is throwing bellow error
Package 'python3-pip' has no installation candidate.
Try adding external repo. But no luck still missing pip on Ubuntu. I am using python 3.12.3.
after using apt install python3-pip
Response:
`E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
the above lock file Error is gone, if I use sudo apt install python3-pip
after using sudo add-apt-repository universe
Error Response:
Err:8 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages Hash Sum mismatch Hashes of expected file: - Filesize:1773236 [weak] - SHA256:945d0f8ce76c64040467c29e2d3cc01e1f5ae42acb0f5233310904a6517198f7 - SHA1:1fee603eb8bf94977b803943c995aa5f8d2c9497 [weak] - MD5Sum:f81f59c6260924245f4a61bb75ce4dd0 [weak] Hashes of received file: - - Filesize:1773236 [weak] Last modification reported: Wed, 24 Apr 2024 20:03:10 +0000 Err:12 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages .... Get:15 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [14.1 MB] Err:15 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages Hash Sum mismatch Hashes of expected file: - Filesize:14090084 [weak] [....] Hashes of received file: - Get:20 http://archive.ubuntu.com/ubuntu jammy/universe Translation- en [5652 kB] Err:20 http://archive.ubuntu.com/ubuntu jammy/universe Translation-en Fetched 23.3 MB in 12s (1983 kB/s) Reading package lists... Done W: An error occurred during the signature verification. <ftpmaster@ubuntu.com> [.....] W: Some index files failed to download. They have been ignored, or old ones used instead.
Search Package Search link
Problem solved:
1. Proper way to add external Repo (without any error). sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted"
Ref. Link: how-do-i-enable-the-universe-repository
2. Now excuecute the command sudo apt-get update
. finally everything working perfectly, without any error.
3. Now to install pip, execute the command sudo apt install python3-pip
. And sucesssfully installed the pip without any error.
Note:
- Currently I am using Ubuntu version 24.04.3, after uninstall the previous version 24.04