2

I just put up a django application online and i'm getting this error in my error log

Fatal Python error: PyEval_AcquireThread: NULL new thread state

I have seen a few similar questions online, but they do not explain this error.

2
  • You're getting a C error, not a Python error, so the error is in one of your C libraries. Can you provide some more information, like: Are you in some way extending/embedding Python? What Python extensions are you using? On what environment it the application deployed? Commented Aug 2, 2013 at 9:49
  • 1
    i do not under stand what that means (extending/embedding Python) Commented Aug 2, 2013 at 11:07

3 Answers 3

7

The problem can appear if apache mod_wsgi and mod_python are both enabled. Try

sudo a2dismod python
sudo service apache2 restart
Sign up to request clarification or add additional context in comments.

1 Comment

This is not really a good solution because in some cases, we would like to keep the good and simple mod_python too on the same VirtualHost.
3

This tends to indicate that your mod_wsgi is compiled for a different Python version and/or a different Python installation than the Python virtual environment or Python installation it is trying to use at runtime.

In other words, you are mixing compiled shared library and extension modules from different Python installations. This can cause all sorts of problems.

Go through the checks in:

to understand how your mod_wsgi has been built and verify it is what you expect it to be.

1 Comment

I have the same error, however I'm using the Debian's standard Python version + the official Debian package libapache2-mod-wsgi, so I don't think it's a Python version mismatch... This bug seems hard to debug indeed.
0

In my case it was permissions for the directories where Django or Flask project are. They were created from root, so I changed them to www-data in my case.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.