0

Say I've got a Python package called foo-py, which is dependent on lxml.

I downloaded foo-py from PyPI and I want to install foo-py to C:\Users\Me\SomePythonProgram\Modules without pip attempting to resolve the lxml dependency via PyPI. Again, just to be clear, I want to do this without pip contacting the outside world. Both foo-py and its dependencies exist locally.

I am not using a virtual environment.

How do I accomplish this? Is this possible?

Things I've tried: On Git Bash for Windows, I have tried using pip -t [target] -e [source] --find-links=file://[target] to no avail. pip's options are somewhat nebulous and routinely result in pip dialing out to PyPI. I have also tried python setup.py install, which erroneously throws some error about how the target directory isn't in the $PYTHONPATH, even when the $PYTHONPATH to [target] is explicitly exported. This approach also attempts to create a /lib/python directory in [target], which is undesirable and bewildering, as everything other package in the ~/Modules directory has a flat directory structure.

Edit: I could ignore the dependencies, but I want to be sure that pip is making sure that foo-py's dependencies are satisfied.

Edit 2: There is no requirements.txt file.

alex
  • 6,818
  • 9
  • 52
  • 103
  • Possible duplicate of [python pip: force install ignoring dependencies](https://stackoverflow.com/questions/12759761/python-pip-force-install-ignoring-dependencies) – MegaIng May 29 '18 at 18:56
  • @MegaIng Do I *have to* ignore the dependencies in this case? Is there an approach where I can get pip to acknowledge that they exist in the target directory? – alex May 29 '18 at 18:57
  • Yes. Or you can move the files manually, if they are pure python. But If you want to do something like this, you are probably did something wrong earlier. On a normal system, you shouldn't have to care about dependencies. – MegaIng May 29 '18 at 19:00
  • @MegaIng If pip cannot be used to ensure that dependencies are already satisfied when a `-target` is specified, I would like an approach that performs this check. – alex May 29 '18 at 19:10
  • 2
    Possible duplicate of [How to install packages using pip according to the requirements.txt file from a local directory?](https://stackoverflow.com/questions/7225900/how-to-install-packages-using-pip-according-to-the-requirements-txt-file-from-a) – phd May 29 '18 at 19:19
  • @phd In reality, the package foo-py does not contain a `requirements.txt` file. pip is discovering these dependencies without it - I'm not sure of the actual mechanism. – alex May 29 '18 at 19:57
  • @alex then just use the package name (strictly speaking, a requirement specifier) instead of `-r requirements.txt`. – ivan_pozdeev May 29 '18 at 20:03
  • @alex The main options there is not `-r requirements.txt` but `--no-index --find-links`. – phd May 29 '18 at 20:26

0 Answers0