Python – Trying to run gunicorn from supervisor gives error – error: class uri ‘simple’ invalid or not found

djangogunicornpythonsupervisordvirtualenv

I am already running successfully 2 django projects (in same virtualenv with python 2.7) with Django + gunicorn + virtualenv + Supervisord environment. But now i am trying to run another project in python 3.2.3 so i created another virtualenv. but now when i try to start django server with supervisorctl command it gives mein 'abnormal termination' error. But in the error log complete trace with error is this:

Error: class uri 'simple' invalid or not found:

[Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/django16/lib/python3.2/site-packages/gunicorn/util.py", line 125, in load_class
section, uri)
File "/home/ubuntu/.virtualenvs/django16/lib/python3.2/site-packages/pkg_resources.py", line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/ubuntu/.virtualenvs/django16/lib/python3.2/site-packages/pkg_resources.py", line 371, in get_distribution
if isinstance(dist,Requirement): dist = get_provider(dist)
File "/home/ubuntu/.virtualenvs/django16/lib/python3.2/site-packages/pkg_resources.py", line 243, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/home/ubuntu/.virtualenvs/django16/lib/python3.2/site-packages/pkg_resources.py", line 728, in require
needed = self.resolve(parse_requirements(requirements))
File "/home/ubuntu/.virtualenvs/django16/lib/python3.2/site-packages/pkg_resources.py", line 626, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: gunicorn

I tried to google it but could not find any solution so if anyone can help me with it???

Best Answer

It's pretty late, but I'll add a solution anyways. I had a similar issue with gunicorn as well, and solved by running my app using env /bin/gunicorn instead of just gunicorn.