Failed to install zbar with pip on Windows - python

I'm trying to install zbar on my Windows x64 machine:
pip install zbar
And this is what I got:
Collecting zbar
Using cached zbar-0.10.tar.bz2
Installing collected packages: zbar
Running setup.py install for zbar ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ruiyang\\appdata\\local\\temp\\pip-build-t2okcg\\zbar\\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\ruiyang\appdata\local\temp\pip-4pohzw-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'zbar' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Users\Ruiyang\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tczbarmodule.c /Fobuild\temp.win-amd64-2.7\Release\zbarmodule.obj
zbarmodule.c
c:\users\ruiyang\appdata\local\temp\pip-build-t2okcg\zbar\zbarmodule.h(26) : fatal error C1083: Cannot open include file: 'zbar.h': No such file or directory
error: command 'C:\\Users\\Ruiyang\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ruiyang\\appdata\\local\\temp\\pip-build-t2okcg\\zbar\\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\ruiyang\appdata\local\temp\pip-4pohzw-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\ruiyang\appdata\local\temp\pip-build-t2okcg\zbar\
Anyone knows how to fix this problem?

You are trying to install zbar package with pip. When doing so, pip downloads the source and tries to compile the C/C++ source code of this project.
To do such a thing, you need a C/C++ compiler and having all dependencies. It may be complicated to have pip compiles this package.
The other solution is to download a binary wheel that embeds all binaries. zbar developers propose to download a binary wheel from their GitHub webpage
You can download this binary wheel, that targets a Windows Python 2.7 64 bit installation.
All you have to do is:
open a Windows cli with Windows+R and by running inside cmd
go to the directory where you have downloaded the whl file, with cd instructions
run pip install zbar-0.10-cp27-none-win_amd64.whl
For example, the command can be
pip install zbar-0.10-cp27-none-win_amd64.whl
If you have several Python installations, make sure to use the correct pip program.
You can do it for any package with some code that has to be compiled

Related

ERROR: Command errored out with exit status 1 while installing pyaudio

