Pipenv: 即使找到依赖项,也无法建立锁。

创建于 2017-10-18  ·  50评论  ·  资料来源: pypa/pipenv

确保检查现有问题,包括已打开和已关闭。

在此简要描述问题。

描述你的环境
  1. macOS Sierra
  2. 的Python 3.5.2
  3. pipenv,版本8.2.7
预期结果

我想用pipenv --three install dcos-shakedown安装震动。 它应该创建一个Pipfile和一个锁。

实际结果

我得到以下输出

CRITICAL:pip.index:Could not find a version that satisfies the requirement dcoscli==0.5.5 (from versions: 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.10, 0.4.11, 0.4.12, 0.4.13, 0.4.14)
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
No matching distribution found for dcoscli==0.5.5

这很奇怪,因为pipenv --three install dcoscli可以安装0.5.5并创建一个锁。 在PyPi上有

复制步骤

只需使用Python 3.5运行pipenv --three install --verbose dcos-shakedown

Discussion Possible Bug

所有50条评论

组合软件包可能仅适用于Python 3。 但是,我认为,如果Pipefile包含必需的Python版本,pipenv应该只为特定的Python版本创建锁定。

这是锁的详细输出

pipenv --three lock --verbose
Locking [dev-packages] dependencies…
Using pip: -i https://pypi.python.org/simple

                          ROUND 1
Current constraints:

Finding the best candidates:

Finding secondary dependencies:
------------------------------------------------------------
Result of round 1: stable, done
Locking [packages] dependencies…
Using pip: -i https://pypi.python.org/simple

                          ROUND 1
Current constraints:
  dcos-shakedown from git+https://github.com/dcos/shakedown.git#egg=dcos-shakedown

Finding the best candidates:
  found candidate -e git+https://github.com/dcos/shakedown.git#egg=dcos-shakedown (constraint was <any>)

Finding secondary dependencies:

New dependencies found in this round:
  adding [u'click', '', '[]']
  adding [u'dcos-shakedown', '', '[]']
  adding [u'dcoscli', '==0.5.5', '[]']
  adding [u'paramiko', '', '[]']
  adding [u'pytest', '', '[]']
  adding [u'pytest-timeout', '', '[]']
  adding [u'retrying', '', '[]']
  adding [u'scp', '', '[]']
Removed dependencies in this round:
Unsafe dependencies in this round:
------------------------------------------------------------
Result of round 1: not stable

                          ROUND 2
Current constraints:
  click
  dcos-shakedown from git+https://github.com/dcos/shakedown.git#egg=dcos-shakedown
  dcoscli==0.5.5
  paramiko
  pytest
  pytest-timeout
  retrying
  scp

Finding the best candidates:
  found candidate click==6.7 (constraint was <any>)
  found candidate -e git+https://github.com/dcos/shakedown.git#egg=dcos-shakedown (constraint was <any>)
  found candidate dcoscli==0.5.5 (constraint was ==0.5.5)
  found candidate paramiko==2.3.1 (constraint was <any>)
  found candidate pytest==3.2.3 (constraint was <any>)
  found candidate pytest-timeout==1.2.0 (constraint was <any>)
  found candidate retrying==1.3.3 (constraint was <any>)
  found candidate scp==0.10.2 (constraint was <any>)

Finding secondary dependencies:
  click==6.7                requires click==6.7
  scp==0.10.2 not in cache, need to check index
  scp==0.10.2               requires paramiko, scp==0.10.2
  pytest-timeout==1.2.0     requires pytest-timeout==1.2.0, pytest>=2.8.0
  dcoscli==0.5.5 not in cache, need to check index
CRITICAL:pip.index:Could not find a version that satisfies the requirement dcoscli==0.5.5 (from versions: 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.10, 0.4.11, 0.4.12, 0.4.13, 0.4.14)
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
No matching distribution found for dcoscli==0.5.5

这很奇怪。 当我用pipenv --three install dcoscli安装dcsocli时,我看到

Installing dcoscli…
Collecting dcoscli
  Using cached dcoscli-0.5.5-py3-none-any.whl
````

followed by

                      ROUND 1

当前限制:
来自git +的dcos-shakedown https://github.com/dcos/shakedown.git#egg = dcos-shakedown
dcoscli

寻找最佳人选:
找到了候选人-e git + https://github.com/dcos/shakedown.git#egg = dcos-shakedown(约束为
找到候选dcoscli == 0.4.14(约束为

查找次要依赖项:
dcoscli == 0.4.14要求dcos == 0.4.14,dcoscli == 0.4.14,docopt <1.0,> = 0.6,pkginfo == 1.2.1,toml <1.0,> = 0.9,virtualenv <16.0,> = 13.0
```

为什么要尝试安装0.4.14的dcoscli? 特别是当pipenv --three run dcos --version输出dcoscli.version=0.5.5

不是。 这是锁定过程。 它根据已知信息和缓存内容进行依赖项解析。 尝试pipenv锁定-清除

2017年10月18日上午6:16,Karsten Jeschkies [email protected]写道:

这很奇怪。 当我使用pipenv安装dcsocli时-三安装dcoscli我看到了

安装dcoscli…
收集dcoscli
使用缓存的dcoscli-0.5.5-py3-none-any.whl
其次是

                      ROUND 1

当前限制:
来自git +的dcos-shakedown https://github.com/dcos/shakedown.git#egg = dcos-shakedown
dcoscli

寻找最佳人选:
找到了候选人-e git + https://github.com/dcos/shakedown.git#egg = dcos-shakedown(约束为
找到候选dcoscli == 0.4.14(约束为

查找次要依赖项:
dcoscli == 0.4.14要求dcos == 0.4.14,dcoscli == 0.4.14,docopt <1.0,> = 0.6,pkginfo == 1.2.1,toml <1.0,> = 0.9,virtualenv <16.0,> = 13.0
为什么要尝试安装0.4.14的dcoscli? 特别是在pipenv-三运行dcos --version时输出dcoscli.version = 0.5.5。

-
您收到此消息是因为您已订阅此线程。
直接回复此电子邮件,在GitHub上查看,或使该线程静音。

您需要提供pipenv lock(详细和pipenv)的输出

2017年10月18日上午6:16,Karsten Jeschkies [email protected]写道:

这很奇怪。 当我使用pipenv安装dcsocli时-三安装dcoscli我看到了

安装dcoscli…
收集dcoscli
使用缓存的dcoscli-0.5.5-py3-none-any.whl
其次是

                      ROUND 1

当前限制:
来自git +的dcos-shakedown https://github.com/dcos/shakedown.git#egg = dcos-shakedown
dcoscli

寻找最佳人选:
找到了候选人-e git + https://github.com/dcos/shakedown.git#egg = dcos-shakedown(约束为
找到候选dcoscli == 0.4.14(约束为

查找次要依赖项:
dcoscli == 0.4.14要求dcos == 0.4.14,dcoscli == 0.4.14,docopt <1.0,> = 0.6,pkginfo == 1.2.1,toml <1.0,> = 0.9,virtualenv <16.0,> = 13.0
为什么要尝试安装0.4.14的dcoscli? 特别是在pipenv-三运行dcos --version时输出dcoscli.version = 0.5.5。

-
您收到此消息是因为您已订阅此线程。
直接回复此电子邮件,在GitHub上查看,或使该线程静音。

清除锁缓存无济于事。 这是pipenv --three lock --verbose的完整输出

› pipenv --three lock --verbose
Virtualenv already exists!
Removing existing virtualenv…
Warning: PYENV_ROOT is not set. New python paths will probably not be exported properly after installation.
Creating a virtualenv for this project…
Using /Users/kjeschkies/.pyenv/shims/python3 to create virtualenv…
⠋Running virtualenv with interpreter /Users/kjeschkies/.pyenv/shims/python3
Using base prefix '/Users/kjeschkies/.pyenv/versions/3.5.2'
New python executable in /Users/kjeschkies/.local/share/virtualenvs/marathon-ldTRsJsI/bin/python3
Also creating executable in /Users/kjeschkies/.local/share/virtualenvs/marathon-ldTRsJsI/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /Users/kjeschkies/.local/share/virtualenvs/marathon-ldTRsJsI
Locking [dev-packages] dependencies…
Using pip: -i https://pypi.python.org/simple

                          ROUND 1
Current constraints:

Finding the best candidates:

Finding secondary dependencies:
------------------------------------------------------------
Result of round 1: stable, done
Locking [packages] dependencies…
Using pip: -i https://pypi.python.org/simple

                          ROUND 1
Current constraints:
  dcos-shakedown

Finding the best candidates:
  found candidate dcos-shakedown==1.4.8 (constraint was <any>)

Finding secondary dependencies:
  dcos-shakedown==1.4.8     requires click, dcos-shakedown==1.4.8, dcoscli==0.5.5, paramiko, pytest, pytest-timeout, retrying, scp

New dependencies found in this round:
  adding [u'click', '', '[]']
  adding [u'dcos-shakedown', '==1.4.8', '[]']
  adding [u'dcoscli', '==0.5.5', '[]']
  adding [u'paramiko', '', '[]']
  adding [u'pytest', '', '[]']
  adding [u'pytest-timeout', '', '[]']
  adding [u'retrying', '', '[]']
  adding [u'scp', '', '[]']
Removed dependencies in this round:
Unsafe dependencies in this round:
------------------------------------------------------------
Result of round 1: not stable

                          ROUND 2
Current constraints:
  click
  dcos-shakedown==1.4.8
  dcoscli==0.5.5
  paramiko
  pytest
  pytest-timeout
  retrying
  scp

Finding the best candidates:
  found candidate click==6.7 (constraint was <any>)
  found candidate dcos-shakedown==1.4.8 (constraint was ==1.4.8)
  found candidate dcoscli==0.5.5 (constraint was ==0.5.5)
  found candidate paramiko==2.3.1 (constraint was <any>)
  found candidate pytest==3.2.3 (constraint was <any>)
  found candidate pytest-timeout==1.2.0 (constraint was <any>)
  found candidate retrying==1.3.3 (constraint was <any>)
  found candidate scp==0.10.2 (constraint was <any>)

Finding secondary dependencies:
  pytest-timeout==1.2.0 not in cache, need to check index
  pytest-timeout==1.2.0     requires pytest-timeout==1.2.0, pytest>=2.8.0
  paramiko==2.3.1           requires bcrypt>=3.1.3, cryptography>=1.5, paramiko==2.3.1, pyasn1>=0.1.7, pynacl>=1.0.1
  click==6.7 not in cache, need to check index
  click==6.7                requires click==6.7
  pytest==3.2.3             requires py>=1.4.33, pytest==3.2.3, setuptools
  dcos-shakedown==1.4.8     requires click, dcos-shakedown==1.4.8, dcoscli==0.5.5, paramiko, pytest, pytest-timeout, retrying, scp
  retrying==1.3.3           requires retrying==1.3.3, six>=1.7.0
  dcoscli==0.5.5 not in cache, need to check index
CRITICAL:pip.index:Could not find a version that satisfies the requirement dcoscli==0.5.5 (from versions: 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.10, 0.4.11, 0.4.12, 0.4.13, 0.4.14)
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
No matching distribution found for dcoscli==0.5.5

仅供参考,每当您通过-三,您就告诉Pipenv销毁您现有的virtualenv,不知道那是否是故意的,而仅是供您参考。 我将对此进行更多研究,但是由于您已经安装了pyenv,因此一目了然,您还应该根据错误消息设置环境变量PYENV_ROOT

@techalchemy ,谢谢。 我不知道--three每次都会创建一个新的env。 我认为这只会告诉pipenv仅使用Python3。我确实设置了PYENV_ROOT一次,但是随后pipenv使用Python 3.6而不是本地pyenv中定义的3.5创建了一个全称。

我仍然认为问题是pipenv尝试为Python 2创建一个关闭,并且崩溃不仅仅限于Python 3。

我对依赖关系解析行为的看法是:
实际上,这里似乎使用了Python 2或pip2可执行文件来进行依赖关系解析。
我觉得我最近看过类似的问题,但是还没来得及研究。

在这里的环境中猜测一下,我想说pipenv是全局安装的(可以),并且全局或根python是Python2。 @jeschkies您可以确认是否正确? 注意,我不是在谈论由pipenv创建的virtualenv的python版本,而是在谈论用于运行pipenv的python可执行文件。
我还注意到您似乎正在使用pyenv ,我不确定pipenv本身正在使用的python可执行文件是否有任何副作用。

我还不是pipenv确定自己使用哪个python / pip版本的专家(但),但是如果它只是盲目地选择了为其自身安装的环境的根python,那么我们知道为什么我们在这里得到python 2结果。

感谢@vphilippon的指针。 我已经删除了旧的pyenv版本,并安装了最新的Python 3.5.2。 然后,我在virtualenv外部将点更新为9.0.1。 我还修补了修订版本,以要求特定的Python版本并使用了git依赖项。 看
https://github.com/jeschkies/shakedown/blob/master/setup.py
https://github.com/mesosphere/marathon/blob/karsten/use-pipenv/Pipfile

我不知道锁如何工作,因为据我所知,它没有提到提交哈希。 此外,该锁还指出dcos cli版本为0.4.14,但是pipenv run dcos --version输出0.5.5。

总的来说,我不知道pipenv如何处理不同的Python版本,以及在这方面应该从pipenv期待什么。

嗯,该锁不适用于依赖项:

system in marathon/ on karsten/use-pipenv
› pipenv --rm
Removing virtualenv (/Users/kjeschkies/.local/share/virtualenvs/marathon-ldTRsJsI)…

system in marathon/ on karsten/use-pipenv
› pipenv install
Creating a virtualenv for this project…
Using /Users/kjeschkies/.pyenv/versions/3.5.2/bin/python3.5m to create virtualenv…
⠋Running virtualenv with interpreter /Users/kjeschkies/.pyenv/versions/3.5.2/bin/python3.5m
Using base prefix '/Users/kjeschkies/.pyenv/versions/3.5.2'
New python executable in /Users/kjeschkies/.local/share/virtualenvs/marathon-ldTRsJsI/bin/python3.5m
Also creating executable in /Users/kjeschkies/.local/share/virtualenvs/marathon-ldTRsJsI/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /Users/kjeschkies/.local/share/virtualenvs/marathon-ldTRsJsI
Installing dependencies from Pipfile.lock (0d5d00)…
Ignoring ipaddress: markers 'python_version < "3"' don't match your environment
Ignoring enum34: markers 'python_version < "3"' don't match your environment
Ignoring futures: markers 'python_version == "2.7"' don't match your environment
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 34/34 — 00:00:08
To activate this project's virtualenv, run the following:
 $ pipenv shell

system in marathon/ on karsten/use-pipenv
› pipenv run dcos --version
dcoscli.version=0.4.14
dcos.version=1.9.4
dcos.commit=f843772e2740889cc4bba263db44f1403e670037
dcos.bootstrap-id=79f6d6e1c406bffd3fab28b36815220575ae5995

因此,基本上使用pipenv install -e git+https://github.com/jeschkies/shakedown#egg=dcos-shakedown创建一个不够精确的Pipefile.lock。

好吧,您运行的命令只是重用了您已经存在的锁定文件,我相信如果您需要与使用案例的默认版本不同的版本,那么首先需要告知pipenv应该使用哪个版本的python。

看看这个,默认情况下,venv似乎使用Python 3.5.2,并以此评估标记。 这看起来像是向前迈出的一步。

@jeschkies我将删除Pipfile.lock并运行pipenv lock --clear进行Fersh锁定。 如果不再是root python问题,那就应该这样做。

我同意@vphilippon的观点,但是如果您还有其他问题,请问是否可以提供PipfilePipfile.lock以便我们进一步协助您进行故障排除

我确实没有Pipfile.lock重新开始,然后使用了锁定文件来重新创建环境。 我将再试一次报告。

好的。 我已经在一个干净的文件夹中复制了该问题。 您将在本要点的输出中看到所有命令。

这是我尝试做的事情和发生的事情:

  1. 使用pipenv --three -e git+https://github.com/jeschkies/shakedown.git#egg=dcos-shakedown为Python 3.5从git安装shdowndown
  2. dcos-cli,版本0.5.5的安装是一个重要的依赖项。 这是预期的。
  3. 使用pipenv --rm删除virtualenv。
  4. 使用pipenv --three install创建一个新的virtualenv。
  5. 已安装dcos-cli 0.4.14。 这是不期望的。

是的,但我仍然需要您提供pipfile.lock来帮助进行故障排除。 看到错误的版本信息后,是否还可以提供pipenv lock —verbose的输出

pipenv lock --verbose的输出和生成的Pipfile.lock

Pipfile.lock包括

"dcos": {
    "hashes": [
                "sha256:3d48d0773b5dd5e82ddb9cfa946f17755789e8c2ff53ecc75b32194b41248611"
            ],
    "version": "==0.4.14"
}

但是pipenv run dcos --version产生dcoscli.version=0.5.5

好了,给出的详细输出是连贯的,并且与Pipfile.lock的内容匹配。
但是,报告的安装版本(来自dcos --version )不匹配。

我尝试了这些步骤,但无法复制。 我得到:

"dcos": {
    "hashes": [
        "sha256:01d722e13296bd38c2b391ffbd5bc111fa7b5ec09bb058651713bce62a2d45a7"
    ],
    "version": "==0.5.5"
},
"dcos-shakedown": {
    "editable": true,
    "git": "https://github.com/jeschkies/shakedown.git",
    "ref": "012841a38a59d00043c15a66400501811715ab86"
},
"dcoscli": {
    "hashes": [
        "sha256:47b442a2823ab3b27cd520f5c3762ab0e630eca473a273e111619bd5c1a16ea6"
    ],
    "version": "==0.5.5"
},

并且,从pipenv run dcos --version

dcoscli.version=0.5.5
dcos.version=N/A
dcos.commit=N/A
dcos.bootstrap-id=N/A

第一次安装和从Pipfile.lock重新安装都可以。

@jeschkies在要点的命令中,我没有看到pipenv lock --clear (注意--clear )。 您是否按照我之前建议的那样运行它? 如果没有,请这样做,因为依存关系缓存可能仍然是一个问题。 (重做以确保100%的安全也没有害处。)

否则,如果我们100%确定清除了依赖项缓存,请提供pipenv run pip freeze的输出。

@vphilippon您在使用pyenv吗? 我怀疑这是这里的问题。 我无法使用以下命令锁定dcos-cli 0.5.5:

  • mkdir pipenv-test && cd pipenv-test
  • pyenv local 3.5.2
  • pipenv --three install -e git+https://github.com/jeschkies/shakedown.git#egg=dcos-shakedown

Pipfile.lock将具有0.4.14。 我在这里想念什么? Pipenv是从Python版本获取还是错误的dcos-cli软件包?

@jeschkies不,我没有使用pyenv 。 在确保这不是依赖项缓存问题之后,这是我要检查的下一件事。 我还想查看已安装软件包版本的完整列表,这就是为什么我要求输出pipenv run pip freeze

我们将需要有人尝试使用pyenv并尝试重现,尽管如果您现在所有的python环境都在Py 3+上,那也不应该成为导致计算Py 2依赖关系的问题。

我不相信pipenv会尊重本地pyenv设置,这可能会给您带来问题。 当我尝试仅运行pipenv install...我的系统尝试使用python 2.7。

将命令作为pipenv --python=3.5.2 install -e git+https://github.com/jeschkies/shakedown.git#egg=dcos-shakedown运行就可以了(这是将Python版本指定为pipenv的推荐方法,而不是希望它能在本地文件中拾取):

        "dcos": {
            "hashes": [
                "sha256:01d722e13296bd38c2b391ffbd5bc111fa7b5ec09bb058651713bce62a2d45a7"
            ],
            "version": "==0.5.5"
        },
        "dcos-shakedown": {
            "editable": true,
            "git": "https://github.com/jeschkies/shakedown.git",
            "ref": "012841a38a59d00043c15a66400501811715ab86"
        },
        "dcoscli": {
            "hashes": [
                "sha256:47b442a2823ab3b27cd520f5c3762ab0e630eca473a273e111619bd5c1a16ea6"
            ],
            "version": "==0.5.5"
        },

仅供参考,这是一个与pipenv如何解析pyenv python路径有关的问题,因为它不了解pyenv本地设置,因此与依赖项解析相比,它将使用自己的猜测在virtualenv中使用哪个python解释器。 这些最终会有所不同,因为一种将由pyenv垫片来解决,而另一种则不会。

@techalchemy这是pipenv或pyenv或两者中的错误吗???

是我运行pipenv --python=3.5.2 install -e git+https://github.com/jeschkies/shakedown.git#egg=dcos-shakedown之后的pipenv run pip freeze的输出。 这是Pipfile.lock的内容

       "dcos": {
            "hashes": [
                "sha256:3d48d0773b5dd5e82ddb9cfa946f17755789e8c2ff53ecc75b32194b41248611"
            ],
            "version": "==0.4.14"
        },
        "dcos-shakedown": {
            "editable": true,
            "git": "https://github.com/jeschkies/shakedown.git",
            "ref": "012841a38a59d00043c15a66400501811715ab86"
        },
        "dcoscli": {
            "hashes": [
                "sha256:1d7506df5e32fc96566169896fb42ba80aba4687d1c65eb2b52b320b5cfad0ca"
            ],
            "version": "==0.4.14"
        },

真奇怪即使使用pyenv global 3.5.2它也不起作用。

@jeschkies在上述@vphillipon上面尝试pipenv lock —clear ,因为您已明确告诉Pipenv使用3.5.2,并查看是否获得正确的分辨率

@erinxocon如果您认为pipenv通常应该尊重本地pyenv设置,pyenv local 3.5.2然后运行pipenv install我认为它可以正常工作。 但是, —three—two helper标志无论您使用pyenv配置了哪个版本,都分别在路径中搜索最新安装的版本。 因此,问题实际上是pipenv是否应该尊重您的pyenv选择(如果适用)。 这感觉就像是一个极端的情况,特别是当您不想使用最新版本时可以明确地使用它时。

@techalchemy甚至pipenv lock --clear都不起作用。 我认为这实际上只是pipenv忽略了我的pyenv配置,无论如何。 在macOS中,带有选项--three Pipenv对Python的搜索路径是什么?

@jeschkies它只是查看您的$ PATH变量以进行搜索。

@techalchemy我被撕毁了。 Kinda似乎是用户环境问题,超出了pipenv的范围。 但是,这最初是我们在使用pew进行virtualenv管理时的想法,由于外壳配置不正确,这导致了更多问题,因此尽管不是pipenv问题,我们还是进行了更改以避免出现问题。

@erinxocon hm,如果没有pyenv,您将如何使用不同的Python版本? 我应该只安装它们并将它们全部安装在$PATH吗? 这似乎是不对的。 我了解pipenv对此不应太精明。 但是,某些文档可能会在这里有所帮助。

@jeschkies普通的python放在路径上,如果您安装6个版本,则所有路径都在您的路径上。 Pyenv是一个辅助函数,但绝对不是必需的,并且pipenv不会读取配置文件。 除非您指定版本或特定的可执行文件,否则它只会在您的路径上查找“ python”所指向的内容。 Pyenv垫片有点混乱,我相信这就是为什么我们不使用它们。

--three--two只是在路径中查找python3或python2的路径。 截至目前,仅允许将python2命名为pythonpython3python3 。 您可以在路径中包含所有版本的python,仅使用更具体的语法即可解决它们。 python26python27python34

嗯好那么,还有另一种方法来管理与pipenv更好地工作的Python版本吗?

@jeschkies更好吗? 我个人将pyenv与PIPENV_DEFAULT_PYTHON_VERSION设置3.6.3 。 安装pyenv(或真正的任何设置)后,您只需传递—python=3.6.3—python=2.7.14 。 这就是猜测(即—three—two )—并不是很明确。 如果您想要特定的版本,则需要指定它

尝试安装Django==2.0b1时,我遇到了同样的问题。 它仅提供Python 3滚轮(与dcoscli )。

我已经通过Homebrew在全球范围内安装了Pipenv,并使用pyenv来管理我的Python版本。 我还在Pipfile中指定了python_full_version = "3.6.3" (以及prerelease选项)。

当我通过全局Pipenv运行pipenv install时,它会失败,但是如果我在Python 3版本中安装Pipenv(通过Pip),那么它将成功。 我猜这意味着Pipenv没有使用Pipfile中指定的版本来查找依赖版本? 在Python 2.7.10中使用pip install时,出现相同的错误。

我试过使用PIPENV_DEFAULT_PYTHON_VERSION环境变量,但这也不起作用。

嗨, @ jamieconnolly,我认为这可能与pyenv放置的垫片有关,以使多个环境可用。 由于我不使用pyenv,因此无法确定。

@jamieconnolly我猜它与我们在各个地方针对接触点所涉及的同一错误有关,正如您所提到的,该错误与依赖性解析技巧有关。 但是,有一个问题- pipenv install是否可以在前一种情况下成功安装指定的版本,但是在解决步骤上失败并建议您使用--skip-lock ? 还是首先无法安装?

@jamieconnolly ,感谢您的提示。 我将尝试通过本地pyenv配置的pip使用pipenv安装。

@techalchemy ,我应该更具体一些。 似乎pipenv生成Pipfile.lock时未从pyenv中获取正确的Python版本。 就像你说的

因此,问题实际上是pipenv是否应该尊重您的pyenv选择(如果适用)。

由于答案不一定是肯定的,所以我想知道如何管理不同的Python版本,以便pipenv在生成锁定文件时选择正确的版本。

我也会尝试--python=3.6.3

@jeschkies我的意思是不尊重您用pyenv shellpyenv local任何值。 它应该尊重您路径上的python,并且如果pyenv配置正确,则可能会尊重pyenv global因为这就是python shim的解析方式(如果您未指定版本, )

好的,但是我想知道为什么在生成锁定文件时找不到pyenv local Python版本。 这可能是pyenv的配置,也可能是pipenv的问题。 我不确定这是配置,因为pipenv可以毫无问题地安装正确的软件包,并且pipenv shell python --version的Python版本也正确。 那么,为什么pipenv lock没有选择正确的版本呢?

@jeschkies,因为如果您未指定版本,则pipenv runpipenv shell将默认为系统python(如果您将pyenv local设置为您设置的值,则pyenv将通过垫片进行解析)。 使用pip-tools解析器进行解析,并且永远不会直接调用python,因此pyenv垫片实际上会绕过版本解析,而pipenv只会浏览PATHPYENV_ROOT所有可用的python。 因此,这就是为什么pyenv local对锁文件没有任何影响。

@techalchemy ,啊,好吧,我想我现在已经意识到其中的区别。 所以pipenv installpipenv shell确实直接调用Python,这就是为什么我在那里使用正确的版本吗?

@jeschkies基本上是正确的,尽管我认为pipenv shell将取决于您是否在Windows上使用PIPENV_SHELL_FANCY环境变量/

我看到与Django==2.0rc1相同的问题。 除了@jamieconnolly所说的以外,真的没什么可添加的,但是如果您愿意的话,这里有一些数据:

点文件
名称= Pipfile
[[来源]]
url =“ https://pypi.python.org/simple
verify_ssl = true
名称=“ pypi”

[开发包]

[包装]

“ psycopg2” =“ *”
django =“ == 2.0rc1”

[pipenv]
allow_prereleases = true


➜metada git :(主)✗pip3冻结
证书== 2017.11.5
chardet == 3.0.4
的Django = = 2.0rc1
flake8 == 3.5.0
idna == 2.6
mccabe == 0.6.1
座位== 1.1.0
pycodestyle == 2.3.1
pyflakes == 1.6.0
pytz == 2017.3
要求== 2.18.4
urllib3 == 1.22
virtualenv == 15.1.0
virtualenv-clone == 0.2.6


When I try to lock, even with `--pre`, I get this:

➜metada git:(master)✗pipenv锁定--pre
锁定[dev-packages]依赖项…
锁定[packages]依赖项...
关键:pip.index :找不到满足django == 2.0rc1要求的版本(来自1.1.3、1.1.4、1.2、1.2.1、1.2.2、1.2.3、1.2.4, 1.2.5、1.2.6、1.2.7、1.3、1.3.1、1.3.2、1.3.3、1.3.4、1.3.5、1.3.6、1.3.7、1.4、1.4.1、1.4。 2,1.4.3,1.4.4,1.4.5,1.4.6,1.4.7,1.4.8,1.4.9,1.4.10,1.4.11,1.4.12,1.4.13,1.4.14, 1.4.15、1.4.16、1.4.17、1.4.18、1.4.19、1.4.20、1.4.21、1.4.22、1.5、1.5.1、1.5.2、1.5.3、1.5.4, 1.5.5、1.5.6、1.5.7、1.5.8、1.5.9、1.5.10、1.5.11、1.5.12、1.6、1.6.1、1.6.2、1.6.3、1.6.4, 1.6.5、1.6.6、1.6.7、1.6.8、1.6.9、1.6.10、1.6.11、1.7、1.7.1、1.7.2、1.7.3、1.7.4、1.7.5, 1.7.6、1.7.7、1.7.8、1.7.9、1.7.10、1.7.11、1.8a1、1.8b1、1.8b2、1.8rc1、1.8、1.8.1、1.8.2、1.8.3, 1.8.4、1.8.5、1.8.6、1.8.7、1.8.8、1.8.9、1.8.10、1.8.11、1.8.12、1.8.13、1.8.14、1.8.15、1.8。 16,1.8.17,1.8.18,1.9a1,1.9b1,1.9rc1,1.9rc2,1.9,1.9.1,1.9.2,1.9.3,1.9.4,1.9.5,1.9.6,1.9。 7,1.9.8,1.9.9,1.9.10,1.9.11,1.9.12,1.9.13,1.10a1,1.10b1,1.10rc1,1.10,1.10.1,1 .10.2、1.10.3、1.10.4、1.10.5、1.10.6、1.10.7、1.10.8、1.11a1、1.11b1、1.11rc1、1.11、1.11.1、1.11.2、1.11.3, 1.11.4、1.11.5、1.11.6、1.11.7)
警告:您的依存关系无法解决。 您的子从属关系可能不匹配。
您可以使用$ pipenv install --skip-lock绕过此机制,然后运行$ pipenv图来检查情况。


So when I do that, and run the graph:

➜metada git:(master)✗pipenv图
的Django = = 2.0rc1

  • pytz [必需:任何,已安装:2017.3]
    psycopg2 == 2.7.3.2

Just can't create a lock file if I specify the version like that.

If I drop the `==2.0rc1` in `Pipfile` and allow pre-relerases (which I already did), it'll go back to a 1.17 something like that in the lock file, which isn't what I want.

And here's a another output:

➜metada git:(master)✗pipenv运行pip冻结
的Django = = 2.0rc1
pytz == 2017.3
```

很抱歉向所有人发送垃圾邮件,但我也发现了“解决方法”。 我最初是通过brew安装管道的,但决定通过pip切换到安装,或者通过pip3 install --user pipenv切换为pip3 pip3 install --user pipenv

此版本的pipenv能够正确锁定我的Django==2.0rc1 。 我不确定#965是否真的与此有关,但是我在Googlin'时也看到了这个问题,所以我想提一提。 基本上,一个安装pipenv似乎对在执行安装/锁定时是否拾取正确的python轮子有所不同。

我似乎通过删除homebrew pipenv安装并使用标准的pip3 install pipenv来解决类似的问题。 我认为我的错误消息与https://github.com/Homebrew/homebrew-core/blob/master/Formula/pipenv.rb所需的python 2依赖关系有关,我期望在假定安装本机python2而不是利用的情况下python 3(如果有)。 我有时间重现时将尝试发送错误消息。

这可能是由于setup.py约束所致,我们对此无能为力

例如,使用python3安装pipenv

Homebrew pipenv很快将使用python3作为默认设置,以帮助避免这些情况。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

jakul picture jakul  ·  3评论

leileigong picture leileigong  ·  3评论

erinxocon picture erinxocon  ·  3评论

FooBarQuaxx picture FooBarQuaxx  ·  3评论

konstin picture konstin  ·  3评论