0

I'm installing a local module that relies on a bunch of local modules written by others. This means that sometimes everyone's versioning is out-of-sync, so running pip -e [package] results in a bunch of errors when it comes to installing the dependencies that are other local modules. For example:

Module A relies on Module B. But Module B throws an syntax error when pip tries installing it.

For now, I'd like to tell pip to install every dependency it can install, and pipe all errors to a file or something.

  • Running each line in the module's requirements.txt won't work because I'm using pip install -e [module]. I do not want to change it or its setup.py
  • --ignore-installed only works if the dependency is already installed
  • --no-deps doesn't try to install dependencies at all

I'd specifically like pip to exit with something like: "Installed package with some errors: ..." (i.e., I'd like it to install all the dependencies it can install while ignoring the ones it can't)

AmagicalFishy
  • 1,249
  • 1
  • 12
  • 36
  • Module A should probably only rely on Module B version 0.0.1 *or later*. If you want to pin specific version numbers, leave that to each final application that will use modules A and B. – chepner Dec 12 '22 at 20:28
  • (When Module B finally changes too much to work with Module A, you can refine Module A's requirement to provide an upper bound until it can be updated to work with the newer B.) – chepner Dec 12 '22 at 20:31
  • @chepner That indeed would solve the example! I changed my example appropriately—it's not the specific problem I wanted to solve; I want to direct `pip` to only install the dependencies it can install w.o. throwing an error, and pipe other errors to a file. – AmagicalFishy Dec 12 '22 at 20:36
  • Where are you installing *from*? It sounds like you don't have separate releases for each version, only the latest version. – chepner Dec 12 '22 at 20:46
  • @chepner It depends on the package that's being installed—but, just to be clear, even if my environment is totally botched and everyone is coding everything in the incorrect way, the thing I specifically want is to ask `pip` to do what's in bold in my question :P – AmagicalFishy Dec 12 '22 at 20:56
  • `pip` can only install what is available to be installed. Are you installing from a source directory, which may only contain a specifically checked-out version of the code? It's possible to install directly from the repository, specifying a particular branch if desired (see https://stackoverflow.com/q/20101834/1126841, for example.) – chepner Dec 12 '22 at 21:03
  • @chepner Exactly! I want `pip` to install what is available to be installed (i.e., what it can install), and anything it *can't* install I want it to skip—and output the error to a file—and continue installing the things it can. I'm asking for a specific thing here! – AmagicalFishy Dec 12 '22 at 21:08
  • What good is it to leave unavailable requirements uninstalled? – chepner Dec 12 '22 at 21:13
  • @chepner One example might be if a module's dependency version changes, but that version throws an error and the module runs fine w/ what's already installed; maybe I want to fix that issue at a later time. Another might be if I'm attempting to install a module with a lot of dependencies and a few of them throw errors. I don't want to have to `pip install`, have it fail on an error, fix the error, run `pip install` again, etc. I'd rather just run it once, see all the errors, fix them, and run it again. – AmagicalFishy Dec 12 '22 at 21:24
  • That's why I mentioned putting an upperbound on the dependency, like `moduleB >=0.0.1,<0.06`. Then `pip install moduleB` would install the latest version of moduleB it can find that isn't 0.0.6 or later. – chepner Dec 12 '22 at 21:37
  • @chepner I understood why you mentioned it, and I appreciate the suggestion! I'm asking, though, for a very specific `pip` behavior. – AmagicalFishy Dec 12 '22 at 23:04

0 Answers0