2

I am using some github django packages' bleeding edge version which have dependencies I do not want to install.

In dev, on my own computer, I can use pip install in command line and use the --no-dependencies flag. However, my test and production environments need a requirements file for deployment purposes. Unfortunately, the --no-dependencies flag cannot be used in a requirements file as explained here : https://pip.pypa.io/en/latest/reference/pip_install.html#requirements-file-format.

Is there any way to tell pip not to install dependencies when using a requirements file ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Q Caron
  • 952
  • 13
  • 26
  • 3
    A dependency means that the package author is saying that is required to use the package. I doubt most package managers would let you install packages in a broken way. Maybe it'll work for your use case, but the user might install your package and end up with a broken install of the other package. If the other package doesn't truly need those dependencies (i.e.: they are optional) you should contact the package maintainer and let them know to make them [extras](http://stackoverflow.com/questions/6237946/optional-dependencies-in-distutils-pip) instead. – Gareth Latty Apr 11 '15 at 12:51
  • 1
    So you want to install software, without installing the requisites required for the software to work? I advise not. – Peter Apr 11 '15 at 13:03
  • It looks like Pip is supposed to install packages in same order than they are listed in the requirements file, but "this is not a promise" (https://pip.pypa.io/en/latest/reference/pip_install.html#installation-order). In my particular case this did the job right, but that may not be an acceptable solutions for all... – Q Caron Apr 11 '15 at 13:04
  • @Peter: I am using a package which requires Django 1.6 but works just fine with Django 1.7. My project works well so far, so I decided to bypass this given requirement. – Q Caron Apr 11 '15 at 13:07
  • Well change the requirements file to have 1.7. – Peter Apr 11 '15 at 13:10
  • Thank you for your help on this. I do not know how to conclude here and how to close the topic since there is not a really satisfying answer. – Q Caron Apr 11 '15 at 14:32

1 Answers1

5

I work around this by using two requirements files, and calling pip twice.

pip install -r requirements.txt
pip install --no-deps -r no_deps.txt
Christian Long
  • 10,385
  • 6
  • 60
  • 58