Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a fairly straightforward Ubuntu (13.04) desktop installation, which comes complete with several Ubuntu-packaged Python utilities -- these live in /usr/lib/python2.7 and are owned by root. I call these "system" Python packages.

I also do a lot of scientific work with Python and so I have installed tools like numpy, matplotlib, etc. using pip -- these live in /usr/local/lib/python2.7 and are owned by me (I chowned /usr/local because I'm the only user on this machine). I call these "local" Python packages. I put the local path in front of the system one in my PYTHONPATH so that I load local packages preferentially.

Now, I'm trying to upgrade one of the local packages that I installed using pip, and pip is failing because it wants to uninstall a dependent system package as part of the upgrade process.

I have two questions about this, addressing the problem from each end :

One way to fix this problem is to get pip to upgrade my local packages and ignore the system-installed ones (if possible). Can I prevent pip from trying to uninstall a system package during a local package upgrade, but only for one dependency ?

Another way would be to have pip install a newer version of the package, and then use that version to satisfy dependencies in apt related tools. Is there a way to tell Ubuntu that a pip-installed package will satisfy an apt dependency ?

(I am familiar with virtualenv, but on this machine I only ever use this one environment, so I'd really like to avoid keeping track of whether I'm working in the correct virtualenv.)

share|improve this question
Even if I'd only use one environment, I would still wrap it in a virtualenv. Your question is not completely clear to me. – don.joey Aug 16 '13 at 18:25
I figured that would be the first answer, so I updated my questions a bit ; hopefully it'll be clearer what I'm asking. – lmjohns3 Aug 16 '13 at 18:30
up vote 1 down vote accepted

If you do not want pip to install or uninstall any dependencies you can use

pip install --no-deps package_name

Be ware that you are in that case responsible for making sure the different dependencies needed for the package you install are satisfied.

To use it when upgrading a package use:

pip install -U --no-deps package_name

For a similar problem, cf. Drag forward installed Python packages when upgrading

share|improve this answer
I ended up using this in combination with a virtualenv. It ended up being simpler to have a way to completely separate my pip-installed packages from the system ones. – lmjohns3 Aug 21 '13 at 14:44
That is exactly the same setup I have. You can also look into virtualenvwrapper if you start using different venvs. – don.joey Aug 21 '13 at 14:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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