question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry install fails when a git repository with an ssh URL

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

I’m getting the following error when executing poetry install:

[EnvCommandError]                                                                                                                                                                            
Command ['/home/omer/.cache/pypoetry/virtualenvs/bootsteps-py3.7/bin/python', '-m', 'pip', 'install', '-e', '/home/omer/Documents/Projects/bootsteps'] errored with the following return code 1, and out        
put:                                                                                                                                                                                                      
Obtaining file:///home/omer/Documents/Projects/bootsteps                                                                                                                                                  
    ERROR: Command errored out with exit status 1:                                                                                                                                                        
     command: /home/omer/.cache/pypoetry/virtualenvs/bootsteps-py3.7/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/omer/Documents/Projects/bootsteps/setup.py'"'"'; __file__                 
='"'"'/home/omer/Documents/Projects/bootsteps/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file_  
_, '"'"'exec'"'"'))' egg_info                                                                                                                                                                             
         cwd: /home/omer/Documents/Projects/bootsteps/                                                                                                                                                    
    Complete output (1 lines):                                                                                                                                                                            
    error in bootsteps setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid URL given                                   
    ----------------------------------------                                                                                                                                                              
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.     

There are no further details.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
smheidrichcommented, Aug 26, 2020

@sdispater I have the same issue. It’s only reproducible if you actually have a Python package folder (project_name/__init__.py) to go along with the pyproject.toml, otherwise the installation won’t complain. I put a boiled-down version of @thedrow’s pyproject.toml here. The only relevant line is

returns = { git = "git@github.com:dry-python/returns.git", branch = "master" }

Is that really the correct way to specify git dependencies accessible only via SSH, not HTTPS? Didn’t find anything on that in the docs, and putting something starting with e.g. ssh:// makes the subsequent git clone performed by poetry fail (cf. below). Would be good to have for dependencies between private repos, though.

Looking at the setup.py generated by poetry build, the issue seems to be that this is what poetry put for install_requires:

install_requires = \
['returns @ git+git@github.com:dry-python/returns.git@master']

So clearly it expected something starting with https:// in which case the git+ prefix would’ve made sense. So for this line to be correct, you would need to put ssh:// in front of the line in pyproject.toml, but, as I said above, then poetry’s own git clone fails with:

[CalledProcessError]
Command '['git', 'clone', u'ssh://git@github.com:dry-python/returns.git', '/tmp/pypoetry-git-returnsHlmB70']' returned non-zero exit status 128

IMHO it would be best if poetry understood ssh:// URLs and stripped the ssh:// before doing its own cloning.

2reactions
finswimmercommented, Aug 26, 2020

Hello @smheidrich,

the dependency is described correct. But you have to make sure you have the necessary ssh-key(s) on your pc. This is what I get when trying to clone the repository:

$ git clone git@github.com:dry-python/returns.git
Cloning into 'returns'...
ssh_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

And that’s the reason why a poetry install fails as well.

fin swimmer

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry add/install using ssh+git fails - Stack Overflow
I am trying to add depedency from git to poetry using SSH ( I am not interested in HTTPS version). The but I...
Read more >
Commands | Documentation | Poetry - Python dependency ...
The install command reads the pyproject.toml file from the current project, resolves the dependencies, and installs them. poetry install. If there is a...
Read more >
Poetry - The Blue Book
Poetry is a command line program that helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack...
Read more >
Installing Private Python Packages - Read the Docs
You need to create a personal access token with the repo scope. Check the GitHub documentation on how to create a personal token....
Read more >
PyPI packages in the Package Registry - GitLab Docs
The GitLab PyPI repository supports the following CLI commands: twine upload : Upload a package to the registry. pip install : Install a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found