简体   繁体   English

从自定义索引setup.py安装

[英]Installing from custom index setup.py

I am the package maintainer of a package that has dependencies to packages hosted in our own pip repository. 我有依赖于我们自己的点子库主办包一包的包维护者。

I want these packages to also be installed when doing pip install mypackage . 我希望在进行pip install mypackage时也要安装这些软件包。

setup(
  name='mypackage',
  version='1.1.2',
  description='My awesome package',
  dependency_links=[
    'http://www.myrepo.se/packages/mydep1/',
    'http://www.myrepo.se/packages/mydep2/'
  ]
  install_requires=[
    'mydep1==1.0.0',
    'mydep2==5.6.7'
  ]
)

The folder structure in the repo is the following: 在回购的文件夹结构如下:

packages/
  mydep1/
    mydep1-1.0.0.tar.gz
  mydep2/
    mydep2-5.5.1.tar.gz
    mydep2-5.6.7.tar.gz

All according to the accepted answer on this question Using an extra python package index url with setup.py 所有根据关于这个问题的答案接受使用通过setup.py额外的Python包索引网址

However, this does not work. 但是,这不起作用。 I get the error: 我得到错误:

Collecting mydep1 (from mypackage==1.1.2)
  Could not find a version that satisfies the requirement mydep1 (from mypackage==1.1.2) (from versions: )
No matching distribution found for mydep1 (from mypackage==1.1.2)

When I have added an extra index url to my requirements.txt before doing it this was I had to add the url as a trusted host. 当我做这件事之前增加了一个额外的索引链接到我的requirements.txt这是我不得不将URL添加为受信任主机。 Is that relevant? 有关系吗? Also I am using python 3.5.3 另外我使用Python 3.5.3

EDIT: I activated verbose output from pip and it is not even trying to find the package from my repo. 编辑:我激活了详细的输出从点子,它甚至没有试图找到我的回购包。

1 location(s) to search for versions of mydep1:
  * https://pypi.python.org/simple/mydep1/
  Getting page https://pypi.python.org/simple/mydep1/
  ...

It seems pip is not processing the dependency links unless you explicitly tell it to (which unfortunately means that all consumers of mypackage must know to do so). 除非您明确告知pip否则pip似乎不会处理依赖项链接(不幸的是,这意味着mypackage的所有使用者都必须知道这样做)。

pip install --process-dependency-links mypackage

Since mypackage is also hosted by the same repository it means that a consumers requirements.txt must look like 由于mypackage也由同一存储库托管,这意味着使用者的requirements.txt必须看起来像

--trusted-host http://www.myrepo.se/
--extra-index-url http://www.myrepo.se/packages
--process-dependency-links

mypackage==1.1.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM