amdorsey12
amdorsey12

Reputation: 513

UWSGI error with PCRE Ubuntu 20.04 error while loading shared libraries: libpcre.so.1:

I run through the following steps to attempt to start up an app for production:

-Setup a virtualenv for the python dependencies: virtualenv -p /usr/bin/python3.8 ~/app_env
    
-Install pip dependencies: . ~/app_env/bin/activate && pip install -r ~/app/requirements.txt
    
-Un-comment the lines for privilege dropping in uwsgi.ini and change the uid and gid to your account name
    
-Login to root with sudo -s and re-source the env with source /home/usr/app_env/bin/activate
    
-Set the courthouse to production mode by setting the environment variable with export PRODUCTION=1
    
-Start the app: cd /home/usr/app && ./start_script.sh

And I get the following error:

(app_env) root@usr-Spin-SP314-53N:/home/usr/Desktop/app# ./start.sh 
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

I tried a few things such as installing a newer libpcre version like mentioned here, tried also the steps mentioned here but that didn't work. Also the environment I'm setting up doesn't use anaconda but regular python. I even tried pip install uwsgi in my virtual env but it said the requirement was already satisfied. I'm not much of an expert when it comes to somewhat complex package management like this, help with how to solve this would be greatly appreciated. Thanks. I'm on Ubuntu 20.04, using python 3.8.

Upvotes: 1

Views: 5813

Answers (2)

A. Gulle
A. Gulle

Reputation: 1

I tried to solve this error but it did not work no matter what I did and then reinstalled uwsgi, but the following 2 lines solved my problem

sudo find / -name libpcre.so.*

#change the path of the /home/anaconda3/lib/libpcre.so.1 with the one appears after above one.

sudo ln -s /home/anaconda3/lib/libpcre.so.1 /lib 
which python

Upvotes: 0

amdorsey12
amdorsey12

Reputation: 513

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

Upvotes: 5

Related Questions