8

i have to install Review board in ubuntu, i tried following commands but i am getting error

sudo apt-get install python-setuptools.


Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package python-setuptools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package python-setuptools has no installation candidate

Then i tried below command but for this also i am getting error message:

apt-get upgrade

E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

What should i do? Please help me out!!!!!

16

Open a terminal by pressing Ctrl+Alt+T and type the following:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-setuptools

Reasons behind the errors
Error1:

Package python-setuptools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package python-setuptools has no installation candidate 

This happens when you are trying to install a package about which APT does not have any idea. When you add software sources and then do an apt-get update your system APT's database is updated with all the packages on the repositories listed in software sources list.

Then when you try to install any package, apt checks the package name in it's database, finds it and checks the name of the repo from where it got it. It then downloads the package from that repo.
Error2:

  apt-get upgrade

    E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
    E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

This means that you are not the root user.So we use sudo to execute it as root

  • Even after typing the above commands i am getting same error message. E: Package python-setuptools has no installation candidate. After using sudo apt-get upgrade: testpc1@ubuntu:~$ sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. – swati Sep 26 '13 at 13:44
  • Which version of ubuntu are you using? – M.Tarun Sep 27 '13 at 12:11
  • This answer is no longer valid. easy_install has been removed from python-setuptools: askubuntu.com/a/1052682/519931 – Pedro Gordo Sep 23 '18 at 11:11
3

Please don't use easy_install, but try pip instead.

sudo apt-get install python-pip

Now you can use it in almost the same way as easy_install, but with better package management.

sudo pip install <pypi-package>
  • After running above command i am getting below error message: testpc1@ubuntu:~$ sudo apt-get install python-pip Reading package lists... Done Building dependency tree Reading state information... Done E: Couldn't find package python-pip – swati Sep 26 '13 at 13:47
  • Some reasons why you should use pip: stackoverflow.com/questions/3220404/… – Javier Rivera Sep 27 '13 at 6:39
1

The answer to your second issue (could not open lock file) you find here.

0

if you are using python3 virualenv for installing the desired package via easy_install, try installing python3-pip first by running

sudo apt install python3-pip

and then install the required package via

pip install <desired-package>

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.