PCRE problem while configuring WSGI application

[A note on context: I'm completely new to Linux and trying to learn by following instructions on the internet, so I have a rather limited understanding of how to handle problems]

I am working with Ubuntu 16.04.2 LTS.

I followed the guide How to Configure uWSGI and Nginx to Serve Python Applications on Ubuntu 14.04 . Once I have configured virtualenv, I follow the instructions:

pip install uwsgi

You can check that it is now available by typing:

uwsgi --version

If it returns a version number, the uWSGI server is available for use.

However, when I do this, I get:

uwsgi: error while loading shared libraries: libpcre.so.1: unable to open shared objects file: no such file or directory

If I click further and continue through the manual, everything crashes when I try to use uwsgi.

My research reports that PCRE is Perl compatible regular expressions, and several people have asked questions online with libpcre.so.1 problems with other applications.

For example, the answer to a similar problem related to nginx :

The message means what it says. The nginx executable was compiled to expect the shared PCRE library (Perl Regular Expression compatible) to be available somewhere at LD_LIBRARY_PATH or specified in /etc/ld.so.conf or any equivalent library placement mechanisms applicable to your operating system and not can 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.

But I can't seem to find much to install or configure PCRE. Most installation instructions use: apt-get install libpcre3 libpcre3-dev

and then reinstalling uwsgi pip install uwsgi -I

. Like this example. Where I tried everything posted and was not found anywhere else.

I think my fundamental problem is that I am not very good at this issue or how to do the things mentioned in the nginx example above.

Any insight or guidance would be much appreciated (sorry if too vague!)

+3


source to share


1 answer


While my context may be different, the following steps will help you as well.

I have done pip install uwsgi

in my environment created conda create -yn <env_name> python

. Note that you don't even need to install PCRE in your environment because it is included in the Anaconda

. We can see this issue in the environment, after source activate <env_name>

:

# uwsgi --version
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open...

      

With root / sudo access, you can find where libpcre.so.1

/ will be:

# find / -name libpcre.so.1
/opt/anaconda3/lib/libpcre.so.1

      

Now let Linux know how to access it:



# ldconfig /opt/anaconda3/lib/

      

That's all you need to make it work. You can see the change you are making:

# find / -name uwsgi
/opt/anaconda3/envs/<env_name>/bin/uwsgi

# ldd -d /opt/anaconda3/envs/<env_name>/bin/uwsgi
        linux-vdso.so.1 =>  (0x00007fff2d1ba000)
        ...
        /lib64/ld-linux-x86-64.so.2 (0x00007ff98dbc5000)
undefined symbol: pcre_free     (/opt/anaconda3/envs/cts/bin/uwsgi)

      

PS Disabled ldconfig

above fills the global cache /etc/ld.so.cache

, which in my case collided with the system library ( /lib/x86_64-linux-gnu/libdbus-1.so.3

). So I had to revert the change by running ldconfig

without parameters and resorting to bind to runtime = start uwsgi

like

# LD_LIBRARY_PATH=/opt/anaconda3/lib uwsgi --version

      

+1


source







All Articles