New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Python error: PyThreadState_Get: no current thread #21

Closed
kaikuehne opened this Issue Oct 18, 2015 · 10 comments

Comments

Projects
None yet
6 participants
@kaikuehne

kaikuehne commented Oct 18, 2015

Hi, thanks for the project.
When I try to use the classifier, I get an python error:

% ./demos/classifier.py infer ./models/openface/celeb-classifier.nn4.v1.pkl foo.jpg
Fatal Python error: PyThreadState_Get: no current thread
[1]    25105 abort      ./demos/classifier.py infer ./models/openface/celeb-classifier.nn4.v1.pkl

I'm on a mac and using a virtualenv environment to install the python dependencies,
so those are available. It does not matter if I'm using the self-compiled dlib as documented
or the one you can install with pip.

Any idea what might be the problem here?
Thanks!

@bamos

This comment has been minimized.

Collaborator

bamos commented Oct 18, 2015

Hi @kaikuehne - thanks for reporting this, I'll clarify this in the README once we resolve it.

I remember getting the same error a few months ago on my OSX, but don't remember how I resolved it.
I think opencv or dlib are linking against some version of Python that conflicts with the runtime python libraries.

What Python interpreter are you using? Can you send the output of which python2?

Do you have the homebrew or macports version of Python installed?

I think a minimal example of this problem is from running the python2 interpreter and then trying to import cv2 then dlib. Can you try this and see if you get the same error?

I'll try to get access to a clean OSX machine within a week soon so I can reproduce.

For a workaround, the docker version in OSX should work well since it's running on a Linux docker machine.

@kaikuehne

This comment has been minimized.

kaikuehne commented Oct 18, 2015

Hi again, the problem I got was not related to openface.
In the python repl, the error also occured when I tried to import the dlib module.
This works now after I recompiled python and boost-python.

Now though, I get another error when running the classifier:

% ./demos/classifier.py infer ./models/openface/celeb-classifier.nn4.v1.pkl steve.jpg
Predict SteveCarell with 0.68 confidence.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Users/kai/Desktop/openface/demos/../openface/__init__.py", line 45, in exitHandler
    p.kill()
NameError: global name 'p' is not defined
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Users/kai/Desktop/openface/demos/../openface/__init__.py", line 45, in exitHandler
    p.kill()
NameError: global name 'p' is not defined

I looked into the file, and think I found the reason for the error:

        def exitHandler():
            if self.p.poll() is None:
                p.kill() # This should be self.p.kill()

It works now!

@kaikuehne

This comment has been minimized.

kaikuehne commented Oct 18, 2015

Nevermind, I just saw that this was resolved two days ago.
I should have pulled before trying again. :-)

@bamos

This comment has been minimized.

Collaborator

bamos commented Oct 18, 2015

Great to hear @kaikuehne! And sorry about the error with p.kill in the exit handler, it's resolved in the latest master branch.

@bamos

This comment has been minimized.

Collaborator

bamos commented Oct 18, 2015

I've added a note to the README about this issue and have linked here, hopefully this won't be a major issue for OSX users.

@bamos bamos closed this Oct 18, 2015

@wodubayo

This comment has been minimized.

wodubayo commented Jul 4, 2016

Hi Thanks for this useful project.
I am getting this error referencing dlib.Please help

Python 3.5.2 (default, Jun 29 2016, 13:43:58)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import dlib
Traceback (most recent call last):
File "", line 1, in
ImportError: dynamic module does not define module export function (PyInit_dlib)

@bamos

This comment has been minimized.

Collaborator

bamos commented Jul 4, 2016

Hi @wodubayo - I'm not sure what's causing that. You can try using our Docker image that has everything pre-installed.

-Brandon.

@eashanadhikarla

This comment has been minimized.

eashanadhikarla commented Aug 23, 2016

Hi Brandon,

I am using Docker's for my OSX to implement Demo 1 & 2, but when i use compare.py for getting the L2 distance on my database images copied into openface/demo/images/examples , it shows me an error. (unable to load the image)

Also, I want to use compare.py for an application which can keep a track on students when giving online exams from home. So need some brief steps from you to proceed with it.

Thankyou in advance.

@Tejeshwarabm

This comment has been minimized.

Tejeshwarabm commented Jun 13, 2017

ImportError: dlib

import dlib
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/dlib/init.py", line 1, in
from .dlib import *
ImportError: libboost_python.so.1.59.0: cannot open shared object file: No such file or directory

I have followed all the steps according to the manual, but still facing some issues
Please do some needful

@Hannabrahman

This comment has been minimized.

Hannabrahman commented Feb 14, 2018

Hello,

I am trying to follow your guide on OpenCV install,
I tries this command in build folder: cmake --build . --config Release
and I am getting this error: gmake: *** No targets specified and no makefile found. Stop.

I appreciate your help, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment