Reputation: 736
Is there a way to reference local tar.gz files in 'install_requires' in the setup.py? I have a file at e.g. C:/mymodules/mydependency/mydependency.tar.gz. How should I include this in the setup file? I have tried:
setup(
name="mymodule",
version="1.0",
description="This is mymodule",
author="Me",
classifiers={
'Development status :: 5 - Production',
'Intended Audience :: My friends',
'Topic :: Research tools'
'Programming Language :: Python :: 3'
'Programming Language :: Python :: 3.5'
'Programming Language :: Python :: 3.6'
'Programming Language :: Python :: 3.7'
},
packages=find_packages(),
python_requires='>=3.5, <4',
install_requires=['mymodule @ C:/mymodules/mydependency/mydependency.tar.gz', # <----
dependency_links=dependency_links,
)
However, it states that the URL is invalid: "'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid URL given"
I have also tried including the path in dependency-links without resolving the problem.
I have search both stakcoverflow and the official documentation, but found no way around this.
Is it possible to include a localt tar.gz file as dependency? And in that case how should it be structured in the setup file.
Upvotes: 1
Views: 1158
Reputation: 22305
According to PEP 440, such direct references require a file://
prefix. In that case I believe it could look like the following:
'mymodule @ file:///C:/mymodules/mydependency/mydependency.tar.gz'
Note:
As far as I know, this notation is not supported by setuptools, in the sense that one can not use path/to/pythonX.Y setup.py install
or path/to/pythonX.Y setup.py develop
but should use pip (or probably any other modern installer) instead, for example like this:
path/to/pythonX.Y -m pip install path/to/project
path/to/pythonX.Y -m pip install --editable path/to/project
Upvotes: 2