After doing pip install pyaudio, It started collecting the package but suddenly it displayed this error. Hope the following explains what's going on:
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\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\mayank\AppData\Local\Temp\pip-record-s8qn1fa4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\Include\pyaudio'
cwd: C:\Users\mayank\AppData\Local\Temp\pip-install-b1kw0ltr\pyaudio\
Complete output (15 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
copying src\pyaudio.py -> build\lib.win32-3.8
running build_ext
building '_portaudio' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\mayank\AppData\Local\Programs\Python\Python38-32\include -IC:\Users\mayank\AppData\Local\Programs\Python\Python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\include" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.8\Release\src/_portaudiomodule.obj
_portaudiomodule.c
src/_portaudiomodule.c(27): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\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\mayank\AppData\Local\Temp\pip-record-s8qn1fa4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\Include\pyaudio' Check the logs for full command output.
brew install portaudio
Then:
brew link portaudio
pip install pyAudio
Or if you are using windows:
Go to: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Download the file and then go to its directory in the cmd and type:
For win 32 bit:
pip install PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl
For win 64 bit:
pip install PyAudio‑0.2.11‑cp38‑cp38‑win_amd64.whl
For windows-
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
press ctrl + f and search pyaudio and scroll down
Download any version of this if you are using 64 bit-
PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
or download any version of this if you are using 32 bit -
PyAudio‑0.2.11‑cp39‑cp39‑win32.whl
go to the file location of the downloaded file and press Shift + Right click
select open command window here
then copy the file name and paste like pip install "file name" for e.g-
pip install PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
If you are working on Ubunutu/Linux try below.
It worked for me
sudo apt-get install portaudio19-dev
pip install pyaudio
You have to download the pyAudio file manually and put it in a directory and cd to the same directory and run the given command.
I had the same issue and fixed it using pipwin:
pip install pipwin
pipwin install pyaudio

How can I install pyodbc on Windows for use with Python 3.8?

I'm getting error on pyodbc install, i was studyng the problem and maybe its the c++ redistribute instalation problem, but even with c++ redistribute intalation updated the problem oc
Follow the error when o try to install pyodbc
C:\Users\MacInBox>pip install pyodbc
Collecting pyodbc
Using cached https://files.pythonhosted.org/packages/75/29/aa190749bac37ede0f11a68a75e7055254699c11572bd94213f1163dfd8f/pyodbc-4.0.27.tar.gz
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\macinbox\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\setup.py'"'"'; __file__='"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\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\MacInBox\AppData\Local\Temp\pip-record-fzctfb9u\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\MacInBox\AppData\Local\Temp\pip-install-ysm4ul3_\pyodbc\
Complete output (12 lines):
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.27 -Ic:\users\macinbox\appdata\local\programs\python\python38-32\include -Ic:\users\macinbox\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include" /EHsc /Tpsrc\buffer.cpp /Fobuild\temp.win32-3.8\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191
buffer.cpp
C:\Users\MacInBox\AppData\Local\Temp\pip-install-ysm4ul3_\pyodbc\src\pyodbc.h(19): fatal error C1083: NÆo ‚ poss¡vel abrir arquivo incluir: 'windows.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\macinbox\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\setup.py'"'"'; __file__='"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\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\MacInBox\AppData\Local\Temp\pip-record-fzctfb9u\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
Here are the c++ reditribute installed at my pc
Currently, pyodbc on PiPI (pyodbc 4.0.27) does not have wheel files for Python 3.8, so when you do pip install pyodbc pip will try to build pyodbc from source. You don't need C++ redistributables for that, you need a C++ compiler.
The next release of pyodbc will almost certainly have pre-compiled wheel files for Python 3.8. In the meantime you can download the required wheel file from
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc
and then install it with
pip install C:\path\to\pyodbc-4.0.27-cp38-cp38-win32.whl
Update 2020-06-30: Current versions of pyodbc now have wheels for Python 3.8.

pyaudio Library Installation Error How to fix it

When installing pyaudio in the command prompt with:
python -m pip install pyaudio
I get an error:
ERROR: Complete output from command 'C:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-c823_6j8\\pyaudio\\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\admin\AppData\Local\Temp\pip-record-vkr4rksd\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying src\pyaudio.py -> build\lib.win-amd64-3.7
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command "'C:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-c823_6j8\\pyaudio\\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\admin\AppData\Local\Temp\pip-record-vkr4rksd\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\admin\AppData\Local\Temp\pip-install-c823_6j8\pyaudio\
You can simply grab the proper Wheel package for your current Python version from here
and then install it with pip install <PyAudio‑0.2.11-...>.whl. (remember to use full filename (e.g pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl).
You don't need to download or any Microsoft Visual C++ Build Tools. Just do the following, it will be an ultimate fix:
After you go to this link: https://www.lfd.uci.edu/~gohlke/pythonlibs/ select and download the PyAudio for your Python version.
I downloaded:
PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
Place the downloaded file into the Scrips folder. My folder structure is:
`C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts`
Then you need to install the downloaded script by using the command:
python -m pip install "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl"

PocketSphinx install can't find swig.exe

I have searched all over the web and especially have gone through all the questions regarding this here on Stackoverflow.
I am using the following command to install it "pip install pocketsphinx"
I have windows x64,
I have not set any environmental paths regarding Swig.
Also I've downloaded Swig zip file and extracted it into my downloads folder, searched through it and there is no "swig.exe" file.
Below you can see the error/log from the command prompt.
C:\Users\User>pip install pocketsphinx
Collecting pocketsphinx
Using cached pocketsphinx-0.1.3.zip
Building wheels for collected packages: pocketsphinx
Running setup.py bdist_wheel for pocketsphinx ... error
Complete output from command c:\users\user\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\User\\AppData\\Local\\Temp\\pip-build-i770rcof\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\User\AppData\Local\Temp\tmpgkhbp3u1pip-wheel- --python-tag cp36:
running bdist_wheel
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
error: command 'swig.exe' failed: No such file or directory
----------------------------------------
Failed building wheel for pocketsphinx
Running setup.py clean for pocketsphinx
Failed to build pocketsphinx
Installing collected packages: pocketsphinx
Running setup.py install for pocketsphinx ... error
Complete output from command c:\users\user\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\User\\AppData\\Local\\Temp\\pip-build-i770rcof\\pocketsphinx\\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\User\AppData\Local\Temp\pip-s5wxsxzb-record\install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
error: command 'swig.exe' failed: No such file or directory
Any assistance is highly appreciated,
thanks in advance!
Alright, I solved it. Here’s how:
First I went to their official website and downloaded the swigwin file specifically for windows with a “swig.exe” file.
Then I extracted it, and added it to the environment variable PATH. This solved my problem.
Afterwards I got another error, it couldn’t find visual studio C++ build tools v14.0 (along these lines), if you have this problem too just, download the C++ build tools 2015 from their official website, install, then find it in your Program Files or what ever, copy the path to the VC folder and add it to your environment variable PATH as well.
This allowed me to download/install pocketsphinx on windows.
First run your IDE or CMD as Administrator and run the following:
pip install pipwin
pipwin install pocketsphinx
If you just want to install pocketsphinx on windows, then you can install binary of pocketsphinx. The binaries suited to your system can be found here
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pocketsphinx
Chose right binary for your system and then you can install it using following command
python -m pip install pocketsphinx‑downloaded_wheel.whl

Python 3 pyOpenGL install problems

So I'm attempting to install pyOpenGL to work on some projects and gain a deeper understanding of python stuff..But I'm coming into contact with the error I posted here. To me it seems like a folder hierarchy issue but I suck at fixing those. I tried updating setuptools and installing the openGL context separate but to no avail...I have Python 3 downloaded directly into my c: drive because my python 2.7 was in appdata and was annoying to work with...But now I'm thinking my pip install is referring to that because it looks like that in my error..
But..I have no clue..
Any help would be appreciated thanks.
Complete output from command c:\python3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\KODY~1.DES\AppData\Local\Temp\pip-build-do61jv87\pyOpenGL-accelerate\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\KODY~1.DES\AppData\Local\Temp\pip-sgf63oun-record\install-record.txt --single-version-externally-managed --compile:
Unable to import numpy, skipping numpy extension building
running install
running build
running build_py
creating build
creating build\lib.win32-3.5
creating build\lib.win32-3.5\OpenGL_accelerate
copying .\setup.py -> build\lib.win32-3.5\OpenGL_accelerate
copying .__init__.py -> build\lib.win32-3.5\OpenGL_accelerate
running build_ext
building 'OpenGL_accelerate.wrapper' extension
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
creating build\temp.win32-3.5\Release\src
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\KODY~1.DES\AppData\Local\Temp\pip-build-do61jv87\pyOpenGL-accelerate.. -IC:\Users\KODY~1.DES\AppData\Local\Temp\pip-build-do61jv87\pyOpenGL-accelerate\src -IC:\Users\KODY~1.DES\AppData\Local\Temp\pip-build-do61jv87\pyOpenGL-accelerate -Ic:\python3\include -Ic:\python3\include /Tcsrc\wrapper.c /Fobuild\temp.win32-3.5\Release\src\wrapper.obj
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
Command "c:\python3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\KODY~1.DES\AppData\Local\Temp\pip-build-do61jv87\pyOpenGL-accelerate\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\KODY~1.DES\AppData\Local\Temp\pip-sgf63oun-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\KODY~1.DES\AppData\Local\Temp\pip-build-do61jv87\pyOpenGL-accelerate\
I had the same issue make sure you have the latest version of Microsoft Visual C++ before installing PyOpenGL_accelerate
https://visualstudio.microsoft.com/downloads/

Categories

Resources