File msvc_recommended_pragmas.h missing while installing PyGObject via pip - python

I tried to install PyGObject via pip and it fails with given error:
Building wheels for collected packages: pygobject
Building wheel for pygobject (PEP 517) ... error
ERROR: Command errored out with exit status 1:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPY_SSIZE_T_CLEAN -IC:\Users\James\AppData\Local\Temp\pip-install-deoh1xpv\pygobject_2e13db219b124bfd8bf7a88e47dc19a5 -IC:\Users\James\AppData\Local\Temp\pip-install-deoh1xpv\pygobject_2e13db219b124bfd8bf7a88e47dc19a5\gi -IC:\Program Files\Python39\include -IC:\Program Files\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include -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 /Tcgi\gimodule.c /Fobuild\temp.win-amd64-3.9\Release\gi\gimodule.obj -FImsvc_recommended_pragmas.h
gimodule.c
gi\gimodule.c: fatal error C1083: Cannot open include file: 'msvc_recommended_pragmas.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual
Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pygobject
I had another attempt with python -m pip install pygobject --no-use-517 and it still fails with error:
Building wheels for collected packages: pygobject
Building wheel for pygobject (setup.py) ... error
ERROR: Command errored out with exit status 1:
gimodule.c
gi\gimodule.c: fatal error C1083: Cannot open include file: 'msvc_recommended_pragmas.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pygobject
Running setup.py clean for pygobject
Failed to build pygobject
Installing collected packages: pygobject
Running setup.py install for pygobject ... error
ERROR: Command errored out with exit status 1:
gimodule.c
gi\gimodule.c: fatal error C1083: Cannot open include file: 'msvc_recommended_pragmas.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1:
'C:\Program Files\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\James\\AppData\\Local\\Temp\\pip-install-x0ki7wgt\\pygobject_0af3e48dd4b543de8f83ff716124e468\\setup.py'"'"'; __file__='"'"'C:\\Users\\James\\AppData\\Local\\Temp\\pip-install-x0ki7wgt\\pygobject_0af3e48dd4b543de8f83ff716124e468\\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\James\AppData\Local\Temp\pip-record-andppe11\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files\Python39\Include\pygobject' Check the logs for full command output.
It seems like all fails is due to a missing file msvc_recommended_pragmas.h. This leaves me with no clue of what I may have missed. All runtime dependencies involved (python3.9, pip, MSYS2, C++ Build Tools from Visual Studio) have been upgraded to the latest version FYI.

gvsbuild provides a method to compile GTK in Windows. The latest instructions can be found in the README at https://github.com/wingtk/gvsbuild. Once you install the dependencies, it will work something like this:
mkdir C:\gtk-build\github
cd C:\gtk-build\github
git clone C:\github.com\wingtk\gvsbuild
python -m venv .venv
.\.venv\Scripts\activate.ps1
pip install .
gvsbuild build --enable-gi --py-wheel gobject-introspection gtk3 pycairo pygobject
Once that builds, you can switch to your project you are trying to use PyGObject for and activate the virtualenv. Then install the wheels you created above:
Get-ChildItem C:\gtk-build\build\x64\release\*\dist\*.whl | ForEach-Object -process { poetry run pip install $_ }

Related

"c1xx: fatal error C1083: Cannot open source file: 'cld3/pycld3.cpp': No such file or directory" when installing pycld3 with pip

