简体   繁体   English

主管无法加载Cuda库,路径未丢失,无需主管即可工作

[英]Supervisor can't load Cuda libs , PATH IS NOT MISSING, works without supervisor

I've a python application with Flask, tensorflow-gpu ..., that runs without a problem when I run: 我有一个带有Flask,tensorflow-gpu ...的python应用程序,运行时运行没有问题:

gunicorn server:app -b localhost:8000

but when I run it with the supervisor, it gives me the error 但是当我与主管一起运行时,它给了我错误

ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

I'm not using virtualenv. 我没有使用virtualenv。

here is my supervisor config 这是我的主管配置

[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

What am I doing wrong? 我究竟做错了什么?

If the app runs directly at the command line, why supervisor can't run it? 如果该应用程序直接在命令行运行,为什么主管无法运行它?

I've the env vars at the bashrc, like I said, it works if I run from the command line... 我在bashrc上有env vars,就像我说的那样,如果我从命令行运行,它就可以工作...

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/

Supervisor don't load environment variables, it doesn't depend on bash, so you must load environment variables in supervisor configuration directly. 主管不加载环境变量,它不依赖bash,因此您必须直接在主管配置中加载环境变量。

Here my configuration as example: 这里以我的配置为例:

[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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM