Heroku python app throwing error - KeyError: 'pip._vendor.urllib3.util.queue'



我在 Heroku 上部署我的应用程序时出现以下错误。以前它工作正常,但现在给出此错误。

在具有相同python版本的Linux虚拟环境中运行相同的应用程序可以正常工作。

2018-08-23T06:40:34.055457+00:00 app[web.1]: importlib.import_module(package)
2018-08-23T06:40:34.055459+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2018-08-23T06:40:34.055458+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2018-08-23T06:40:34.055460+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/spacy/__init__.py", line 5, in <module>
2018-08-23T06:40:34.055462+00:00 app[web.1]: from .deprecated import resolve_model_name
2018-08-23T06:40:34.055463+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/spacy/deprecated.py", line 8, in <module>
2018-08-23T06:40:34.055464+00:00 app[web.1]: from .cli import download
2018-08-23T06:40:34.055466+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/spacy/cli/__init__.py", line 1, in <module>
2018-08-23T06:40:34.055467+00:00 app[web.1]: from .download import download
2018-08-23T06:40:34.055468+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/spacy/cli/download.py", line 9, in <module>
2018-08-23T06:40:34.055469+00:00 app[web.1]: from .link import link_package
2018-08-23T06:40:34.055471+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/spacy/cli/link.py", line 4, in <module>
2018-08-23T06:40:34.055473+00:00 app[web.1]: import pip
2018-08-23T06:40:34.055474+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pip/__init__.py", line 45, in <module>
2018-08-23T06:40:34.055475+00:00 app[web.1]: from pip.vcs import git, mercurial, subversion, bazaar  # noqa
2018-08-23T06:40:34.055477+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pip/vcs/mercurial.py", line 9, in <module>
2018-08-23T06:40:34.055478+00:00 app[web.1]: from pip.download import path_to_url
2018-08-23T06:40:34.055479+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pip/download.py", line 40, in <module>
2018-08-23T06:40:34.055481+00:00 app[web.1]: from pip._vendor import requests, six
2018-08-23T06:40:34.055482+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 98, in <module>
2018-08-23T06:40:34.055483+00:00 app[web.1]: from . import packages
2018-08-23T06:40:34.055485+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/requests/packages.py", line 12, in <module>
2018-08-23T06:40:34.055486+00:00 app[web.1]: sys.modules['pip._vendor.requests.packages.' + mod] = sys.modules["pip._vendor." + mod]
2018-08-23T06:40:34.055538+00:00 app[web.1]: **KeyError: 'pip._vendor.urllib3.util.queue'**
2018-08-23T06:40:34.057109+00:00 app[web.1]: [2018-08-23 06:40:34 +0000] [13] [INFO] Worker exiting (pid: 13)
2018-08-23T06:40:34.191433+00:00 app[web.1]: [2018-08-23 06:40:34 +0000] [10] [INFO] Shutting down: Master
2018-08-23T06:40:34.191660+00:00 app[web.1]: [2018-08-23 06:40:34 +0000] [10] [INFO] Reason: Worker failed to boot.

pip._vendor import requests切换到import requests为我解决了这个问题。如果它不能为您解决,您应该检查您正在使用的 pip 版本,显然我可以在使用 pip 10+ 时重现此问题,因此请尝试降级到 pip 9。

相关内容

  • 没有找到相关文章