I am trying to install cld3 with pip on Python 3.9. I have successfully installed protoc and also got the C++ build tools with Visual Studio, however when I run py -m pip install -U pycld3 it fails with a few messages. I am on windows 10 running Python 3.9
It initially fails to build using wheel:
Collecting pycld3
Using cached pycld3-0.21.tar.gz (652 kB)
Building wheels for collected packages: pycld3
Building wheel for pycld3 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\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\Charlie\AppData\Local\Temp\pip-wheel-_9ez3o7a'
cwd: C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\
Complete output (23 lines):
running bdist_wheel
running build
Creating dirs at C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/
This is not surprising as it mentions in the docs that wheel installation is not supported for my OS. However I really do not understand what happens next:
Running protoc sentence.proto feature_extractor.proto task_spec.proto --cpp_out=C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\cld3
copying cld3\__init__.py -> build\lib.win-amd64-3.9\cld3
running build_ext
building 'cld3._cld3' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\cld3
creating build\temp.win-amd64-3.9\Release\src
creating build\temp.win-amd64-3.9\Release\src\cld_3
creating build\temp.win-amd64-3.9\Release\src\cld_3\protos
creating build\temp.win-amd64-3.9\Release\src\script_span
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/ -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include -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 /EHsc /Tpcld3/pycld3.cpp /Fobuild\temp.win-amd64-3.9\Release\cld3/pycld3.obj -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
pycld3.cpp
c1xx: fatal error C1083: Cannot open source file: 'cld3/pycld3.cpp': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pycld3
Running setup.py clean for pycld3
Failed to build pycld3
Installing collected packages: pycld3
Running setup.py install for pycld3 ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\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\Charlie\AppData\Local\Temp\pip-record-fkxpsotm\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\Include\pycld3'
cwd: C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\
Complete output (22 lines):
running install
running build
Running protoc sentence.proto feature_extractor.proto task_spec.proto --cpp_out=C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\cld3
copying cld3\__init__.py -> build\lib.win-amd64-3.9\cld3
running build_ext
building 'cld3._cld3' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\cld3
creating build\temp.win-amd64-3.9\Release\src
creating build\temp.win-amd64-3.9\Release\src\cld_3
creating build\temp.win-amd64-3.9\Release\src\cld_3\protos
creating build\temp.win-amd64-3.9\Release\src\script_span
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/ -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include -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 /EHsc /Tpcld3/pycld3.cpp /Fobuild\temp.win-amd64-3.9\Release\cld3/pycld3.obj -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
pycld3.cpp
c1xx: fatal error C1083: Cannot open source file: 'cld3/pycld3.cpp': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\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\Charlie\AppData\Local\Temp\pip-record-fkxpsotm\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\Include\pycld3' Check the logs for full command output.
As far as I can tell it is because it cannot find "cld3/pycld3.cpp"". Do I need to run an earlier version of Python? Thanks in advance
This is a bug in pycld3: they've forgotten to include the source into sdist. Please report the bug.
Meanwhile the workaround is to install Cython:
pip install Cython
pip install pycld3
[pycld3 maintainer] This issue should be resolved in pycld3 release 0.22.
python3 -m pip install -U pycld3
As #phd points out, this was an error with the distribution upload in 0.21 that neglected to include the intermediate .cpp file. Inclusion of that file in the sdist should not be dependent on the build-time logic of whether a user has or wants to use Cython.
Note that in the 0.22 release, the installation will respect the environment variable USE_CYTHON=1. You must have an existing install of Cython to use this flag. It will force re-compilation from the source .pyx file. This follows the behavior recommended at Distributing Cython Modules.
0.22 also drops support for end-of-life Python 3.5 and no longer passes the unsupported -std=c++11 on Windows MSVC.
Detail: full changelog from 0.21 to 0.22.

Unable to install 'IfxPy' package

