Ubuntu – Error :: You must put some ‘source’ URIs in your sources.list

apt

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  

Best Answer

  • software-properties-gtk option "Source code"

    I recommend this for the desktop:

    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've couldn't find a clean CLI method so I create this bug report for it: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1802718

    Tested on Ubuntu 16.04 to 18.04.

    CLI method

    I recommend this for Docker images:

    sudo cp /etc/apt/sources.list /etc/apt/sources.list~
    sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
    sudo apt-get update
    

    Tested on the Ubuntu 18.04 Docker image. After this change, I can successful do for example:

    sudo apt-get build-dep hello
    

    and before the change it failed with the error:

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

    Previously mentioned at: https://askubuntu.com/a/1011675/52975 go and upvote that answer.

    Note however that the /etc/apt/sources.list file contains lines such as:

    # deb http://archive.canonical.com/ubuntu bionic partner
    # deb-src http://archive.canonical.com/ubuntu bionic partner
    

    which means that the above sed would enable sources but not non-sources for some types of repos. I don't think that it matters much though.

  • Related Question