9

I have following two repositories: one classic with setup.py, and second which looks like:

/repo /folder1 /folder2 /utils /setup.py

and in setup.py in first repo I want install utils from second repo. I tried following code:

install_requires=["repo"],
dependency_links=['git+ssh://git@bitbucket.aaaaaaa.aa:0000/project/repo@master#egg=repo&subdirectory=folder2']

but after python setup.py develop I have following error:

unknown url type: git+ssh -- Some packages may not be found!

kiui
  • 99
  • 2
  • Possible duplicate of [Get pip to work with git and github repository](https://stackoverflow.com/questions/14737500/get-pip-to-work-with-git-and-github-repository) – phd May 09 '18 at 16:47
  • 1
    can you try it with the `--process-dependency-links` option for pip? – patzm Sep 07 '18 at 14:19
  • also possible duplicate of [How to make setuptools clone git dependencies recursively?](https://stackoverflow.com/questions/32386794/how-to-make-setuptools-clone-git-dependencies-recursively) – patzm Sep 07 '18 at 15:03

2 Answers2

4

I had the same issue.

janfreyberg answer does not work anymore because of a change in pip: since 19.0, dependency_links are now obsolete.

Since pip 18.1, we can put these dependencies in install_requires using a syntax introduced by PEP 508.

Here is the solution in your case:

install_requires=[
    'repo @ git+ssh://git@bitbucket.aaaaaaa.aa:0000/project/repo@master#subdirectory=folder2'
]

setup(install_requires=install_requires)

Note that this requires using pip install . and doesn't work with python setup.py install.

If folder2 itself has dependencies, everything will be retrieved recursively.

Didier
  • 430
  • 6
  • 15
2

I found this works for me:

depndendcy_links=["git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI#egg=pycocotools-2.0"]

So, specify the subdirectory and version as #subdirectory=<sub_dir>#<packagename>-<version>

janfreyberg
  • 358
  • 2
  • 11