jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.15k stars 1.07k forks source link

Python dependency conflicts #636

Open snobear opened 10 years ago

snobear commented 10 years ago

Hola amigos, I'm running into an issue where some python rpms have conflicting dependencies. I'm packaging up the pyelasticsearch module as an rpm with:

fpm --rpm-use-file-permissions  -n python-ims-pyelasticsearch -s python -t rpm --rpm-auto-add-directories --python-bin python2.7 --python-pip /usr/local/python-2.7.3/bin/pip-2.7 pyelasticsearch

I have a custom build of python located in /usr/local/python-2.7.3, which I've also packaged with fpm and installed via yum. I had the requests python module was already installed in site-packages when I packaged /usr/local/python-2.7.3 up.

So when installing the pyelasticsearch rpm I created, yum complains with:

Transaction Check Error:
  file /usr/local/python-2.7.3/lib/python2.7/site-packages/requests/__init__.py from install of python-ims-pyelasticsearch-2.2.1-1.noarch conflicts with file from package python-ims-2.7.3-1.x86_64
  file /usr/local/python-2.7.3/lib/python2.7/site-packages/requests/packages/urllib3/__init__.py from install of python-ims-pyelasticsearch-2.2.1-1.noarch conflicts with file from package python-ims-2.7.3-1.x86_64
  file /usr/local/python-2.7.3/lib/python2.7/site-packages/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py from install of python-ims-pyelasticsearch-2.2.1-1.noarch conflicts with file from package python-ims-2.7.3-1.x86_64
  file /usr/local/python-2.7.3/lib/python2.7/site-packages/requests/__init__.pyc from install of python-ims-pyelasticsearch-2.2.1-1.noarch conflicts with file from package python-ims-2.7.3-1.x86_64
  file /usr/local/python-2.7.3/lib/python2.7/site-packages/requests/packages/__init__.pyc from install of python-ims-pyelasticsearch-2.2.1-1.noarch conflicts with file from package python-ims-2.7.3-1.x86_64
  file /usr/local/python-2.7.3/lib/python2.7/site-packages/requests/packages/urllib3/__init__.pyc from install of python-ims-pyelasticsearch-2.2.1-1.noarch conflicts with file from package python-ims-2.7.3-1.x86_64
...snip...

I tried specifying the fpm option --conflicts python-ims as well as --no-python-dependencies, but still the same result,

What's the best way to handle this situation? I know I could repackage my python build without the requests module in site-packages, but seems like I'm going to run into this issue again if I build and instlal two python packages that have the same dependency.

This is fpm 1.0.2 on CentOS 6.4 .

charliek commented 10 years ago

There is a blog post here that explains how one person uses fpm to package python using virtualenv:

https://hynek.me/articles/python-app-deployment-with-native-packages/

I've not done this my self, but it looks like virtualenv is what you want and this seems like it would work.

More interesting reading on this that does not relate directly to fpm, but does relate to packaging virtualenv can be found here:

http://labs.spotify.com/2013/10/10/packaging-in-your-packaging-dh-virtualenv/

borntyping commented 10 years ago

I approached a similar problem simply by building separate packages for dependencies - fpm made it very easy to build a package for each of them and require those.