由于超时,pipenv 安装失败

Dan*_*Bak 16 python installation virtualenv pipenv

C:\Users\danie01\fox\test\robotframework>pipenv install --python 3.5
Creating a virtualenv for this project...
Pipfile: C:\Users\danie01\fox\test\robotframework\Pipfile
Using C:\Users\danie01\AppData\Local\Programs\Python\Python35\python.exe (3.5.0) to create virtualenv...
Traceback (most recent call last):
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\pexpect\expect.py", line 109, in expect_loop
    return self.timeout()
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\pexpect\expect.py", line 82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x05020630>
searcher: searcher_re:
    0: EOF

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\danie01\AppData\Local\Programs\Python\Python36-32\Scripts\pipenv.exe\__main__.py", line 9, in <module>
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\cli.py", line 435, in install
    selective_upgrade=selective_upgrade,
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\core.py", line 1759, in do_install
    pypi_mirror=pypi_mirror,
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\core.py", line 609, in ensure_project
    three=three, python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\core.py", line 556, in ensure_virtualenv
    do_create_virtualenv(python=python, site_packages=site_packages, pypi_mirror=pypi_mirror)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\core.py", line 934, in do_create_virtualenv
    click.echo(crayons.blue(c.out), err=True)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\delegator.py", line 99, in out
    self.__out = self._pexpect_out
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\delegator.py", line 87, in _pexpect_out
    result += self.subprocess.read()
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\pexpect\spawnbase.py", line 441, in read
    self.expect(self.delimiter)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\pexpect\spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\pexpect\spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\pexpect\expect.py", line 119, in expect_loop
    return self.timeout(e)
  File "c:\users\danie01\appdata\local\programs\python\python36-32\lib\site-packages\pipenv\vendor\pexpect\expect.py", line 82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x05020630>
searcher: searcher_re:
    0: EOF
<pexpect.popen_spawn.PopenSpawn object at 0x05020630>
searcher: searcher_re:
    0: EOF
Run Code Online (Sandbox Code Playgroud)

似乎问题可能是我希望它使用 python 3.5 安装 pipenv,但它使用的是 python 3.6?我已经安装并在 PATH 中。我不确定为什么安装程序会超时。

我以前在 3.6 中安装了一个 pipenv,但在删除时遇到了一些困难(我不得不手动删除 virutalenv),所以这可能是部分原因。

编辑:

在第二次尝试时,它只是永远挂在 Using C:\Users\danie01\AppData\Local\Programs\Python\Python35\python.exe (3.5.0) to create virtualenv...

Der*_*Lee 10

pipenv运行了一个子进程,该进程花费的时间比默认的 15 分钟长,然后expect.py被告知等待换行符,但它超时了,就在这里。第一步是增加 TIMEOUT 值:

PIPENV_TIMEOUT 
Run Code Online (Sandbox Code Playgroud)

https://pipenv.readthedocs.io/en/latest/advanced/#configuration-with-environment-variables

PIPENV_INSTALL_TIMEOUT
    Max number of seconds to wait for package installation.
    Defaults to 900 (15 minutes), a very long arbitrary time.
Run Code Online (Sandbox Code Playgroud)

如果它永远挂起,那么问题就变成了:pipenv 被告知做什么会导致阻塞?使用--verbose标志告诉 pipenv 告诉您它正在做什么导致挂起。

#try
export PIPENV_INSTALL_TIMEOUT=9000
Run Code Online (Sandbox Code Playgroud)


小智 7

这对我在 Raspbian 上的 Raspberry Pi 3B+ 上安装时很有帮助。

# if actual install steps fail (installing X/X .. )
# default 900 seconds, 15 minutes, long time
export PIPENV_INSTALL_TIMEOUT=9999

# if creation of virtual env fails (very first step, first time)
# default 120 seconds, 2 minutes, not so long
export PIPENV_TIMEOUT=999

pipenv install requests
Run Code Online (Sandbox Code Playgroud)

有关这两个值的完整定义,请参阅https://pipenv.pypa.io/en/latest/advanced/#configuration-with-environment-variables

  • 将 PIPENV_TIMEOUT 和 PIPENV_INSTALL_TIMEOUT 设置为 9999 对我来说很有效(https://pipenv.readthedocs.io/en/latest/advanced/#configuration-with-environment-variables)。 (3认同)

gen*_*l03 0

你可以删除你的旧virtualenv吗C:\Users\danie01\.virtualenvs

检查Pipfile中python的版本

[requires]
python_version = "3.5"
Run Code Online (Sandbox Code Playgroud)

转到您的项目后再次创建您的 virtualenv

cd C:\Users\danie01\fox\test\robotframework
pipenv install
Run Code Online (Sandbox Code Playgroud)