Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlsec installation is getting failed on windows. #263

Open
fahedm opened this issue Sep 12, 2023 · 11 comments
Open

xmlsec installation is getting failed on windows. #263

fahedm opened this issue Sep 12, 2023 · 11 comments

Comments

@fahedm
Copy link

fahedm commented Sep 12, 2023

Hi,

I'm on Windows Machine with Python 3.11
I don't want to downgrad python as other packages are dependent on it.
I'm trying to install python3-saml, it has dependency of xmlsec. This package is giving me issues while installation.

Building wheels for collected packages: xmlsec
Building wheel for xmlsec (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for xmlsec (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-311
creating build\lib.win-amd64-cpython-311\xmlsec
copying src\xmlsec\py.typed -> build\lib.win-amd64-cpython-311\xmlsec
copying src\xmlsec\constants.pyi -> build\lib.win-amd64-cpython-311\xmlsec
copying src\xmlsec\template.pyi -> build\lib.win-amd64-cpython-311\xmlsec
copying src\xmlsec\tree.pyi -> build\lib.win-amd64-cpython-311\xmlsec
copying src\xmlsec_init_.pyi -> build\lib.win-amd64-cpython-311\xmlsec
running build_ext
starting static build on win32
Lib sources in: C:\Users\css148300\Desktop\OfficeProjects\DevHub\gsso-devhub-be\python-xmlsec\libs
Retrieving "https://github.com/bgaifullin/libxml2-win-binaries/releases/download/v2018.08/libxml2-2.9.4.win64.zip" to "libs\libxml2-2.9.4.win64.zip"
Retrieving "https://github.com/bgaifullin/libxml2-win-binaries/releases/download/v2018.08/libxslt-1.1.29.win64.zip" to "libs\libxslt-1.1.29.win64.zip"
Retrieving "https://github.com/bgaifullin/libxml2-win-binaries/releases/download/v2018.08/zlib-1.2.8.win64.zip" to "libs\zlib-1.2.8.win64.zip"
Retrieving "https://github.com/bgaifullin/libxml2-win-binaries/releases/download/v2018.08/iconv-1.14.win64.zip" to "libs\iconv-1.14.win64.zip"
Retrieving "https://github.com/bgaifullin/libxml2-win-binaries/releases/download/v2018.08/openssl-1.0.1.win64.zip" to "libs\openssl-1.0.1.win64.zip"
Retrieving "https://github.com/bgaifullin/libxml2-win-binaries/releases/download/v2018.08/xmlsec-1.2.24.win64.zip" to "libs\xmlsec-1.2.24.win64.zip"
building 'xmlsec' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects

I have build tools installed. I read numerous articles and tried every workaround but still no solution to this.
I have tried in WSL as well, but same kind of issue.
I have tried on Mac, there it was giving issue, but with help of #254 (comment) , I was able to resolve the issue on Mac.

do we have any solution/workaround for windows system?

@APouzi
Copy link

APouzi commented Sep 19, 2023

I am stuck around this area too. I do believe that the windows C++ stuff is a red herring.
My error is around building wheels, I remember I had another project in my work place that I had to figure out how to get this working within docker and my solution at the time was literally to just get Python to an older version. Not really a solution, but at the same time we had to get this working. I also had to get some other packages installed myself to see if this worked.
Hoping someone has a solution to this

`.....
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects
`

@fahedm
Copy link
Author

fahedm commented Sep 19, 2023

For Windows. there is a work around with WSL

I installed Ubuntu 22.04 on WSL and tried installing xmlsec there. But again same kind of issue.

Installed brew in Ubuntu, and followed the same workaround as written in #254 (comment)

Now, I could install xmlsec.

Hopefully, in new version these issues with different platforms will be taken care.

Detailed Medium Article for this issue on windows

@bain2236
Copy link

I'm currently trying to ugprade from python 3.10 to 3.11 and this is blocking me, is there any update since this was opened?

@ghost
Copy link

ghost commented Jan 7, 2024

For people who want to build their own wheel for 3.11 and 3.12 on Windows.

Pre-req

  1. PowerShell v7.4x
  2. Python Development Toolkit (installed via Visual Studio Installer if using VS 2022)

You can do the following in Powershell (v7.4x)
Install-Module -Name Pscx -AllowPreRelease
git clone --recursive -j8 https://github.com/mhils/libxml2-win-binaries.git
cd libxmls2-win-binaries
Edit build.ps1 with Text Editor
Change line "140" to "2022" on line 15 so it looks like $vsver = If($vs2008) { "90" } Else { "2022" }
cd libiconv\MSVC14\libiconv_static
Edit libiconv_static.vcxproj with Text Editor
Replace v140 with v143
go back to the main libxmls2-win-binaries
Run .\build.ps1
This will create generate a dist folder with all the libs in zip.

git clone https://github.com/xmlsec/python-xmlsec.git
cd python-xmlsec
create a folder named "libs"
copy iconv-1.14.win64.zip from the dist folder from libxml2-win-binaries folder into the libs folder
For 3.11 Run "py -3.11 setup.py bdist_wheel
For 3.12 Run "py -3.12 setup.py bdist_wheel

The wheel file will be in the dist folder.

Hope this helps

I'm hoping @hoefling or someone who has merge priveleges can make these generate a new release for 3.11 and 3.12

@hegeteus
Copy link

hegeteus commented Jan 23, 2024

@tkbaca I can't get your solution to work.

C:...\libxml2-win-binaries\libiconv\MSVC14\libiconv.sln.metaproj : error MSB4126: The speci
fied solution configuration "Release|x86" is invalid. Please specify a valid solution configuration using the Configura
tion and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave thos
e properties blank to use the default solution configuration. [C:...\libxml2-win-binaries\l
ibiconv\MSVC14\libiconv.sln]

@ghost
Copy link

ghost commented Jan 23, 2024

@hegeteus Try running the build with Run .\build.ps1 /x64

@hegeteus
Copy link

hegeteus commented Jan 24, 2024

@tkbaca Thanks for the quick reply and help with the issue.

That didn't work for me so I bruteforced the build.ps1 to only accept X64 and now it works...

$x64Dir = "\x64"
$distname = If($x64) { "win64" } Else { "win32" }
If($vs2008) { $distname = "vs2008.$distname" }
$vcvarsarch = "amd64"
$vsver = If($vs2008) { "90" } Else { "2022" }

This isn't a familiar environment for me (obviously), so maybe I screwed up while installing or configuring something with VS or the PowerShell. Gonna try building the wheel tomorrow though, but at least the zip files now seem to be in place as described in dist folder!

@mymy47
Copy link

mymy47 commented Feb 7, 2024

I uploaded here for Python 3.12:

https://github.com/mymy47/python-builds-for-windows/releases

@mxamin
Copy link
Collaborator

mxamin commented Apr 18, 2024

Can you try it with the new release 1.3.14? We also provided wheels for windows OS.

@ghost
Copy link

ghost commented Apr 25, 2024

This works for window i can confirm.

@tomtom94
Copy link

tomtom94 commented May 24, 2024

I am getting the error me too

PS C:\Users\u1180188\Code\mvp-launch-tracker\back> pip install kerberos==1.3.1
Collecting kerberos==1.3.1
  Downloading kerberos-1.3.1.tar.gz (19 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: kerberos
  Building wheel for kerberos (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [74 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'kerberos' extension
      creating build
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\u1180188\AppData\Local\Programs\Python\Python311\include -IC:\Users\u1180188\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcsrc/base64.c /Fobuild\temp.win-amd64-cpython-311\Release\src/base64.obj 'krb5-config' is not recognized as an internal or external command, operable program or batch file.
      cl : Command line warning D9024 : unrecognized source file type ''krb5-config'', object file assumed
      cl : Command line warning D9027 : source file ''krb5-config'' ignored
      cl : Command line warning D9024 : unrecognized source file type 'is', object file assumed
      cl : Command line warning D9027 : source file 'is' ignored
      cl : Command line warning D9024 : unrecognized source file type 'not', object file assumed
      cl : Command line warning D9027 : source file 'not' ignored
      cl : Command line warning D9024 : unrecognized source file type 'recognized', object file assumed
      cl : Command line warning D9027 : source file 'recognized' ignored
      cl : Command line warning D9024 : unrecognized source file type 'as', object file assumed
      cl : Command line warning D9027 : source file 'as' ignored
      cl : Command line warning D9024 : unrecognized source file type 'an', object file assumed
      cl : Command line warning D9027 : source file 'an' ignored
      cl : Command line warning D9024 : unrecognized source file type 'internal', object file assumed
      cl : Command line warning D9027 : source file 'internal' ignored
      cl : Command line warning D9024 : unrecognized source file type 'or', object file assumed
      cl : Command line warning D9027 : source file 'or' ignored
      cl : Command line warning D9024 : unrecognized source file type 'external', object file assumed
      cl : Command line warning D9027 : source file 'external' ignored
      cl : Command line warning D9024 : unrecognized source file type 'command,', object file assumed
      cl : Command line warning D9027 : source file 'command,' ignored
      cl : Command line warning D9024 : unrecognized source file type 'operable', object file assumed
      cl : Command line warning D9027 : source file 'operable' ignored
      cl : Command line warning D9024 : unrecognized source file type 'program', object file assumed
      cl : Command line warning D9027 : source file 'program' ignored
      cl : Command line warning D9024 : unrecognized source file type 'or', object file assumed
      cl : Command line warning D9027 : source file 'or' ignored
      cl : Command line warning D9024 : unrecognized source file type 'batch', object file assumed
      cl : Command line warning D9027 : source file 'batch' ignored
      cl : Command line warning D9024 : unrecognized source file type 'file.', object file assumed
      cl : Command line warning D9027 : source file 'file.' ignored
      base64.c
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\u1180188\AppData\Local\Programs\Python\Python311\include -IC:\Users\u1180188\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcsrc/kerberos.c /Fobuild\temp.win-amd64-cpython-311\Release\src/kerberos.obj 'krb5-config' is not recognized as an internal or external command, operable program or batch file.
      cl : Command line warning D9024 : unrecognized source file type ''krb5-config'', object file assumed
      cl : Command line warning D9027 : source file ''krb5-config'' ignored
      cl : Command line warning D9024 : unrecognized source file type 'is', object file assumed
      cl : Command line warning D9027 : source file 'is' ignored
      cl : Command line warning D9024 : unrecognized source file type 'not', object file assumed
      cl : Command line warning D9027 : source file 'not' ignored
      cl : Command line warning D9024 : unrecognized source file type 'recognized', object file assumed
      cl : Command line warning D9027 : source file 'recognized' ignored
      cl : Command line warning D9024 : unrecognized source file type 'as', object file assumed
      cl : Command line warning D9027 : source file 'as' ignored
      cl : Command line warning D9024 : unrecognized source file type 'an', object file assumed
      cl : Command line warning D9027 : source file 'an' ignored
      cl : Command line warning D9024 : unrecognized source file type 'internal', object file assumed
      cl : Command line warning D9027 : source file 'internal' ignored
      cl : Command line warning D9024 : unrecognized source file type 'or', object file assumed
      cl : Command line warning D9027 : source file 'or' ignored
      cl : Command line warning D9024 : unrecognized source file type 'external', object file assumed
      cl : Command line warning D9027 : source file 'external' ignored
      cl : Command line warning D9024 : unrecognized source file type 'command,', object file assumed
      cl : Command line warning D9027 : source file 'command,' ignored
      cl : Command line warning D9024 : unrecognized source file type 'operable', object file assumed
      cl : Command line warning D9027 : source file 'operable' ignored
      cl : Command line warning D9024 : unrecognized source file type 'program', object file assumed
      cl : Command line warning D9027 : source file 'program' ignored
      cl : Command line warning D9024 : unrecognized source file type 'or', object file assumed
      cl : Command line warning D9027 : source file 'or' ignored
      cl : Command line warning D9024 : unrecognized source file type 'batch', object file assumed
      cl : Command line warning D9027 : source file 'batch' ignored
      cl : Command line warning D9024 : unrecognized source file type 'file.', object file assumed
      cl : Command line warning D9027 : source file 'file.' ignored
      kerberos.c
      C:\Users\u1180188\AppData\Local\Temp\pip-install-bntlbqno\kerberos_22ad382f28bd451ebc0272cfa210dd0a\src\kerberosbasic.h(17): fatal error C1083: Cannot open include file: 'gssapi/gssapi.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for kerberos
  Running setup.py clean for kerberos
Failed to build kerberos
ERROR: Could not build wheels for kerberos, which is required to install pyproject.toml-based projects
PS C:\Users\u1180188\Code\mvp-launch-tracker\back> python --version
Python 3.11.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants