无法使用 pipenv 安装频道 (django)

Unable to install channels (django) using pipenv

当我尝试安装时 django channels using pipenv, it fails, purportedly because it cannot find "zope-interface" version 4.5.0 in https://pypi.python.org/simple

$ pipenv install channels
Installing channels…
Looking in indexes: https://pypi.python.org/simple
Collecting channels
  Using cached https://files.pythonhosted.org/packages/e3/ea/65e947afe102b1b5798f6890479426e8f481df0ec7a4cbba21bdd2897ef9/channels-2.1.3-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: Django>=1.11 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from channels) (2.1.2)
Requirement already satisfied, skipping upgrade: asgiref~=2.3 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from channels) (2.3.2)
Requirement already satisfied, skipping upgrade: daphne~=2.2 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from channels) (2.2.2)
Requirement already satisfied, skipping upgrade: pytz in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from Django>=1.11->channels) (2018.5)
Requirement already satisfied, skipping upgrade: async-timeout<4.0,>=2.0 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from asgiref~=2.3->channels) (3.0.1)
Requirement already satisfied, skipping upgrade: autobahn>=0.18 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from daphne~=2.2->channels) (18.9.2)
Requirement already satisfied, skipping upgrade: twisted>=18.7 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from daphne~=2.2->channels) (18.7.0)
Requirement already satisfied, skipping upgrade: txaio>=18.8.1 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from autobahn>=0.18->daphne~=2.2->channels) (18.8.1)
Requirement already satisfied, skipping upgrade: six>=1.11.0 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from autobahn>=0.18->daphne~=2.2->channels) (1.11.0)
Requirement already satisfied, skipping upgrade: PyHamcrest>=1.9.0 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (1.9.0)
Requirement already satisfied, skipping upgrade: zope.interface>=4.4.2 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (4.5.0)
Requirement already satisfied, skipping upgrade: hyperlink>=17.1.1 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (18.0.0)
Requirement already satisfied, skipping upgrade: attrs>=17.4.0 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (18.2.0)
Requirement already satisfied, skipping upgrade: incremental>=16.10.1 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (17.5.0)
Requirement already satisfied, skipping upgrade: Automat>=0.3.0 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (0.7.0)
Requirement already satisfied, skipping upgrade: constantly>=15.1 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (15.1.0)
Requirement already satisfied, skipping upgrade: setuptools in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from PyHamcrest>=1.9.0->twisted>=18.7->daphne~=2.2->channels) (40.4.3)
Requirement already satisfied, skipping upgrade: idna>=2.5 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from hyperlink>=17.1.1->twisted>=18.7->daphne~=2.2->channels) (2.7)
Installing collected packages: channels
Successfully installed channels-2.1.3

Adding channels to Pipfile's [packages]…
Pipfile.lock (bd0b0a) out of date, updating to (7cafae)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (bd0b0a)!
Installing dependencies from Pipfile.lock (bd0b0a)…
     ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 27/27 — 00:00:02
An error occurred while installing zope-interface==4.5.0 --hash=sha256:21506674d30c009271fe68a242d330c83b1b9d76d62d03d87e1e9528c61beea6 --hash=sha256:3d184aff0756c44fff7de69eb4cd5b5311b6f452d4de28cb08343b3f21993763 --hash=sha256:467d364b24cb398f76ad5e90398d71b9325eb4232be9e8a50d6a3b3c7a1c8789 --hash=sha256:57c38470d9f57e37afb460c399eb254e7193ac7fb8042bd09bdc001981a9c74c --hash=sha256:9ada83f4384bbb12dedc152bcdd46a3ac9f5f7720d43ac3ce3e8e8b91d733c10 --hash=sha256:a1daf9c5120f3cc6f2b5fef8e1d2a3fb7bbbb20ed4bfdc25bc8364bc62dcf54b --hash=sha256:e6b77ae84f2b8502d99a7855fa33334a1eb6159de45626905cb3e454c023f339 --hash=sha256:e881ef610ff48aece2f4ee2af03d2db1a146dc7c705561bd6089b2356f61641f --hash=sha256:f41037260deaacb875db250021fe883bf536bf6414a4fd25b25059b02e31b120! Will try again.
Installing initially failed dependencies…
Looking in indexes: https://pypi.python.org/simple00
Collecting zope-interface==4.5.0 

  Could not find a version that satisfies the requirement zope-interface==4.5.0 (from -r /tmp/pipenv-yh0ggj8v-requirements/pipenv-t7csyjxt-requirement.txt (line 1)) (from versions: 4.4.0, 4.4.1, 4.4.2, 4.4.3)
No matching distribution found for zope-interface==4.5.0 (from -r /tmp/pipenv-yh0ggj8v-requirements/pipenv-t7csyjxt-requirement.txt (line 1))

  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/1 — 00:00:00

显然这不是我第一次尝试的结果,因为大部分要求都已经满足了。一个特别值得注意的是已经满足的要求列表中的第 11 个:

Requirement already satisfied, skipping upgrade: zope.interface>=4.4.2 in /home/dan/.local/share/virtualenvs/gmtools-QMaEj5K6/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels) (4.5.0)

那么如果zope.interface4.5.0已经安装了,为什么找不到呢?是因为 zope-interfacezope.interface 是不同的东西吗?如果错误消息的实际内容没有以 (from versions: 4.4.0, 4.4.1, 4.4.2, 4.4.3) 结尾,我就不会那么困惑了——这些是 zope.interface 的 4.5.0 之前的版本,所以 zope-interface 是貌似是别名如果您转到安装显示它正在使用的索引 https://pypi.python.org/simple,您可以找到 zope.interface 但根本找不到 zope-interfacezope.interface 有一个版本 4.5.0。因此,如果它在一个不存在的名称下查找,它如何找到以前的版本?如果它是某种别名,为什么找不到 4.5.0?

我假设这是我的配置问题,但我不知道它是否与频道或 pipenv 有关。很高兴提供更多信息,但我不知道哪些信息会有帮助。

这个问题似乎已经自行解决了。我执行了以下步骤:

  1. $ pipenv run pip install channels
  2. 在您的 Pipfile 中手动添加一行,channels="*"
  3. $ pipenv lock

但我认为这并不能真正解决问题——现在如果我 运行...

$ pipenv uninstall channels
$ pipenv install channels

...它也工作得很好,这在以前是没有发生过的。也许 https://pypi.python.org/simple 的旧缓存版本存在某种问题?

使用pipenv版本2018.10.9,pip版本18.1,以及python3.6.6.