1

i'm following the query of the documentation of nginx unit with fastapi => https://unit.nginx.org/howto/fastapi/

I ran this query : curl -X PUT --data-binary @config.json --unix-socket /var/run/control.unit.sock http://localhost/config/

but i got an error :

"error": "Invalid configuration.", "detail": "The module to run "python 3.8" is not found among the available application modules."

my config file (config.json) look like this :

{
 "listeners": {
 "*:80": {
 "pass": "applications/fastapi"
}
},

 "applications": {
    "fastapi": {
        "type": "python 3.8",
        "path": "/home/ubuntu/inference1",
        "home": "/home/ubuntu/anaconda3/envs/inference1/bin",
        "module": "application",
        "callable": "app"
    }
 }
}

the command line query i run to see the modules : ls /usr/lib/unit/modules gives me :

java11.unit.so perl.unit.so python2.7.unit.so python3.7.unit.so ruby.unit.so java8.unit.so php.unit.so python3.6.unit.so python3.8.unit.so

If someone knows why the query is returning me the error i cannot find it :'(

etiyoung
  • 11
  • 1
  • This looks like the module name is different. Are you able to share the log? It should tell you at the very top on startup which modules are loaded. – Timo Stark Dec 08 '21 at 19:29
  • @TimoStark I gave him the answer months ago, but had to remove it because of downvoting. I said: Look in the log -> /var/log/unit.log and correct the python version. Also there is no need to install every single module available. And the python module version also have to correspond with the installed python version on your system. –  Dec 30 '21 at 23:28

0 Answers0