genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System
Apache License 2.0
501 stars 86 forks source link

genicam package for python 3.11 #386

Closed jack77er closed 1 year ago

jack77er commented 1 year ago

I know it is not really an harvesters bug, but I could not find any wheels or sources for the genicam 1.2.0 package for python 3.11 on windows. Is there any source or precompiled wheel available?

Thanks in advance

MathijsNL commented 1 year ago

You can download the .whl file from pypi.

https://pypi.org/project/genicam/#files

Extract the latest version (.whl is just a .zip) and edit the METADATA file so it includes version 3.11:

Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11

Zip the files and rename to .whl and install with:

pip install genicam-1.2.0-cp311-cp311-manylinux1_x86_64.whl

I do not recommend this method, if I would have to choose I would just use Python 3.10.

I did test it and the wheel for Genicam installed just fine, and I can import the harvester library and create a Harvester object. Other than that I did not test it.

jack77er commented 1 year ago

Thanks for your response. Thats what I've tried, but the library is linked against the corresponding python library (python3xx.dll), in this case 3.10 as the last available:

 PS C:\Dev\Python3_11\Lib\site-packages\genicam> dlldiag.exe trace .\_genapi.pyd
DLL Diagnostic Tools version 0.0.18
Copyright (c) 2019-2021 Adam Rehn

Parsing module header and identifying non delay-loaded dependencies... done.

Identifying the module's delay-loaded dependencies... done.

Parsed module details:
Module:          C:\Dev\Python3_11\Lib\site-packages\genicam\_genapi.pyd
Type:            Dynamic-Link Library
Architecture:    x64

The module imports 10 direct dependencies:
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
GCBase_MD_VC141_v3_4.dll
GenApi_MD_VC141_v3_4.dll
KERNEL32.dll
MSVCP140.dll
python310.dll
VCRUNTIME140.dll
...

When tying to load the module I've got the error

Traceback (most recent call last):
  File "M:\Software\GUI\main.py", line 22, in <module>
    from genicam.genapi import NodeMap
  File "C:\Dev\Python3_11\Lib\site-packages\genicam\genapi.py", line 44, in <module>
    from . import _genapi
ImportError: DLL load failed while importing _genapi: Das angegebene Modul wurde nicht gefunden.

Process finished with exit code 1

Even when I try to cheat and copy the python310.dll into the package folder I've got a version mismatch error.

MathijsNL commented 1 year ago

I see you are trying to get it working under Windows. I used Linux to test and it worked without any errors.

Is there a specific reason you need this to work on Python 3.11?

kazunarikudo commented 1 year ago

Hi guys, Python 3.11 will be supported by the next release in early 2023; we as the committee are working on it now, and the ARM64 binary should be bundled with it. By the way, I do not mind if you play the altered binaries but I would never bring up such an untrusty entity into the business. So scary. ;-)