Pip install from git repository, errors due to wrong quotes

≯℡__Kan透↙ 提交于 2020-05-13 19:29:10

问题


Problem Description

Using Python 3.7.6 on Windows 10, I'm trying to upgrade a package installed directly from a git repository:

pip install --upgrade git+https://url.of.my/py/package.git

The installation then fails:

...
error: file 'C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs\bin\some-script' does not exist
...

As far as I've been able to work out, for the following reason: early on, pip calls

git clone -q https://url.of.my/py/package.git 'C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs'

i.e. it checks out the repository into a temporary directory. However, the directory isn't created and no sources are checked out. Indeed, when I run the command on the Windows command line (I've also tried Git Bash and MSYS2 Bash, same problem), I get an error:

C:\Users\myuser>git clone -q https://url.of.my/py/package.git 'C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs'
fatal: could not create leading directories of ''C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs'': Invalid argument

The problem are the single quotes around the path to the temporary directory. Changing them to double quotes makes the error disappear:

C:\Users\myuser>git clone -q https://url.of.my/py/package.git "C:\Users\myuser\AppData\Local\Temp\pip-req-build-ip4k0pfs"

Question

Is there any way to tell pip to use double instead of single quotes? Any other ideas for how to overcome this problem?

Edits

  1. In the meantime, I've also tried Python 3.8.2 with pip 20.1, and got the same error

回答1:


As @sinoroc suspected, the quotes — or rather, the fact that the logged git command doesn't work if directly executed — were a red herring, and the actual problem was that my setup.py had a typo: the scripts list included a file named bin/some-script, which was actually named bin/some-script.py, and thus couldn't be found.



来源:https://stackoverflow.com/questions/61511737/pip-install-from-git-repository-errors-due-to-wrong-quotes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!