I am trying to install 'IfxPy' package using pip command on Git-Bash but getting below error. Tried adding wheel to. Still unable to install.
$ pip3 install ifxpy
Collecting ifxpy
Using cached IfxPy-3.0.5.tar.gz (155 kB)
Building wheels for collected packages: ifxpy
Building wheel for ifxpy (setup.py): started
Building wheel for ifxpy (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'c:\users\gsampath\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gsampath\\AppData\\Local\\Temp\\pip-install-d9wyx3hw\\ifxpy_28fd8dfdd9ff4259b237248d082433ad\\setup.py'"'"'; __file__='"'"'C:\\Users\\gsampath\\AppData\\Local\\Temp\\pip-install-d9wyx3hw\\ifxpy_28fd8dfdd9ff4259b237248d082433ad\\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\gsampath\AppData\Local\Temp\pip-wheel-3jsyuxx7
.
.
.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\gsampath\AppData\Local\Temp\pip-install-d9wyx3hw\ifxpy_28fd8dfdd9ff4259b237248d082433ad\libs /LIBPATH:C:CSDK\lib /LIBPATH:c:\users\gsampath\appdata\local\programs\python\python38-32\libs /LIBPATH:c:\users\gsampath\appdata\local\programs\python\python38-32\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86" iclit09b.lib /EXPORT:PyInit_IfxPy build\temp.win32-3.8\Release\ifxpyc.obj /OUT:build\lib.win32-3.8\IfxPy.cp38-win32.pyd /IMPLIB:build\temp.win32-3.8\Release\IfxPy.cp38-win32.lib
LINK : fatal error LNK1181: cannot open input file 'iclit09b.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\link.exe' failed with exit status 1181
It seems that no wheel is available for this package and it has an underlying dependency, hence pip will try to build it in your system.
I searched the missing lib in the Installation and got the following entry:
IBM iclit09b.lib reference
You may found other ways of installing it, but you first need the low level library prior to installing the Python wrapper around it.

Python: "pip install gmpy" on Windows 10 returns "cl.exe' failed with exit status 2"

I've installed Pyhton 3.7 on Windows10 and when I run pip install gmpy the console return me this error:
Collecting gmpy
Using cached https://files.pythonhosted.org/packages/26/37/2184c13cee81e1dbeaebbb13570195247e73ab2138a3db0c9d2c5347e372/gmpy-1.17.zip
Building wheels for collected packages: gmpy
Building wheel for gmpy (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\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\franc\AppData\Local\Temp\pip-wheel-nz4_kuat' --python-tag cp37
cwd: C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\
Complete output (12 lines):
running bdist_wheel
running build
running build_ext
building 'gmpy' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\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" /Tcsrc/gmpy.c /Fobuild\temp.win-amd64-3.7\Release\src/gmpy.obj
gmpy.c
C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\src\gmpy.h(30): fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for gmpy
Running setup.py clean for gmpy
Failed to build gmpy
Installing collected packages: gmpy
Running setup.py install for gmpy ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\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\franc\AppData\Local\Temp\pip-record-q7ltkyyx\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\
Complete output (12 lines):
running install
running build
running build_ext
building 'gmpy' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\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" /Tcsrc/gmpy.c /Fobuild\temp.win-amd64-3.7\Release\src/gmpy.obj
gmpy.c
C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\src\gmpy.h(30): fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\franc\\AppData\\Local\\Temp\\pip-install-du1j9u7s\\gmpy\\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\franc\AppData\Local\Temp\pip-record-q7ltkyyx\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
The error is in this line:
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
Basically it means that Python needs cl.exe and it expect it at:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x64
No problem, I go to the Environment Variable and i add that path both for my user and for the system:
Then I check if cl.exe is successfully in the path by typing cl in the terminal and it works:
But when I run again pip install gmpy I have the same error.
EDIT: I also tried with pip install gmpy2 and I receive the same error.
Where am I wrong?
Well the actual problem is that you are missing some header file gmp.h:
C:\Users\franc\AppData\Local\Temp\pip-install-du1j9u7s\gmpy\src\gmpy.h(30): fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
I suggest you try gmpy2, which is a newer version. It has wheels for Windows on PyPI but they are for older versions of Python unfortunately. Pre-built wheels for more recent Python versions are available here. The files are named after the Python version (e.g. cp37 for CPython 3.7) and architecture (e.g. amd64 for 64-bit)
A wheel can be installed like so:
pip install gmpy2‑2.0.8‑cp37‑cp37m‑win_amd64.whl

Getting error while installing pyaudio in windows 10

I am a beginner in python language. I have written a test function in python for converting speech-to-text :
def getAudioFromMicrophone():
r = sr.Recognizer()
with sr.Microphone() as source:
lets_talk.in_female_voice('I am ready for your next command')
r.pause_threshold=1
r.adjust_for_ambient_noise(source,duration=1)
return r.listen(source)
When I run it, it says :
File "D:/PycharmProjects/python-modules/jarvis/jarvis.py", line 5,
in
import pyaudio ModuleNotFoundError: No module named 'pyaudio'
So, I am trying to install pyaudio in my windows 10 which is again showing an error.
Collecting pyaudio Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz Installing collected packages: pyaudio Running setup.py install for pyaudio: started
Running setup.py install for pyaudio: finished with status 'error'
Complete output from command D:\softwares\python-compiler\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pycharm-packaging\\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\username\AppData\Local\Temp\pip-record-9qmland0\install-record.txt
--single-version-externally-managed --compile:
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
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1
-ID:\softwares\python-compiler\include -ID:\softwares\python-compiler\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
_portaudiomodule.c
d:\softwares\python-compiler\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Command "D:\softwares\python-compiler\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pycharm-packaging\\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\username\AppData\Local\Temp\pip-record-9qmland0\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in C:\Users\username\AppData\Local\Temp\pycharm-packaging\pyaudio\ You are using pip version 18.1, however version 19.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Any sort of help will be appreciated!
This is a problem with Python 3.7 because there isn't a PyAudio wheel for this version of Python for pip to find. To solve this, download a wheel that fits your computer's specs from here. Now, navigate to the folder the wheel was downloaded to in the command prompt and run: pip install (name of the .whl file here). This should work fine if you are on Windows and using Python 3.7.
I got this information from this post.
Try below commands to install the pyaudio on "Windows 10".
pip install pipwin
pipwin install pyaudio
Follow the steps
Step1. Download the PyAudio-0.2.11-cp310-cp310-win_amd64.whl from this link https://pypi.bartbroe.re/pyaudio
Step2. Use the following comand in cmd pip install (path to the file)/PyAudio-0.2.11-cp310-cp310-win_amd64.whl
Now it will install in my case hope this will help you too.

lxml error in python3.4 installation

I'm trying to run the following command in command prompt -
pip install -r requirements.txt
But it shows so many errors and I have no idea how to resolve them as I'm not familiar with python.
The errors are:
1.
Collecting lxml==3.5.0 (from -r requirements.txt (line 1))
Using cached lxml-3.5.0.tar.gz
Collecting pyquery==1.2.10 (from -r requirements.txt (line 2))
Collecting cssselect>0.7.9 (from pyquery==1.2.10->-r requirements.txt (line 2))
Using cached cssselect-1.0.1-py2.py3-none-any.whl
Building wheels for collected packages: lxml
Running setup.py bdist_wheel for lxml ... error
Complete output from command c:\python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Mohana\\AppData\\Local\\Temp\\pip-build-9bz1xoev\\lxml\\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\Mohana\AppData\Local\Temp\tmp425xg1fhpip-wheel- --python-tag cp34:
Building lxml version 3.5.0.
Building without Cython.
ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
** make sure the development packages of libxml2 and libxslt are installed **
2.
src\lxml\includes\etree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2
creating Users
creating Users\Mohana
creating Users\Mohana\AppData
creating Users\Mohana\AppData\Local
creating Users\Mohana\AppData\Local\Temp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /TcC:\Users\Mohana\AppData\Local\Temp\xmlXPathInitocb5oi7w.c /FoUsers\Mohana\AppData\Local\Temp\xmlXPathInitocb5oi7w.obj
xmlXPathInitocb5oi7w.c
C:\Users\Mohana\AppData\Local\Temp\xmlXPathInitocb5oi7w.c(1) : fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2
3.
Failed building wheel for lxml
Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml, cssselect, pyquery
Found existing installation: lxml 4.0.0
Uninstalling lxml-4.0.0:
Successfully uninstalled lxml-4.0.0
Running setup.py install for lxml ... error
Complete output from command c:\python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Mohana\\AppData\\Local\\Temp\\pip-build-9bz1xoev\\lxml\\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\Mohana\AppData\Local\Temp\pip-rjvm3d2l-record\install-record.txt --single-version-externally-managed --compile:
Building lxml version 3.5.0.
Building without Cython.
ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
** make sure the development packages of libxml2 and libxslt are installed **
4.
src\lxml\includes\etree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /TcC:\Users\Mohana\AppData\Local\Temp\xmlXPathInity8a5suic.c /FoUsers\Mohana\AppData\Local\Temp\xmlXPathInity8a5suic.obj
xmlXPathInity8a5suic.c
C:\Users\Mohana\AppData\Local\Temp\xmlXPathInity8a5suic.c(1) : fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\cl.exe' failed with exit status 2
Please help me solve these issues, I need it for a project and I really need to get it done. I am on Windows 10 (Intel processors) and Python3.4.
As #SaeX says in this answer, you can find the precompiled
WHL of lxml with the required modules and dependencies here.
For Python 3.4 and win10 your file should be lxml‑4.1.0‑cp34‑cp34m‑win_amd64.whl. Then you can install it by using pip:
pip install lxml‑4.1.0‑cp34‑cp34m‑win_amd64.whl
For python 3.4 or above,
In command Prompt,
type pip3 install lxml in case if you want to download and install from network automatically
otheriwse, download .whl file of lxml from the below
For 32 bit : Download Here
For 64 bit : Download Here
After downloading the wheel file,navigate your command prompt to the location where the .whl file is downloaded and then try
pip3 install "downloaded whl file name"
For windows, you can install lxml by exe file if also failed by whl. You can download it from lxml
Hope this can help you.

Categories

Resources