Gunicorn failed to start as it fails to identify the version of a package

余生颓废 提交于 2020-07-10 10:25:23

问题


While gunicorn is attempting to run flask server, the following error is shown:

Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/customer-account-automation-gLS21FFx/lib/python3.7/site-packages/pbr/version.py", line 442, in _get_version_from_pkg_resources
    provider = pkg_resources.get_provider(requirement)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 344, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 778, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jira' distribution was not found and is required by the application

During handling of the above exception, another exception occurred:

    from customer_account_automation.app import app as application
  File "/root/flask/customer_account_automation/app.py", line 5, in <module>
    from jira import JIRA
  File "/root/.local/share/virtualenvs/customer-account-automation-gLS21FFx/lib/python3.7/site-packages/jira/__init__.py", line 6, in <module>
    _v = VersionInfo('jira').semantic_version()
  File "/root/.local/share/virtualenvs/customer-account-automation-gLS21FFx/lib/python3.7/site-packages/pbr/version.py", line 462, in semantic_version
    self._semantic = self._get_version_from_pkg_resources()
  File "/root/.local/share/virtualenvs/customer-account-automation-gLS21FFx/lib/python3.7/site-packages/pbr/version.py", line 449, in _get_version_from_pkg_resources
    result_string = packaging.get_version(self.package)
  File "/root/.local/share/virtualenvs/customer-account-automation-gLS21FFx/lib/python3.7/site-packages/pbr/packaging.py", line 876, in get_version
    name=package_name))
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name jira was given, but was not able to be found.

Here you find jira module installed

(customer) root@jsd:~/flask# pip freeze --all
...
Flask==1.1.2
gunicorn==20.0.4
jira==2.0.0
....

The weird thing is that when running flask run instead, it works and never complains, so I am thinking there is a problem with gunicorn.

The command I run gunicorn with is:

gunicorn --bind jsd.tv:5000 wsgi:customer_account_automation/app --pythonpath /root/.local/share/virtualenvs/customer-account-automation-gLS21FFx/lib/python3.7/site-packages

Any ideas what could be the issue here?

来源:https://stackoverflow.com/questions/62800227/gunicorn-failed-to-start-as-it-fails-to-identify-the-version-of-a-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!