UWSGI error with PCRE Ubuntu 20.04 error while loading shared libraries: libpcre.so.1:
What solved it for me was apparently just reinstalling UWSGI, like in this thread, in my virtual env while forcing it to ignore the cache so it could know to use the pcre library I installed.
In order, doing this
uwsgi --version
Was giving me this
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
So I made sure I had the latest libpcre installed
sudo apt-get install libpcre3-dev
And then what linked it all together was this
pip install uwsgi -I --no-cache-dir
Deploying C app that uses the PCRE library
It's better to either install it or link it in statically. The former, of course, is lighter on resources. The best way to ensure compatibility would be to build the package for target system, specifying all dependencies (depends on the distribution, of coursE).
Enabling internal routing in uWSGI
I had to install uWSGI with pcre support. It solved problem with routing.
To do it I had to install pcre lib(for Ubuntu the package called libpcre3) and reinstall uWSGI then. Since PCRE is already in your system uWSGI will be automatically compiled with pcre support.
There are also points from @tobias.mcnulty comment that also might be useful:
- libpcre3-dev package on Ubuntu also needs to be installed
- afterwards you may want to run
pip install -I --no-cache-dir uwsgi
to reinstall it, otherwise you might just get the same cached wheel. - the error in the logs is
!!! no internal routing support, rebuild with pcre support !!!
Error while loading shared libraries: 'libpcre.so.0: cannot open shared object file: No such file or directory'
The message means what it says. The nginx
executable was compiled to expect the PCRE (Perl-compatible Regular Expression) shared library to be available somewhere on LD_LIBRARY_PATH or specified in /etc/ld.so.conf
or whatever equivalent library-locating mechanisms apply to your operating system, and it cannot find the library.
You will need to install PCRE - or configure your environment so that nginx
will look for the PCRE library where it is installed.
uwsgi failed to open python file /root/ ... /wsgi.py (DJANGO)
Check your file permissions for the Django project.You have your WSGI worker configured to use the account 'www-data'. Either change this to an account that has access to the directories and file, or change the files permissions.
You can validate the file permissions by running ls -la
in the directory. The third column shows the owner and the fourth column shows the group.
-rwxrwxrwx 1 lbird lbird 548 Nov 3 11:52 default-soapui-workspace.xml
-rwxrwxrwx 1 lbird lbird 2785280 Jun 5 2021 ntuser.dat.LOG1
-rwxrwxrwx 1 lbird lbird 3256320 Jun 5 2021 ntuser.dat.LOG2
-rwxrwxrwx 1 lbird lbird 20 Jun 5 2021 ntuser.ini
-rwxrwxrwx 1 lbird lbird 8677 Nov 3 11:52 soapui-settings.xml
You can change file and folder permissions by running chown www-data:www-data ./*
in the project directory.
I do not recommend keeping the files in your root directory, that should be protected. Instead consider moving them to /var/www
or /var/app
.
To validate if its a permissions issue, you could change your uWSGI configuration to make the uid and gid root, but do not use this in a production setting.
Related Topics
Tar Error: Unexpected Eof in Archive
Programmatic Resource Monitoring Per Process in Linux
Why The Size of an Empty Directory in Linux Is 4Kb
How to Open Serial Port in Linux Without Changing Any Pin
Linux Shell Programming String Compare Syntax
Limit Top Command to Only Display Top X Processes on Command Line
In a Bash Script, What Would $'\0' Evaluate to and Why
How to Send Signal from One Program to Another
How to Use Gpg Signing Key on a Remote Server
Rodbc Not Recognizing My Odbc Settings
How to Install Python Modules in a Docker Image
Alsa: How to Duplicate a Stream on 2 Outputs and Save System Configs
How to Use File Protocol to Access a Directory on Local System
Split Mp3 File to Time Sec Each Using Sox
How to Diff Two Sections of The Same File
Finding Threading Bottlenecks and Optimizing for Wall-Time with Perf