I'm trying to install pip
and virtualenv
on a server (running Ubuntu 12.04.4 LTS) on which I have access, but I can only do it with sudo apt-get install
(school politics). The problem is that althought I have run the sudo apt-get update
command to update the packages list, I think it keeps installing old ones. After doing sudo apt-get install python-pip python-virtualenv
, I do pip --version
on which I get the 1.0
, and virtualenv --version
on which I get 1.7.1.2
. These two version are quite old (pip
is already in 1.5.5
and virtualenv
in 1.11.5
). I read that the problem is that the packages list is not up-to-date, but the command sudo apt-get update
should solve this, but I guess no. How can I solve this? Thanks a lot!

- 1,132
- 3
- 15
- 32
-
This is not a programming question and probably belongs on http://www.superuser.com – armadadrive May 06 '14 at 14:55
-
@armadadrive: yes and no, he is asking about programming tools, so might keep this here as well. Anyway, answered, whether it gets migrated or not :) – favoretti May 06 '14 at 14:59
2 Answers
apt-get update
updates packages from Ubuntu package catalog, which has nothing to do with mainstream versions.
LTS
in Ubuntu stands for Long Term Support. Which means that after a certain period in time they will only release security-related bugfixes to the packages. In general, major version of packages will not change inside of a major Ubuntu release, to make sure backwards-compatibility is kept.
So if then only thing you can do is apt-get update
, you have 2 options:
- find a PPA that provides fresher versions of packages that you need, add it and repeat the update/install exercise
- find those packages elsewhere, download them in
.deb
format and install.

- 29,299
- 4
- 48
- 61
If you really need to use the latest stable versions of Python packages, then do not use apt-get
for installing Python packages and use pip instead. If you would use apt-get
and later install the same packages by means of pip
or (better not) easy_install
or setup.py
, you are likely to run into version conflicts wondering, why your python based commands are of unexpected versions, or even worse, why they do not work at all.
I try to follow this pattern:
1. system wide pip installation first
Using instructions from here: http://pip.readthedocs.org/en/latest/installing.html find get-pip.py
script, download it and run as python script.
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
$ rm get-pip.py
2. use pip to install virtualenv
system wide
this shall be as easy as:
$ sudo pip install virtualenv
3. (optional) install virtualenvwrapper - system wide or to user profile
$ sudo pip install virtualenvwrapper
and follow instructions for configuring it.
4. Since now, install inside your virtualenv environments
This shall prevent conflicts between various versions of packages.
You are free to update particular virtualenvs as you need one by one independently.
5. (optional) Configure installation cache directories for installation speed
There are method how to speed up repeated installation of packages, what comes handy if you get used using virtualenv often. For details see my answer: https://stackoverflow.com/a/18520729/346478

- 1
- 1

- 42,725
- 12
- 101
- 98
-
Not the answer I was looking for. I know very well pip, but as I said, I have only access to 'sudo apt-get' because it is an external server that doesn't belong to me. Thanks anyway! – tomasyany May 06 '14 at 21:32
-
@tomasyany assuming you have access to Python, you may install the stuff to the user profile. – Jan Vlcinsky May 06 '14 at 21:40
-
I have access to Python, but not to sudo python. Are you saying there's a way to install Python packages only in my user without having sudo? I am using virtual environments to be able to install packages in my on behalf. – tomasyany May 07 '14 at 07:23
-
@tomasyany Yes, you can install into your user profile by `$ pip install --user
` or `$ pip install --user -r requirements.txt`, no need to use `sudo` for that. But if you have reasonably new version of `virtualenv` you have most important stuff available. – Jan Vlcinsky May 07 '14 at 08:03