Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uWSGI runs wrong version of Python

My django/uwsgi/python crashes with a segmentation fault because uWSGI is apparently loading a different version of Python.

I just installed uWSGI using pip. This SO question addresses a solution that involves compiling from source, but I'd like to avoid that.

mihai$ /usr/bin/python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Segmentation fault: 11

mihai$ /usr/local/bin/python
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>>

Any suggestions?

I was hoping for some --flag that can tell uWSGI what version of python to use...

like image 565
bluemihai Avatar asked Dec 11 '13 22:12

bluemihai


1 Answers

Sadly if the python it is compiled against is the wrong one you have to recompile it. Since it is directly linked to the Python it was built for if you are using a different one the symbols won't match.

In the comments you mention you used pip but are not getting the right Python version. Perhaps you are using the wrong pip? For instance on Ubuntu you have Python 2.7 and 3.3. There is a pip-2.7 and a pip-3.3. If you are using virtualenv make sure you are installing with pip from the virtualenv.

like image 182
Sean Perry Avatar answered Oct 19 '22 20:10

Sean Perry