【问题标题】:pipenv install failing due to timeout由于超时,pipenv 安装失败
【发布时间】:2018-12-17 18:02:18
【问题描述】:
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

似乎问题可能是我希望它使用 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...

【问题讨论】:

    标签: python installation virtualenv pipenv


    【解决方案1】:

    你能删除你旧的 virtualenv C:\Users\danie01\.virtualenvs

    检查Pipfile中python的版本

    [requires]
    python_version = "3.5"
    

    转到您的项目后再次创建您的虚拟环境

    cd C:\Users\danie01\fox\test\robotframework
    pipenv install
    

    【讨论】:

      【解决方案2】:

      在 Windows 上,关闭 Windows Defender 对我有用。我没有遇到超时,安装速度也快得多。

      【讨论】:

      • 对于 Windows 10,我搜索并打开“Windows Defender”,单击“防火墙和网络保护”,公共网络连接处于活动状态,所以我单击“公共网络”,然后打开“Windows Defender 防火墙” " 关闭。
      【解决方案3】:

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

      PIPENV_TIMEOUT 
      

      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.
      

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

      #try
      export PIPENV_INSTALL_TIMEOUT=9000
      

      【讨论】:

        【解决方案4】:

        这有助于我在 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
        

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

        【讨论】:

        【解决方案5】:

        根据您运行pipenv install 命令的位置,将环境变量PIP_NO_CACHE_DIR 设置为off。就我而言,我在我的 Dockerfile 中通过在 ENV PIP_NO_CACHE_DIR=false 之前添加一行 RUN pipenv install 来设置它

        【讨论】:

          【解决方案6】:

          我使用的是url = "https://pypi.tuna.tsinghua.edu.cn/simple",并且对于安装的每个依赖项,我都会遇到超时错误。当我将网址更改为简单的工作时。

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

          【讨论】:

            【解决方案7】:

            尝试做pipenv --rm - 删除虚拟环境

            然后pipenv shell - 这将再次启动虚拟环境

            然后再次pipenv install

            为我工作

            【讨论】:

              猜你喜欢
              • 2012-06-22
              • 2019-03-15
              • 2019-03-30
              • 2019-03-11
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2017-02-05
              • 2020-08-06
              相关资源
              最近更新 更多