Question

Gunicorn Service no such file or directory

Hello guys i followed the tutorial down to the teeth but still having this one error i can not get rid of

my gunicorn.service

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
RequiresMountsFor=/home/tom/projects/muzilla/muzillaenv/bin

[Service]


User=tom
Group=www-data
WorkingDirectory=/home/tom/projects/muzilla
ExecStart=/home/tom/projects/muzilla/muzillaenv/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          muzillat.wsgi:application


[Install]
WantedBy=multi-user.target

The error I’m getting

Jan 11 15:01:10 vmi234115.contaboserver.net systemd[1]: Started gunicorn daemon.
Jan 11 15:01:10 vmi234115.contaboserver.net systemd[10533]: gunicorn.service: Failed to execute command: No such file or directory
Jan 11 15:01:10 vmi234115.contaboserver.net systemd[10533]: gunicorn.service: Failed at step EXEC spawning /home/tom/projects/muzilla/muzillaenv/gunicorn: No such file or directory
Jan 11 15:01:10 vmi234115.contaboserver.net systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Jan 11 15:01:10 vmi234115.contaboserver.net systemd[1]: gunicorn.service: Failed with result 'exit-code'.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Go back into your virtualenv with source [your_project_env]/bin/activate and enter which gunicorn That will return the path to your gunicorn exectuable.

Paste that into the path section of the ‘ExecStart’ value inside the ’/etc/systemd/system/gunicorn.service’ file, and run the 'sudo systemctl daemon-reload’ and 'sudo systemctl restart gunicorn’ commands to restart your daemon and try curling again with curl --unix-socket /run/gunicorn.sock localhost

I hope this helps!

I had the same problem trying to get gunicorn working by following the tutorials (such as https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#prerequisites-and-goals)

My virtualenv did not include a gunicorn folder after installing it with pip. I struggled for hours to get it working until I tried removing the path to gunicorn, and just used “gunicorn”.

I changed my gunicorn.service from

ExecStart=/home/sammy/myproject/myprojectenv/bin/gunicorn --access-logfile ...

to

ExecStart=gunicorn --access-logfile ...

and now it works!

Did you mean the location with bin? I have the same problem.

stat /home/tom/projects/muzilla/muzillaenv/**bin**/gunicorn
ls /home/tom/projects/muzilla/muzillaenv/**bin**/gunicorn
 gunicorn.service: Failed at step EXEC spawning /home/bit/pyapps/btproject/venv/bin/gunicorn: No such file or directory

and with stat command yields these output:

 File: /home/user_name/pyapps/venv/bin/gunicorn
  Size: 239       	Blocks: 8          IO Block: 4096   regular file
Device: 804h/2052d	Inode: 790638      Links: 1
Access: (0775/-rwxrwxr-x)  Uid: ( 1000/     user_name)   Gid: ( 1000/     user_name)
Access: 2019-02-25 12:07:46.586711705 +0700
Modify: 2019-02-25 11:30:43.398357125 +0700
Change: 2019-02-25 11:30:43.398357125 +0700

Could someone shed some light on this?

Thanks,