Вопрос

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.

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top