zplab / zbar-py

Simple python 2 and 3 compatible interface to the zbar barcode-reading library
MIT License
82 stars 30 forks source link

zbar-py Fails to pip install on Windows 10 #17

Open Chris45215 opened 3 years ago

Chris45215 commented 3 years ago

I've tried to install zbar-py on Windows 10, with several versions of Python (3.6, 3.7, and 3.9), but it fails each time. I have downloaded and installed the .exe's for iconv that the readme says are needed (as the link goes to exe's rather than dll's), but those did not appear to change anything and I still cannot install zbar-py. It's possible that I didn't take sufficient actions regarding the iconv files - if that's the case, then can the readme please be updated to say exactly what to do with them beyond just downloading them and running the .exe files (such as, if we're supposed to copy dll's from whatever the exe installs, it would be great if it said where to copy them from and then where to place them - because those iconv exe's and zips do not contain any DLL's).

Otherwise, when I try installing zbar-py via pip (executed in Visual Studio 2019's python 3.9 environment), or when I try to install directly from command line, this is the result:

Collecting zbar-py==1.0.4 Using cached zbar-py-1.0.4.tar.gz (543 kB) Requirement already satisfied: numpy in c:\users\chris\source\repos\pythonapplication1\pythonapplication1\python3.9env\lib\site-packages (from zbar-py==1.0.4) (1.20.1) Using legacy 'setup.py install' for zbar-py, since package 'wheel' is not installed. Installing collected packages: zbar-py Running setup.py install for zbar-py: started Running setup.py install for zbar-py: finished with status 'error' ERROR: Command errored out with exit status 1: command: 'C:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\chris\AppData\Local\Temp\pip-install-stweh31z\zbar-py_e32456a6856a4af49d10fc0d5f6b4ec6\setup.py'"'"'; file='"'"'C:\Users\chris\AppData\Local\Temp\pip-install-stweh31z\zbar-py_e32456a6856a4af49d10fc0d5f6b4ec6\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\chris\AppData\Local\Temp\pip-record-w1moyddt\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include\site\python3.9\zbar-py' cwd: C:\Users\chris\AppData\Local\Temp\pip-install-stweh31z\zbar-py_e32456a6856a4af49d10fc0d5f6b4ec6\ Complete output (60 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\zbar copying zbar\misc.py -> build\lib.win-amd64-3.9\zbar copying zbar\zbar.py -> build\lib.win-amd64-3.9\zbar copying zbar__init__.py -> build\lib.win-amd64-3.9\zbar running build_ext building 'zbar._zbar' extension creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\Source creating build\temp.win-amd64-3.9\Release\Source\zbar creating build\temp.win-amd64-3.9\Release\Source\zbar\decoder creating build\temp.win-amd64-3.9\Release\Source\zbar\qrcode creating build\temp.win-amd64-3.9\Release\zbar C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/decoder.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/decoder.obj decoder.c Source/zbar/decoder.c(88): warning C4311: 'type cast': pointer truncation from 'unsigned int ' to 'long' Source/zbar/decoder.c(88): warning C4311: 'type cast': pointer truncation from 'zbar_decoder_t ' to 'long' Source/zbar/decoder.c(387): warning C4018: '>': signed/unsigned mismatch Source/zbar/decoder.c(397): warning C4018: '<': signed/unsigned mismatch C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/decoder/code128.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/decoder/code128.obj code128.c Source/zbar/decoder/code128.c(222): warning C4018: '>': signed/unsigned mismatch Source/zbar/decoder/code128.c(222): warning C4018: '>': signed/unsigned mismatch Source/zbar/decoder/code128.c(326): warning C4018: '<': signed/unsigned mismatch Source/zbar/decoder/code128.c(349): warning C4018: '<': signed/unsigned mismatch Source/zbar/decoder/code128.c(483): warning C4018: '>': signed/unsigned mismatch C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/decoder/code39.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/decoder/code39.obj code39.c C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/decoder/ean.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/decoder/ean.obj ean.c C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/decoder/i25.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/decoder/i25.obj i25.c C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/decoder/pdf417.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/decoder/pdf417.obj pdf417.c C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/decoder/qr_finder.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/decoder/qr_finder.obj qr_finder.c C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/error.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/error.obj error.c C:\Users\chris\AppData\Local\Temp\pip-install-stweh31z\zbar-py_e32456a6856a4af49d10fc0d5f6b4ec6\Source\zbar\error.h(174): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details. Source/zbar/error.c(39): warning C4114: same type qualifier used more than once Source/zbar/error.c(127): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data Source/zbar/error.c(129): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Source/zbar/error.c(134): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data Source/zbar/error.c(137): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details. Source/zbar/error.c(139): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Source/zbar/error.c(143): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Source/zbar/error.c(147): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Source/zbar/error.c(155): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Source/zbar/error.c(157): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Source/zbar/error.c(169): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Source/zbar/error.c(176): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DENABLE_QRCODE -DENABLE_EAN -DENABLE_I25 -DENABLE_CODE39 -DENABLE_CODE128 -DENABLE_PDF417 -DHAVE_INTTYPES_H -DZBAR_VERSION_MAJOR=0 -DZBAR_VERSION_MINOR=10 -DNO_STATS -ISource -ISource/zbar -IC:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Users\chris\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /TcSource/zbar/img_scanner.c /Fobuild\temp.win-amd64-3.9\Release\Source/zbar/img_scanner.obj img_scanner.c Source/zbar/img_scanner.c(24): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe' failed with exit code 2

ERROR: Command errored out with exit status 1: 'C:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\chris\AppData\Local\Temp\pip-install-stweh31z\zbar-py_e32456a6856a4af49d10fc0d5f6b4ec6\setup.py'"'"'; file='"'"'C:\Users\chris\AppData\Local\Temp\pip-install-stweh31z\zbar-py_e32456a6856a4af49d10fc0d5f6b4ec6\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\chris\AppData\Local\Temp\pip-record-w1moyddt\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\chris\source\repos\PythonApplication1\PythonApplication1\Python3.9Env\include\site\python3.9\zbar-py' Check the logs for full command output. ----- Successfully installed 'zbar-py==1.0.4' -----

Does installation work correctly on Linux? If so, I can try to switch to a Linux OS for my project, but it would be helpful to know if the installation is likely to be successful before I embark on that time commitment.

yugal-gupta commented 3 years ago

I am also getting same error ,do u find any solution

zpincus commented 3 years ago

This should work fine on Linux. There are some hits online for bodging together a replacement unistd.h on windows, which is what looks to be the problem.

Another option would be to try a different zbar python library -- I think there are a few. I am no longer actively doing anything with this one.