【发布时间】:2013-03-30 01:28:41
【问题描述】:
我正在尝试解决的情况是从 bitbucket 上的私有存储库安装一个包,该包依赖于 bitbucket 中的另一个私有存储库。
我用它来开始安装:
pip install -e git+https://bitbucket.org/myuser/project-one.git/master#egg=django_one
然后尝试从 setup.py 下载它的依赖项,如下所示:
install_requires = ['project-two',],
dependency_links = ['git+https://bitbucket.org/myuser/project-two.git/master#egg=project_two'],
这失败了,pip 日志看起来像:
Downloading/unpacking project-two (from project-one)
Getting page https://pypi.python.org/simple/project-two/
Could not fetch URL https://pypi.python.org/simple/project-two/: HTTP Error 404: Not Found (project-two does not have any releases)
Will skip URL https://pypi.python.org/simple/project-two/ when looking for download links for project-two (from project-one)
Getting page https://pypi.python.org/simple/
URLs to search for versions for project-two (from project-one):
* https://pypi.python.org/simple/project-two/
* git+https://bitbucket.org/myuser/project-two.git/master#egg=project-two
Getting page https://pypi.python.org/simple/project-two/
Cannot look at git URL git+https://bitbucket.org/myuser/project-two.git/master#egg=project-two
Could not fetch URL https://pypi.python.org/simple/project-two/: HTTP Error 404: Not Found (project-two does not have any releases)
Will skip URL https://pypi.python.org/simple/project-two/ when looking for download links for project-two (from project-one)
Skipping link git+https://bitbucket.org/myuser/project-two.git/master#egg=project-two; wrong project name (not project-two)
Could not find any downloads that satisfy the requirement project-two (from project-one)
这个设置的奇怪之处在于,如果我克隆一个 project-one 并运行
python setup install
从那里,项目二从 bitbucket 中获取并安装到我的 virtualenv 中。我的理解是 pip 在后台使用设置工具,所以我的假设是该测试的成功验证了我的方法。
任何建议表示赞赏。
跟进:
所以接受的答案是完全正确的 - 但我的问题是作为私人回购(https + http auth-basic)的额外复杂性。使用语法
dependency_links=["http://user:password@bitbucket.org/myuser/..."]
仍然导致 401。运行一个 shell 并使用 pip.download.py 运行 urlopen 说明了根本问题(即 pip 需要在 urllib2 中进行额外设置才能使其正常工作)。
here 提到了这个问题,但我无法让它工作。
【问题讨论】:
-
你确定bitbubket上的repo是git repo吗? bitbucket 也支持 mecurial。
-
@markdsievers 你找到解决方案了吗?我也在找!
-
Assembla 在这种情况下存在 pip 升级问题,不确定是否直接相关,但这个问题和答案确实对我有帮助。
标签: python dependencies pip setuptools