Polyphemus_rm
Posts: 2
Joined: Wed Aug 22, 2012 4:54 pm

Problem with uwsgi...

Wed Aug 22, 2012 9:43 pm

Hi,

I trying to setup a little website I ran into an error spit out by uwsgi:

Code: Select all

Fatal Python error: exceptions bootstrapping error.
This is on Raspbian with uwsgi installed with pip:

Code: Select all

sudo apt-get install pip;
sudo pip install uwsgi;
This is the complete output of uwsgi:

Code: Select all

root@raspberrypi:/home/pi# uwsgi -s :3031 /home/www-data/flaskr/flaskr.py
*** Starting uWSGI 1.2.5 (32bit) on [Wed Aug 22 18:35:02 2012] ***
compiled with version: 4.6.3 on 22 August 2012 15:43:02
detected number of CPU cores: 1
current working directory: /home/pi
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to TCP address :3031 fd 3
Python version: 2.7.3rc2 (default, May  6 2012, 21:23:07)  [GCC 4.6.3]
Fatal Python error: exceptions bootstrapping error.
Aborted
After this I compiled and installed my own python 2.7.3 (not rc2) (in /usr/local/bin/python, and working), as suggested here, and still I got the same error, probably because uwsgi still prints 2.7.3rc2. Compiled uwsgi from source, still same error.

The same setup on desktop Ubuntu 12.04 and desktop Debian wheezy works fine.

So is there anybody who could confirm this problem or has any input on fixing it?

unbit
Posts: 3
Joined: Thu Aug 23, 2012 4:50 pm

Re: Problem with uwsgi...

Thu Aug 23, 2012 4:51 pm

This problem is present on all ARM debian system, i am hardly investigating which is the cause.

If i will be able to find a solution i will post it here

unbit
Posts: 3
Joined: Thu Aug 23, 2012 4:50 pm

Re: Problem with uwsgi...

Mon Aug 27, 2012 3:15 pm

Building the python plugin as shared library (like the debian package does) does not show the problem.

Whenever you embed libpython in the uWSGI core the problem pop up.

Using a non-debian python package does not show the problem.

To build with a custom python just use, from the source directory

path/of/python uwsgiconfig --build

Polyphemus_rm
Posts: 2
Joined: Wed Aug 22, 2012 4:54 pm

Re: Problem with uwsgi...

Sat Sep 01, 2012 5:32 pm

Thanks unbit,

Just make it clear for anyone with the same problem, you have to compile python with:

Code: Select all

./configure --enable-shared; make; make install;
When building uwsgi this is checked in './plugins/python/uwsgiplugin.py' with:

Code: Select all

from distutils import sysconfig
/* snip */
    if not sysconfig.get_config_var('Py_ENABLE_SHARED'):
You can test 'sysconfig.get_config_var('Py_ENABLE_SHARED')' in the interactive interpreter and should return '1'.

After this and compiling uwsgi with the newly compiled python, uwsgi shouldn't raise this error any longer.

alloisxp
Posts: 3
Joined: Fri Jan 25, 2013 9:56 am

Re: Problem with uwsgi...

Thu May 09, 2013 10:59 am

Hello!

Code: Select all

./configure --enable-shared; make; make install;
I have to go to the Python directory or?
The one in /usr/lib/Python2.7 ?
But there is no /configure folder (only /config), but when I try this command there it says:
make: *** No rule to make target `Makefile.pre.in', needed by `Makefile.pre'. Stop.
I'm a beginner as you can probably see :(
What am I doing wrong?

fhuddles
Posts: 5
Joined: Thu May 16, 2013 9:32 pm

Re: Problem with uwsgi...

Thu May 16, 2013 9:39 pm

I tried downloading and building python2.7 with the --enable-shared configure option. But now I get an error when trying to run that python:
...
File "/usr/local/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/usr/local/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/usr/local/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/usr/local/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT

I've tried defining MAXREPEAT in the sre_constants.py file, and commenting out the imports, but other
errors result.
Any ideas for what to do?

Thanks,

fhuddles
Posts: 5
Joined: Thu May 16, 2013 9:32 pm

Re: Problem with uwsgi...

Thu May 23, 2013 5:17 pm

I managed to fix this problem. I'm not sure how. I just did an apt-get update and apt-get upgrade, and now it works. I don't even think I saw any Python changes in what it did. I just thought I should close this issue.

rogerdahl
Posts: 11
Joined: Thu Sep 06, 2012 10:19 pm

Re: Problem with uwsgi...

Sat Aug 10, 2013 4:02 pm

Here's what I did to get uWSGI running on the Pi. Note: I'm booting only to the console and have not checked if this affects the desktop. Compiling Python and uWSGI takes and hour or two.

Remove packaged python stuff:

Code: Select all

$ sudo apt-get remove .*python.*
Install Python from source, with shared libraries:

Code: Select all

$ sudo -s
$ apt-get install build-essential libssl-dev libbz2-dev
$ wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
$ tar xjf Python-2.7.5.tar.bz2
$ cd Python-2.7.5
$ ./configure --enable-shared; make; make install;
$ ldconfig
Install pip:

Code: Select all

$ cd
$ curl -O http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ python get-pip.py
Install uWSGI from source using locally compiled Python and shared libraries :

Code: Select all

$ CFLAGS=-I/usr/local/include/python2.7 pip install uwsgi

Return to “Python”