我有一个使用Flask,tensorflow-gpu ...的python应用程序,在我运行时运行没有问题:
gunicorn server:app -b localhost:8000
但是当我与主管一起运行时,它会给我错误
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
我没有使用virtualenv。
这是我的主管配置
[program:appserver]
command = gunicorn server:app -b localhost:8000
directory = /storage/appserver
user = root
stdout_logfile = /home/deploy/appserver/logs/gunicorn/gunicorn_stdout.log
stderr_logfile = /home/deploy/appserver/logs/gunicorn/gunicorn_stderr.log
redirect_stderr = True
我做错了什么?
如果应用程序直接在命令行运行,为什么主管无法运行它?
我在bashrc上有env变种,就像我说的那样,如果我从命令行运行它会起作用...
export PATH=/usr/local/cuda-9.0/bin/${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/
root@xxxxx:/home/xxxxx# echo $PATH
/usr/local/cuda-9.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
root@xxxxxx:/home/xxxxx# echo $LD_LIBRARY_PATH
/usr/local/cuda-9.0/lib64/
答案 0 :(得分:0)
Supervisor不会加载环境变量,它不依赖bash,因此您必须直接在Supervisor配置中加载环境变量。
这里以我的配置为例:
[program:hoot_api_ml]
user = hoot
environment = LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
directory = /home/hoot/backend/hoot/ml
command = gunicorn3 -c ../../conf/api_ml/gunicorn.py api:APP
autostart = true
autorestart = true
stderr_logfile = /var/log/hoot/api_ml_supervisor.err
stdout_logfile = /var/log/hoot/api_ml_supervisor.log
stopsignal = INT