apt-get install is not working in WSL
99,602
Solution 1
Executed below 2 commands and then I was able to install the packages.
sudo apt update
sudo apt install python3-pip
Source - https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/
Solution 2
System: Windows 10 Enterprise, Ubuntu Windows Subsystem for Linux.
I ran this command:
sudo apt-get install dos2unix
I had this error:
E: Unable to locate package dos2unix
I then ran:
sudo apt-get update
and then:
sudo apt-get install dos2unix
and it installed properly.
Related videos on Youtube
Author by
Devoloper250
Updated on September 18, 2022Comments
-
Devoloper250 over 1 year
Windows 10 Ubuntu bash failing to install packages. Whenever I try install new package with below command, getting same error.
root@VASI-HOME-PC:/mnt/c/Users/vadap# apt-get install atom Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package atom
This is not just with atom pacakge but i tried installing other packages like pip as well and received same error.
-
Ramhound over 5 yearsThe error message you received, indicates Atom is required, which means the package you are trying to install has a GUI. That isn't going to be supported by WSl out of the box. In other words, you are not going to be able to install any package, that requires Atom.
-
Devoloper250 over 5 years@Ramhound I have tried to install pip and few other packages. I have received the same error. Does it mean all of them had GUI ?
-
Willman over 3 yearsI'm having this issue on WSL2 Debian 10, trying to install
openssh-server
as root user. I think the issue the OP had was that he was invokingapt
as the root user, and not sudoing from an unprivileged user. I'm not sure why, butapt
only works when you run it with sudo from a non-root user...
-
-
Ramhound over 5 yearsThis answer is unlikely to be well recieved, unless you provide the relevant information from the link, like what you actually did in the body of the answer.
-
Devoloper250 over 5 yearsThank you @Ramhound . I have updated the steps executed and later I was able to install the packages like pip.
-
Scott - Слава Україні almost 5 yearsWhat did you add to the
sources.list
file? Please do not respond in comments; edit your answer to make it clearer and more complete. -
Qinsi almost 5 years@Scott File content added ;D
-
Timo over 3 yearsAfter
update
doapt upgrade
to be updated. -
NotTheDr01ds almost 3 yearsThis is exactly the same thing that the accepted answer already says. Do you have additional information to add?
-
Admin almost 2 yearsI just
sudo apt update
followed bysudo apt upgrade
like Timo said and that was enough for me to get it to work.