gpt4 book ai didi

python-3.x - `pipenv install` 在 RPi 上超时

转载 作者:行者123 更新时间:2023-12-03 13:54:45 28 4
gpt4 key购买 nike

我正在尝试提出 [pipenv][1]在 Raspberry Pi 零 W 上。我看到的症状是 pexpect 在尝试时超时 create a tutorial project .

诚然,RPi 是一台小型机器,但我在此过程中监视内存使用情况和交换空间,并且没有耗尽内存或交换空间。

知道它想做什么吗?或者我应该如何调试?这是堆栈跟踪:

pi@blue-server:~/testdir $ pipenv install requests
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.5.3) to create virtualenv…
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/pexpect/expect.py", line 109, in expect_loop
return self.timeout()
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/pexpect/expect.py", line 82, in timeout
raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0xb555c950>
searcher: searcher_re:
0: EOF

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/.local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/cli.py", line 478, in uninstall
keep_outdated=keep_outdated,
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 2077, in do_uninstall
ensure_project(three=three, python=python)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 620, in ensure_project
three=three, python=python, site_packages=site_packages
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 569, in ensure_virtualenv
do_create_virtualenv(python=python, site_packages=site_packages)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/core.py", line 936, in do_create_virtualenv
click.echo(crayons.blue(c.out), err=True)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/delegator.py", line 99, in out
self.__out = self._pexpect_out
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/delegator.py", line 87, in _pexpect_out
result += self.subprocess.read()
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 441, in read
self.expect(self.delimiter)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 341, in expect
timeout, searchwindowsize, async_)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 369, in expect_list
return exp.expect_loop(timeout)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/pexpect/expect.py", line 119, in expect_loop
return self.timeout(e)
File "/home/pi/.local/lib/python3.5/site-packages/pipenv/vendor/pexpect/expect.py", line 82, in timeout
raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0xb553a710>
searcher: searcher_re:
0: EOF
<pexpect.popen_spawn.PopenSpawn object at 0xb553a710>
searcher: searcher_re:
0: EOF

环境信息如下:
pi@blue-server:~/foo $ uname -a
Linux blue-server 4.14.34+ #1110 Mon Apr 16 14:51:42 BST 2018 armv6l GNU/Linux

pi@blue-server:~/foo $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch

pi@blue-server:~/foo $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@blue-server:~/foo $ free -m
total used free shared buff/cache available
Mem: 433 26 260 3 145 353
Swap: 99 0 99

附加信息

我注意到它在子进程调用中超时。使用 pdb,我将其追溯到命令:
<Command ['/usr/bin/python3.5', '-m', 'pipenv.pew', 'new', 'foo-su43ObVR', '-d', '-p', '/usr/bin/python3.5']>

我尝试从命令行复制该调用,并且它没有错误地完成了:
pi@blue-server:~/foo $ /usr/bin/python3.5 -m pipenv.pew new 'asdf' -d -p /usr/bin/python3.5
Already using interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /home/pi/.local/share/virtualenvs/asdf/bin/python3.5
Also creating executable in /home/pi/.local/share/virtualenvs/asdf/bin/python
Installing setuptools, pip, wheel...done.

这似乎很有希望,但我仍然不知道是什么导致了超时。

最佳答案

TL;DR:解决方法是延长超时时间

解决了。因为 RPi Zero 很慢,所以它超时了。线索from the discussion on github ,我注意到现在可以使用环境变量扩展默认超时。所以这解决了这个问题:

pi@blue-server:~/testdir $ export PIPENV_TIMEOUT=500
pi@blue-server:~/testdir $ pipenv install requests

关于python-3.x - `pipenv install` 在 RPi 上超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50382837/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com