pyfly2 icon indicating copy to clipboard operation
pyfly2 copied to clipboard

Problem with pyfly2

Open lesagegp opened this issue 10 years ago • 8 comments

I installed the Point Grey SDK, MinGW (made gcc work), Cython, did python setup.py build_ext --inplace, and tried to run example_grab.py. I receive the error:

ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect...

I am not finding any explanations about this error. I did move the DLL's that you specified in to the pyfly2-master directory before running setup.

I am running Windows 7, 64 bit and trying to capture images from a Point Grey FL2G Firewire camera. Their canned program does work, so I don't have any hardware issues. I am using Python 2.7, 32 bit, and made sure to get the 32 bit SDK.

If you have any suggestions, I will appreciate the assistance.

Thanks!

lesagegp avatar Feb 13 '15 16:02 lesagegp

Can you back level your Flycapture SDK to 2.6? I've seen the same thing when I use 2.7, but I don't know why it's happening.

Sorry for the delay, BTW. I don't know why I don't always get the alert pings.

kbrafford avatar Apr 29 '15 19:04 kbrafford

I have the same issue with FlyCapture 2.8, but i cannot find any version older than 2.7 on pointGrey website. Do you have any idea where i could find an installer for 2.6?

I'm also using python 3, is this going to be a problem? the OS is Windows 7 64 bit.

Thank you very much for your library, and your time!

JohnRambouilled avatar Feb 03 '16 09:02 JohnRambouilled

John, I am so sorry for the delayed response. It looks like I need to just bite the bullet and upgrade my stuff to use the latest library. I can't give you an ETA at the moment however.

In the meantime, can you contact PointGrey and see if they can make the older installer available to you?

kbrafford avatar Feb 09 '16 07:02 kbrafford

Ok, looks like I need to do Python3 also. (just saw that part)

kbrafford avatar Feb 09 '16 07:02 kbrafford

Hi Keith. Sorry about the delay, I finally managed to get a version of FlyCapture SDK 2.6 from PG, and i now get those errors when i build PyFly2 :

running build_ext cythoning pyfly2.pyx to pyfly2.c building 'pyfly2' extension creating build creating build\temp.win-amd64-3.5 creating build\temp.win-amd64-3.5\Release C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe /c /nolo go /Ox /W3 /GL /DNDEBUG /MD -I. "-IC:/Program Files (x86)/Point Grey Research/Fl yCapture2\include" -IC:\Anaconda3\include -IC:\Anaconda3\include "-IC:\Program F iles (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Mi crosoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXS DK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x8 6)\Windows Kits\8.1\include\winrt" /Tcpyfly2.c /Fobuild\temp.win-amd64-3.5\Rele ase\pyfly2.obj pyfly2.c C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe /nolog o /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:/P rogram Files (x86)/Point Grey Research/FlyCapture2\lib/C" /LIBPATH:C:\Anaconda3
libs /LIBPATH:C:\Anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Micros oft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kit s\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\l ib\winv6.3\um\x64" FlyCapture2_Cd_v90.lib /EXPORT:PyInit_pyfly2 build\temp.win-a md64-3.5\Release\pyfly2.obj /OUT:C:\Users\Nicolas\Documents\Pyfly2\pyfly2-master \pyfly2.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\pyfly2.cp35- win_amd64.lib pyfly2.obj : warning LNK4197: exportation 'PyInit_pyfly2' spécifiée à plusieurs reprises ; première spécification utilisée Création de la bibliothèque build\temp.win-amd64-3.5\Release\pyfly2.cp35-win_ amd64.lib et de l'objet build\temp.win-amd64-3.5\Release\pyfly2.cp35-win_amd64.e xp pyfly2.obj : error LNK2001: symbole externe non résolu fc2ConvertImageTo pyfly2.obj : error LNK2001: symbole externe non résolu fc2DestroyContext pyfly2.obj : error LNK2001: symbole externe non résolu fc2SetEmbeddedImageInfo pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetCameraFromIndex pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetCameraInfo pyfly2.obj : error LNK2001: symbole externe non résolu fc2CreateContext pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetImageTimeStamp pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetLibraryVersion pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetProperty pyfly2.obj : error LNK2001: symbole externe non résolu fc2StartCapture pyfly2.obj : error LNK2001: symbole externe non résolu fc2SetVideoModeAndFrameRa te pyfly2.obj : error LNK2001: symbole externe non résolu fc2SaveImage pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetVideoModeAndFrameRa te pyfly2.obj : error LNK2001: symbole externe non résolu fc2CreateImage pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetEmbeddedImageInfo pyfly2.obj : error LNK2001: symbole externe non résolu fc2Connect pyfly2.obj : error LNK2001: symbole externe non résolu fc2RetrieveBuffer pyfly2.obj : error LNK2001: symbole externe non résolu fc2SetProperty pyfly2.obj : error LNK2001: symbole externe non résolu fc2GetNumOfCameras pyfly2.obj : error LNK2001: symbole externe non résolu fc2StopCapture C:\Users\Nicolas\Documents\Pyfly2\pyfly2-master\pyfly2.cp35-win_amd64.pyd : fata l error LNK1120: 20 externes non résolus error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN
amd64\link.exe' failed with exit status

And when I run a test file :

File "test_pyfly.py", line 2, in import pyfly2 ImportError: DLL load failed: %1 is not a valid Win32 application.

I am still using python 3, so this might be the issue!! Anyway, i think we'll find a workaround, so don't beat yourself about this.

Thank you very much for your libs anyway!

JohnRambouilled avatar Feb 24 '16 11:02 JohnRambouilled

I think I found the issue with the side-by-side error:

C:\Users\user\Downloads\pyfly2-master>python
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>> import pyfly2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect. Pease see the application event log or use the command-line sxstrace.exe tool for more detail.

Upon getting this error, I first checked Window's eventvwr.exe which showed under "Windows Logs/Application": Activation context generation failed for "c:\program files (x86)\point grey research\flycapture2\bin\FLYCAPTURE2D_V90.DLL". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.

Note the VC90.DebugCRT ...

Keith -- your setup.py file has this line: data_files=['FlyCapture2_Cd_v90.dll', 'FlyCapture2d_v90.dll', 'libiomp5md.dll']

The first two files above are the DEBUG versions of the FlyCapture dll's. Upon checking Dependency Walker, I found that these DLL's reference MSVC90D.DLL (i.e. the DEBUG version of MS CRT libraries as per the Eventvwr output), which doesn't come with the Microsoft Visual C++ 2008 Redistributable -x86 package.

To solve the problem:

  1. In setup.py replace the data_files line with: data_files=['FlyCapture2_C_v90.dll', 'FlyCapture2_v90.dll', 'libiomp5md.dll']
  2. DELETE FlyCapture2_Cd_v90.dll, 'FlyCapture2d_v90.dll and instead copy FlyCapture2_C_v90.dll and FlyCapture2_v90.dll to the pyfly2-master package directory.
  3. DELETE pyfly2.pyd
  4. Rebuild using build.bat

nortonsm avatar Apr 22 '16 20:04 nortonsm

Thank you very much nortonsm! This worked perfectly (after I managed to include the right library in the folder)! I also used your fix on the vcvarsall.bat file unfound, with Visual C++ Compiler for Python, and it works very well too (but i kind of find it annoying to SET the two variable each time you launch the shell...).

Anyway, thanks a lot to Keith for this great library (I started doing my own, then realized how much work that would be and struggle to get yours installed!), and thank you nortonsm for the fixes!

Pure curiosity, but do you have any idea how a debug library is different from a release one? Just loading some profiling and dependency tracking crap? I don't really understand why it wouldn't work on debug... Anyway, it works now for me! Great day!

JohnRambouilled avatar Sep 23 '16 15:09 JohnRambouilled

@nortonsm I did the same thing as you pointed out. But it is still not working for me. After build.bat, did you do other things?

neurochen avatar Apr 09 '17 22:04 neurochen