I'm trying to install PIL a python module on ubuntu

I first need to install a package called python-imaging using the following command

sudo apt-get build-dep python-imaging

When I try and do this I get the error

E: You must put some 'source' URIs in your sources.list

I saw this question whihc shows how to fix via the GUI but I'm using the command line. Does anyone know how I can fix this error..?

UPDATE: Based on the below answers I've updated my package list but I now get this error. Not sure if it is related, if not I'll start a new question as I can't find reference to the error anywhere.

E: Build-Depends dependency for python-imaging cannot be satisfied because candidate version of package python-all-dev can't satisfy version requirements  
share|improve this question
    
The first error message is quite confusing. It shows up although there are SOME sources in the file while the message implies that there are no sources at all. What the message tries to say is you have to ADD a source that contains the info. – Sören Dec 8 '17 at 15:11

You can edit the source list (/etc/apt/sources.list) directly. I think you need to add in/uncomment these lines:

deb-src http://archive.ubuntu.com/ubuntu trusty main restricted #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-updates restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse #Added by software-properties
deb-src http://security.ubuntu.com/ubuntu trusty-security restricted main universe multiverse #Added by software-properties
deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-proposed restricted main universe multiverse #Added by software-properties

I worked this out by disabling the source code option, and saving one copy of the sources.list file, then enabling the source code option, saving another copy, then running diff on both.

You may want to change the prefix http://gb. to the prefix of the other sources in your list (so it uses your nearest repo mirror), and you can also ignore the #Added by software-properties.

After editing sources.list, run sudo apt-get update before trying to install again.

The full diff can be found here


Another way is to generate a new one. One method to get a complete sources.list is to use this site:https://repogen.simplylinux.ch/

share|improve this answer
1  
"After editing sources.list, run sudo apt-get update before trying to install again." -- That was the key, thanks! – Kaushal Modi Nov 17 '17 at 19:34
1  
sudo sed -i -e 's/# deb-src/deb-src/' /etc/apt/sources.list – Vincent Dec 22 '17 at 15:09

16.10 run software-properties-gtk

then under the "Ubuntu Software" tab click "Source code":

enter image description here

This has added some deb-src lines under /etc/apt/sources.list, and now I can do sudo apt-get build-dep <package>.

I know you asked no GUI, but sometimes devs just don't support it properly... but you can always do a diff with this method and apply it later.

share|improve this answer
3  
This just worked for me with ubuntu 16.04 – Or Duan Mar 22 '17 at 16:31

Edit /etc/apt/sources.list

sudo nano /etc/apt/sources.list

remove # or add lines deb-src $url . $url = an esisting line

Example

deb http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted
deb-src http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted

deb blah blah

deb-src exact same blah blah

See https://help.ubuntu.com/community/Repositories/CommandLine for additional information.

share|improve this answer
10  
exec sudo apt-get update after editing the sources.list file – abidibo Mar 18 '15 at 11:57

For Ubuntu 16.04, I successfully made these updates to sources.list :

$ sudo diff /etc/apt/sources.list /etc/apt/sources.list.bkp 

6c6
< deb-src http://au.archive.ubuntu.com/ubuntu/ xenial main restricted
---
> # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial main restricted

19c19
< deb-src http://au.archive.ubuntu.com/ubuntu/ xenial universe
---
> # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial universe

39c9
< deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
---
> # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

53c53
< deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
---
> # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
share|improve this answer

In Linux Mint (I am on version 18) you can go to Software Sources (search for it in the start menu or open it from a terminal with software-sources). There, on the first tab, you will find a checkbox Enable source code repositories. If you enable this the program will put the correct lines into your /etc/apt/sources.list.d/official-source-repositories.list file. Just don't forget to sudo apt-get update (or hit Update the cache in the Software Sources) after that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.