bensondaled/pseyepy

Error: Segmentation fault

Opened this issue · 12 comments

When eye camera is plug out execute Camera() returns:

>>> Camera()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pseyepy/cameras.pyx", line 218, in pseyepy.cameras.Camera.__init__
ValueError: need more than 0 values to unpack

same condition execute Camera(0):

>>> Camera(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pseyepy/cameras.pyx", line 249, in pseyepy.cameras.Camera.__init__
Exception: No camera available at index 0.
Available cameras: 0

and that is ok, but when i plug ps3 camera in, and try execute Camera(0) the result is:

>>> Camera(0)
Segmentation fault
>>> Camera()
Segmentation fault

Here are my installation logs: https://pastebin.com/y3Amzhqv

Can you help me to solve this problem?

Python 3.6.5

Which OS are you on?

Currently, I am using Deepin, its Debian (Unstable) based distro.

Do you have another OS you can test with? May be useful to determine whether it's an installation vs OS vs hardware issue. macOS would be ideal, or if not, possibly an ubuntu

Firstly I tried on windows, but I stuck with an error at installation. At this time I don't have a chance to test on another os.

LINK : warning LNK4044: unrecognized option '/std=c++11'; ignored
LINK : warning LNK4044: unrecognized option '/stdlib=libc++'; ignored
Creating library build\temp.win-amd64-3.7\Release\pseyepy\cameras.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\pseyepy\cameras.cp37-win_amd64.exp
libusb-1.0.lib(core.obj) : error LNK2001: unresolved external symbol __imp__iob
libusb-1.0.lib(windows_winusb.obj) : error LNK2001: unresolved external symbol __imp_sprintf
libusb-1.0.lib(windows_winusb.obj) : error LNK2001: unresolved external symbol __imp_sscanf
build\lib.win-amd64-3.7\pseyepy\cameras.cp37-win_amd64.pyd : fatal error LNK1120: 3 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\link.exe' failed with exit status 1120

Firstly I tried on windows, but I stuck with an error at installation. At this time I don't have a chance to test on another os.

LINK : warning LNK4044: unrecognized option '/std=c++11'; ignored
LINK : warning LNK4044: unrecognized option '/stdlib=libc++'; ignored
Creating library build\temp.win-amd64-3.7\Release\pseyepy\cameras.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\pseyepy\cameras.cp37-win_amd64.exp
libusb-1.0.lib(core.obj) : error LNK2001: unresolved external symbol __imp__iob
libusb-1.0.lib(windows_winusb.obj) : error LNK2001: unresolved external symbol __imp_sprintf
libusb-1.0.lib(windows_winusb.obj) : error LNK2001: unresolved external symbol __imp_sscanf
build\lib.win-amd64-3.7\pseyepy\cameras.cp37-win_amd64.pyd : fatal error LNK1120: 3 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\link.exe' failed with exit status 1120

I have a solution for your an installation error. Try to download the newest libusb, copy files from MS64/dll to pseyepy/ext/lib and overwrite it. But now I have problem with
from .cameras import Camera, cam_count ImportError: DLL load failed:

But now I have problem with
from .cameras import Camera, cam_count ImportError: DLL load failed:

I had the same problem, copying .dll files from libusb folder to pseyepy module folder (in python files on hdd) worked for me. However, I used MS32 files.

@ProximaB did you ever fix this issue? I'm getting the same problem

@christophergeek Unfortunately I didn't. I go for OpenCv because I used only one camera for the project anyway.

@bensondaled Here is a MVC example:

from pseyepy import Camera


def main():
    # initialize all connected cameras
    c = Camera([0, 1], fps=50, colour=True, resolution=Camera.RES_LARGE)


if __name__ == '__main__':
    main()

However, at line 251 in cameras.pyx it will fall over:

success = ps3eye_open(_id, self._w[idx], self._h[idx], fps[idx], self._format[idx])

Giving this error in PyCharm:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

or running as root from terminal:

Segmentation fault

The 2 cameras are definitely plugged in and recognized by the system (I can view them using vokoscreen for example). And if I unplug them, pseyepy will throw the No camera available at index error.

I'm on Ubuntu 18.04 using Python 3.6. Previously these exact same cameras worked perfectly in Windows so it does seem to be an OS issue. I'm guessing libusb is the problem here?

Yes my best guess is a libusb issue. You'll see in setup.py that I have it automatically installing a fresh libusb for *nix systems, because this seemed to work most consistently on the machines I could test on. However, it may be worth trying a separate custom install of various different libusb's since that seems the most likely issue. Then you'd just want to update libusb_incl, libusb_libpath, and libs in setup.py before trying to install again. Unfortunately I don't have one of the cams available to test with at the moment.

@sokol07 @Zonced Hi I've been getting the same error after installation. Could you be more specific as to what files did you move to fix it? Did you copy the dll file in MS64 to the libusb folder in site-packages?

If somebody is still searching for a solution to the segmentation problem, install pseyepy from this branch instead: https://github.com/iRonJ/pseyepy
Worked for me