JeffGallant
JeffGallant

Reputation: 449

Why is there no command for gunicorn

I ran this:

pip3 install gunicorn

Then I tried to run gunicorn, but I was told there was no such command. If I do this:

ls -al /usr/local/lib/python3.7/site-packages/gunicorn/

I see this:

.
..
app
arbiter.py
argparse_compat.py
_compat.py
config.py
debug.py
errors.py
glogging.py
http
__init__.py
instrument
pidfile.py
__pycache__
reloader.py
selectors.py
six.py
sock.py
systemd.py
util.py
workers

I was thinking I could create a symbolic link and store it here:

/usr/local/bin/

But what would I link? It seems as if there is no actual gunicorn command?

If I look here:

https://github.com/benoitc/gunicorn

There is no file called "gunicorn". Likewise if I look here:

https://github.com/benoitc/gunicorn/gunicorn

As near as I can see, there is no file called "gunicorn". So how are we suppose to call this from the command line?

Upvotes: 4

Views: 12182

Answers (7)

Neel Shah
Neel Shah

Reputation: 81

In case anyone reaches this page, and has not yet found an answer (it happened with me), please check to make sure you have exported both

/Library/Frameworks/Python.framework/Versions/3.6/bin

and

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages

to your PATH variable.

I am working with MacOS 10.14.6 and Python 3.6.5, so apt-get was not really an option for me.

Upvotes: 1

R.Sutliya
R.Sutliya

Reputation: 76

There are two ways to solve this problem:-> just add the path of gunicorn location or find the path and execute with the path.

If you're working with virtualenv then:- don't install the gunicorn for root just use the pip install gunicorn. if you already installed the gunicorn for root then just remove it by sudo apt remove gunicorn

you're in your virtualenv then just chek the location of the gunicorn by:-

pip show gunicorn This will give you the details including the path of gunicorn. something like this:-

/home/user/.local/lib/python3.6/site-packages.

now either you can add this path or just execute it as:-

~/.local/bin/gunicorn --bind 0.0.0.0:8000 <projectname>.wsgi

Upvotes: 2

Moka
Moka

Reputation: 1148

If you have apt (or apt-get):

$ sudo apt install gunicorn3

$ sudo ln -s /usr/bin/gunicorn3 /usr/bin/gunicorn

You may want to remove the old gunicorn package first:

$ sudo apt remove gunicorn

Check where gunicorn3 has been installed (just in case):

$ whereis gunicorn3

Upvotes: 6

zxt1996
zxt1996

Reputation: 1

You should use

export PATH=${PATH}:/usr/local/python3/bin

Upvotes: -1

郑佳妮
郑佳妮

Reputation: 173

You need pip install gunicorn.

Upvotes: 0

Reddi Mohan
Reddi Mohan

Reputation: 281

You can install gunicorn in two ways,

If you want to install OS level try this for ubuntu sudo apt install gunicorn or pip style pip install gunicorn - this is suggestable

To check If it is installed try below commands

$ pip show gunicorn
Name: gunicorn
Version: 19.9.0
Summary: WSGI HTTP Server for UNIX
Home-page: http://gunicorn.org
Author: Benoit Chesneau
Author-email: [email protected]
License: MIT
Location: /home/<user>/anaconda3/lib/python3.6/site-packages
Requires: 
Required-by:

Let me know If my understanding on your question is right.

Upvotes: 2

Arghya Saha
Arghya Saha

Reputation: 5713

If you are using virtualenv then gunicorn is created in

/path_to_your_env/bin/gunicorn

So whenever you try to use gunicorn you need to load the virtualenv first and then gunicorn command would execute.

Upvotes: 1

Related Questions