I've a strange problem with co-existence of debian package and pip package. For example, I've python-requests (deb version 0.8.2) installed. Then when i install the requests (pip version 2.2.1), the system only apply the deb version instead of pip new version. Does anyone can resolve this problem? Thank you in advance.
1 Answers
In regard to installing python packages by system packages and pip, you have to define clear plan.
Personally, I follow these rules:
Install only minimal set of python packages by system installation packages
There I include supervisord
in case, I am not on too old system.
Do not install pip
or virtualenv
by system package.
Especially with pip in last year there were many situations, when system packages were far back behind what was really needed.
Use Virtualenv and prefer to install packages (by pip) in here
This will keep your system wide Python rather clean. It takes a moment to get used, but it is rather easy to follow, especially, if you use virtualenvwrapper
which helps a lot during development.
Prepare conditions for quick installation of compiled packages
Some packages require compilation and this often fails on missing dependencies.
Such packages include e.g. lxml
, pyzmq
, pyyaml
.
Make sure, which ones you are going to use, prepare packages in the system and you are able to install them into virtualenv.
Fine-tuning speed of installation of compiled packages
There is great package format (usable by pip) called wheel
. This allows to install a package (like lxml
) to install on the same platform within fraction of a second (compared to minutes of compilation). See my answer at SO on this topic

- 1
- 1

- 42,725
- 12
- 101
- 98
-
Actually, the problem happens when I include the ':/usr/lib/python2.7/dist-packages' in PYTHONPATH, when it is included, the system will invoke the debian package by default. – perigee May 14 '14 at 15:28
-
Thanks a lot. Still one question in virtualenv, if a package is installed as deb package, in virtualenv, it cannot be updated by pip system. Do you have some solutions for such situation? – perigee Jun 02 '14 at 15:04
-
@perigee I usually remove the deb package and install by pip. To keep it simple. – Jan Vlcinsky Jun 02 '14 at 17:28