Search code examples
djangoubuntunginxuwsgi

uWSGI can't find python3 plugin - open("./python3_plugin.so"): No such file or directory


I have tried all solutions in the stackoverflow but still I could not find a solution for me.

as you can see in the pluginsdir python3 plugin is available but uwsgi say its not.

[uwsgi] ini file

[uwsgi]
vhost = true
plugins-dir = /usr/lib/uwsgi/plugins
plugins = python3
socket = /var/run/domain.org.sock
master = true
enable-threads = true
processes = 2
wsgi-file = /var/www/domain.org/config/wsgi.py
virtualenv = /var/www/domain.org/env
chdir = /var/www/domain.org

ls -la /usr/lib/uwsgi/plugins

drwxr-xr-x 2 root root   4096 Dec 18 21:44 .
drwxr-xr-x 3 root root   4096 Dec 18 21:44 ..
...
-rw-r--r-- 1 root root 199896 Apr 11  2020 python38_plugin.so
lrwxrwxrwx 1 root root     38 Dec 18 21:44 python3_plugin.so -> /etc/alternatives/uwsgi-plugin-python3

uwsgi --ini /etc/uwsgi/apps-available/domain.org.ini

[uWSGI] getting INI configuration from /etc/uwsgi/apps-available/domain.org.ini
open("./python3_plugin.so"): No such file or directory [core/utils.c line 3732]
!!! UNABLE to load uWSGI plugin: ./python3_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 2.0.19.1 (64bit) on [Fri Dec 18 21:52:29 2020] ***
compiled with version: 9.3.0 on 18 December 2020 13:15:35

Solution

  • After installation, try to export and enable python plugin like;

    export PYTHON=python3.8
    uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python38"
    

    Than move plugin files to the related directory;

    mv python38_plugin.so /usr/lib/uwsgi/plugins/python38_plugin.so
    chmod 644 /usr/lib/uwsgi/plugins/python38_plugin.so
    

    You can test is that plugin enabled or not with command like below;

    uwsgi --plugin python38 -s :0
    

    You should see something similar;

    Python version: 3.8xxx
    

    Ps: If you face with errors like "Permission denied" Do not forget the add sudo to all commands.