3

I have installed ffmpeg and can run it from command line. I have anaconda installed and get different result for which ffmpeg command as follow:

  • /usr/bin/ffmpeg (base env)
  • /root/anaconda3/envs/myenv/bin/ffmpeg (myenv)

python app.py - The app uses Flask. I've tested it on localhost it is working as expected.

Ran it with gunicorn still working locally.

When I deploy it using Nginx it doesn't work. It can't find ffmpeg. I get the error gunicorn[23436]: /bin/sh: 1: ffmpeg: not found.

My usage inside python file is as follows: subprocess.call('/root/anaconda3/envs/myenv/bin/ffmpeg ...) (I tried it with ffmpeg, full path and anaconda path - still to no success)

I doubt there is something about Nginx that I'm missing, does it need special configuration for executables. Server config is as follows:

server {
    listen 80;
    server_name x.x.x.x;

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/myapp/myapp.sock;
        client_max_body_size 30M;
    }
}

I had installed ffmpeg with pip but then I deleted it. It doesn't have anything to do with the error since I can run it locally without problems.

Mirwise Khan
  • 1,317
  • 17
  • 25
  • Are you able to resolve the issue? I am facing the same issue. – arun n a Apr 08 '22 at 09:23
  • 2
    @arunna It has been I while, I think I resolved the issue by writing a service and providing environment directory `Environment="PATH=/root/anaconda3/bin"` followed by `ExecStart=/root/anaconda3/envs//bin/gunicorn --workers 3 --bind unix:.sock -m 007 wsgi:app` – Mirwise Khan Apr 09 '22 at 07:46

1 Answers1

0

I resolved the issue by writing a service and providing environment directory

Environment="PATH=/root/anaconda3/bin" 

followed by

ExecStart=/root/anaconda3/envs/<app-name>/bin/gunicorn --workers 3 --bind unix:<app-name>.sock -m 007 wsgi:app
Mirwise Khan
  • 1,317
  • 17
  • 25