Search code examples
pythonpip

use a relative path in requirements.txt to install a tar.gz file with pip


We're using a requirements.txt file to store all the external modules needed. Every module but one is gathered from internet. The other one is stored on a folder under the one holding the requirements.txt file.

BTW, this module can be easily installed with pip install

I've tried using this:

file:folder/module

or this:

file:./folder/module

or even this:

folder/module

but always throws me an error. Does anyone know which is the right way to do this?

Thanks


Solution

  • The following line in requirements.txt:

    ./foo/bar/mymodule
    

    works when there is a setup.py at the top level of the mymodule directory. This path is not relative to the requirements.txt file, but rather to the current working directory. Therefore it is necessary to navigate into the same directory as the requirements.txt and then run the command:

    pip install -r requirements.txt