I have recently installed Ubuntu 12.04 LTS and I wanted to upgrade the Python version to 3.3, but I am having some problems doing it.

Whenever I run this command,

sudo apt-get install build-essential

I get the following errors:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package build-essential

Can anyone tell me what is happening?

  • Maybe there are some package sources missing... Can you post the content of your /etc/apt/sources.list? – chaos Oct 16 '13 at 5:46
  • By the way, it's 'Ubuntu 12.04' (not Linux). Ubuntu is not the only distribution of Linux and Linux does not necessarily mean 'Ubuntu'. Linux is merely the underlying kernel from which Ubuntu uses. – kiri Oct 16 '13 at 6:15
  • @chaos it say's no such file or directory found – Deiknymi Oct 16 '13 at 7:56

Try sudo apt-get update first. Make sure you have an internet connection.

| improve this answer | |
  • nope didn't worked instead got following errors >E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists/ – Deiknymi Oct 16 '13 at 7:53
  • Are you sure you have root privileges? You need to be root or issue sudo and get the password right (it's the password you use to login). – Alex Oct 16 '13 at 16:51
  • yeas it asks for password and i provide it – Deiknymi Oct 17 '13 at 1:55

You accidentally deleted your sources.list. To regenerate this file go to this website and choose the country and your os release. check all Ununtu Banches and Ubuntu Updates and if you want Ubuntu Partner Repos and Ubuntu Extras Repos and then generate the new file.

Now you have to copy the content into your /etc/apt/sources.list, create the file if its not existing yet, and then run:

sudo apt-get update
sudo apt-get upgrade

Your system should be up-to-date again now. And you should now be able to run your installation again:

sudo apt-get install build-essential
| improve this answer | |
  • can you tell me how to create those directory and where – Deiknymi Oct 16 '13 at 8:32
  • Create folder if not exist: sudo mkdir -p /etc/apt open the file with editor sudo nano /etc/apt/sources.list copy the contents type "Ctrl-o" to save "enter" and "Ctrl-x" to exit. – chaos Oct 16 '13 at 8:43
  • still not working now it say's Unable to lock directory /var/lib/apt/lists/ – Deiknymi Oct 17 '13 at 2:05
  • Then you have to delete the lock files sudo rm /var/lib/apt/lists/lock and sudo rm /var/cache/apt/archives/lock first. – chaos Oct 17 '13 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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