简体   繁体   English

使用私有devpi服务器与pipenv

[英]Use private devpi server with pipenv

I can install my packages with pip , using a private, local devpi server. 我可以使用私有的本地devpi服务器使用pip安装我的软件包。 The corresponding configuration is: 相应的配置是:

[global]
index_url = http://mydevpi.mine/root/pypi/+simple/

[search]
index = http://mydevpi.mine/root/pypi/

[install]
trusted-host = mydevpi.mine

Installing then with pip is straightforward: 然后用pip安装很简单:

pip install -r requirements.txt

But doing the same with pipenv does not seem to work. 但是对pipenv做同样的pipenv似乎并不奏效。 This works, but is not using my local devpi : 这有效,但没有使用我的本地devpi

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

And this does not work: 这不起作用:

[[source]]

url = "http://devpi.dgv/root/pypi/+simple/"
verify_ssl = true
name = "pypi"

How can I tell pipenv to use another url for pypi ? 我如何告诉pipenv使用另一个url作为pypi

Examples provided assume default install of pypi server. 提供的示例假定pypi服务器的默认安装。

Method1: Pipfile 方法1:Pipfile

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[[source]]
url = "http://localhost:8080"
verify_ssl = false
name = "home"

[dev-packages]

[packages]
requests = {version="*", index="home"}
beautifulsoup4 = {version="*", index="home"}
pandas = "*"

Method2: Commandline 方法2:命令行

$ pipenv install --pypi-mirror http://localhost:8080

$ pipenv update --pypi-mirror http://localhost:8080

$ pipenv sync --pypi-mirror http://localhost:8080

$ pipenv lock --pypi-mirror http://localhost:8080

$ pipenv uninstall --pypi-mirror http://localhost:8080

Method3: Environment Variable 方法3:环境变量

export PIPENV_PYPI_MIRROR=http://localhost:8080

Pipenv Docs - Advanced Pipenv Docs - 高级

Maybe, I can clarify a bit as I encounter a similar problem. 也许,我可以澄清一点,因为我遇到了类似的问题。 There is no error message, but I see a lot of traffic to pypi.org (This traffic is unwanted) 没有错误消息,但我看到很多流量到pypi.org(此流量是不需要的)

I masked pypi.org in my hosts file and wanted to force the use of my devpi server, but then, pipenv install fails. 我在我的hosts文件中屏蔽了pypi.org并想强制使用我的devpi服务器,但是,pipenv安装失败了。

Current constraints:
  ipykernel

Finding the best candidates:

INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 10.56.0.120
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): wiki.pm1a.com
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F344518>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (2): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F344B00>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (3): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F33EB70>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (4): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F33E438>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (5): pypi.org
WARNING:pip9._vendor.requests.packages.urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip9._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002D74F33E208>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte',)': /simple/ipykernel/
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (6): pypi.org
Traceback (most recent call last):
  File "e:\python3\lib\site-packages\pipenv\vendor\pip9\_vendor\requests\packages\urllib3\connection.py", line 142, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "e:\python3\lib\site-packages\pipenv\vendor\pip9\_vendor\requests\packages\urllib3\util\connection.py", line 98, in create_connection
    raise err
  File "e:\python3\lib\site-packages\pipenv\vendor\pip9\_vendor\requests\packages\urllib3\util\connection.py", line 88, in create_connection
    sock.connect(sa)

I guess, it is closely related to the following issue on github: https://github.com/pypa/pipenv/issues/1783 我猜,它与github上的以下问题密切相关: https//github.com/pypa/pipenv/issues/1783

EDIT: It seems like running pipenv install --skip-lock solves the issue when running against devpi (or something similar) without having access to pypi.org. 编辑:似乎运行pipenv install --skip-lock解决了运行对devpi(或类似的东西)而无法访问pypi.org的问题。 This was at least the solution for me (with pipenv 11.10.0 and python 3.6.4) 这对我来说至少是解决方案(使用pipenv 11.10.0和python 3.6.4)

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

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