Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why gunicorn command not found with gunicorn installed?

I have intalled gunicorn,but gunicorn command not found:

# pip3.4 install gunicorn
Requirement already satisfied (use --upgrade to upgrade): gunicorn in /usr/local/python3.4/lib/python3.4/site-packages

# gunicorn
-bash: gunicorn: command not found

what is the problem,is gunicorn install path not be recognized by system?

like image 673
Jim Avatar asked Apr 16 '15 15:04

Jim


People also ask

How do I know if Gunicorn is installed?

This confirms that Gunicorn was started and able to serve your Django application. You can verify that the Gunicorn service is running by checking the status again: sudo systemctl status gunicorn.

Does Gunicorn work on Linux?

If you are using Debian GNU/Linux it is recommended that you use system packages to install Gunicorn except maybe when you want to use different versions of Gunicorn with virtualenv.

What port is Gunicorn running?

The Gunicorn process will start and bind to all host IP addresses on port 8081.


2 Answers

I faced the same issue and it turns out I had to add gunicorn binary path to Linux PATH variable. You can start by echoing $PATH to see all binary path listed on the system. Then find out where gunicorn is installed. For my case I was using python virtual environment and pyenv which helps manage several python versions and dependencies separately.

(venv3.6) dave@daverig (develop)✗ % pip show gunicorn
Name: gunicorn
Version: 19.7.1
Summary: WSGI HTTP Server for UNIX
Home-page: http://gunicorn.org
Author: Benoit Chesneau
Author-email: [email protected]
License: MIT
Location: /home/dave/.pyenv/versions/3.6.2/envs/venv3.6/lib/python3.6/site-packages

Notice gunicorn is installed in /home/dave/.pyenv/versions/3.6.2/envs/venv3.6/lib/python3.6/site-packages and the corresponding path for the binaries for this particular python version is at /home/dave/.pyenv/versions/3.6.2/envs/venv3.6/bin. So I had to add that to Linux path via ~/.profile file like so;

export PATH=$PATH:$HOME/.pyenv/versions/3.6.2/envs/venv3.6/bin then ofcourse you want to refresh this using source ~/.profile or restart your terminal. Once I was able to do this, gunicorn binary was now available on my console;

(venv3.6) dave@daverig (develop)✗ % gunicorn --version
gunicorn (version 19.7.1)
like image 171
David Okwii Avatar answered Sep 29 '22 17:09

David Okwii


I had the same problem on Debian.

It turns out that on Debian the documentation advises to install gunicorn via apt:

$ sudo apt install gunicorn
like image 11
ja2142 Avatar answered Sep 29 '22 17:09

ja2142