9

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!!!!!

M.Tarun
  • 5,001
  • 6
  • 33
  • 64
swati
  • 91

4 Answers4

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

M.Tarun
  • 5,001
  • 6
  • 33
  • 64
  • 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: https://askubuntu.com/a/1052682/519931 – Pedro Gordo Sep 23 '18 at 11:11
2

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>
Timo
  • 4,680
  • 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: http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install – Javier Rivera Sep 27 '13 at 06:39
1

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

zwets
  • 12,354
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>
Avin Mathew
  • 103
  • 5