Repository navigation
Trouble with git link dependency rooted in subfolder #4380
Copy link
Copy link
Closed
Description
My goal is to add this forked library as a dependency to my project. Previously with pip I was able to install the library via
pip install "git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
Essentially I would like to do the same with poetry. #1221 added a feature to add git links as dependencies so I did try the following:
poetry add -vvv git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI
But this didn't work and resulted in the following stack trace.
✦ ➜ Using virtualenv: /home/ashwin/anaconda3/envs/coco
Stack trace:
11 ~/anaconda3/envs/coco/lib/python3.7/site-packages/clikit/console_application.py:131 in run
129│ parsed_args = resolved_command.args
130│
→ 131│ status_code = command.handle(parsed_args, io)
132│ except KeyboardInterrupt:
133│ status_code = 1
10 ~/anaconda3/envs/coco/lib/python3.7/site-packages/clikit/api/command/command.py:120 in handle
118│ def handle(self, args, io): # type: (Args, IO) -> int
119│ try:
→ 120│ status_code = self._do_handle(args, io)
121│ except KeyboardInterrupt:
122│ if io.is_debug():
9 ~/anaconda3/envs/coco/lib/python3.7/site-packages/clikit/api/command/command.py:171 in _do_handle
169│ handler_method = self._config.handler_method
170│
→ 171│ return getattr(handler, handler_method)(args, io, self)
172│
173│ def __repr__(self): # type: () -> str
8 ~/anaconda3/envs/coco/lib/python3.7/site-packages/cleo/commands/command.py:92 in wrap_handle
90│ self._command = command
91│
→ 92│ return self.handle()
93│
94│ def handle(self): # type: () -> Optional[int]
7 ~/anaconda3/envs/coco/lib/python3.7/site-packages/poetry/console/commands/add.py:109 in handle
107│ packages,
108│ allow_prereleases=self.option("allow-prereleases"),
→ 109│ source=self.option("source"),
110│ )
111│
6 ~/anaconda3/envs/coco/lib/python3.7/site-packages/poetry/console/commands/init.py:320 in _determine_requirements
318│ return requires
319│
→ 320│ requires = self._parse_requirements(requires)
321│ result = []
322│ for requirement in requires:
5 ~/anaconda3/envs/coco/lib/python3.7/site-packages/poetry/console/commands/init.py:411 in _parse_requirements
409│
410│ package = Provider.get_package_from_vcs(
→ 411│ "git", url.url, rev=pair.get("rev")
412│ )
413│ pair["name"] = package.name
4 ~/anaconda3/envs/coco/lib/python3.7/site-packages/poetry/puzzle/provider.py:196 in get_package_from_vcs
194│ reference = branch or tag or rev
195│ if reference is not None:
→ 196│ git.checkout(reference, tmp_dir)
197│ else:
198│ reference = "HEAD"
3 ~/anaconda3/envs/coco/lib/python3.7/site-packages/poetry/core/vcs/git.py:229 in checkout
227│ args += ["checkout", rev]
228│
→ 229│ return self.run(*args)
230│
231│ def rev_parse(self, rev, folder=None): # type: (str, Optional[Path]) -> str
2 ~/anaconda3/envs/coco/lib/python3.7/site-packages/poetry/core/vcs/git.py:302 in run
300│
301│ return decode(
→ 302│ subprocess.check_output(["git"] + list(args), stderr=subprocess.STDOUT)
303│ ).strip()
304│
1 ~/anaconda3/envs/coco/lib/python3.7/subprocess.py:411 in check_output
409│
410│ return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
→ 411│ **kwargs).stdout
412│
413│
CalledProcessError
Command '['git', '--git-dir', '/tmp/pypoetry-git-cocoapi3d1g76i/.git', '--work-tree', '/tmp/pypoetry-git-cocoapi3d1g76i', 'checkout', 'egg=pycocotools']' returned non-zero exit status 1.
at ~/anaconda3/envs/coco/lib/python3.7/site-packages/poetry/utils/_compat.py:218 in run
214│ raise
215│ retcode = process.poll()
216│ if check and retcode:
217│ raise CalledProcessError(
→ 218│ retcode, process.args, output=stdout, stderr=stderr
219│ )
220│ finally:
221│ # None because our context manager __exit__ does not use them.
222│ process.__exit__(None, None, None)
^C^C
[1]+ Exit 1 poetry add -vvv git+https://github.com/ashnair1/cocoapi.git#egg=pycocotools
So how can I add the library as a project dependency?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
finswimmer commentedon Aug 27, 2021
Hello @ashnair1 ,
what you try is to install a package from a subfolder within a git repository. This is not supported at the moment by poetry. Some links you can follow:
fin swimmer
[-]Trouble with git link dependency[/-][+]Trouble with git link dependency rooted in subfolder[/+]github-actions commentedon Mar 2, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.