apt-get install is not working in WSL

6

3

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.

Devoloper250

Posted 2018-09-19T17:50:33.923

Reputation: 403

1The 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. – Ramhound – 2018-09-19T19:25:49.763

@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 ? – Devoloper250 – 2018-09-20T15:59:01.493

Answers

12

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/

Devoloper250

Posted 2018-09-19T17:50:33.923

Reputation: 403

This 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. – Ramhound – 2018-09-20T18:24:48.327

Thank you @Ramhound . I have updated the steps executed and later I was able to install the packages like pip. – Devoloper250 – 2018-09-20T18:37:25.530

1

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.

ProtoHumanCam

Posted 2018-09-19T17:50:33.923

Reputation: 11

0

The error you're getting is because "atom" isn't part of the default packages, but WSL does not support graphical applications like Atom so it would never work anyway.

I would recommend installing it for Windows which is available from their website atom.io.

To make sure a package is actually in the package system you can use apt search <whatever> or for a simpler output apt-cache search <whatever>.

NOTE: Do not do the following, but for completeness sake I'll add how to actually install it:

You need to add the atom repository with the following command: sudo add-apt-repository ppa:webupd8team/atom

After that you can install it by first updating the search cache with apt-get update and then installing the package with apt-get install atom.

Mikael Kjær

Posted 2018-09-19T17:50:33.923

Reputation: 1 318

0

Same error, solved after:

sudo vi /etc/apt/sources.list # add source
sudo apt update # update source cache

My sources.list file:

deb http://mirrors.163.com/ubuntu/ bionic main restricted
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted
deb http://mirrors.163.com/ubuntu/ bionic universe
deb http://mirrors.163.com/ubuntu/ bionic-updates universe
deb http://mirrors.163.com/ubuntu/ bionic multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security universe
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse

Edit this list according to your location, as some sources may not apply globally.

Qinsi

Posted 2018-09-19T17:50:33.923

Reputation: 101

1What did you add to the sources.list file? Please do not respond in comments; [edit] your answer to make it clearer and more complete. – Scott – 2019-06-18T02:33:10.867

1@Scott File content added ;D – Qinsi – 2019-06-19T06:01:35.397