Skip to content

WinError 193 during building with Python 3.12 #2441

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

Closed
gryznar opened this issue Jan 20, 2024 · 29 comments
Closed

WinError 193 during building with Python 3.12 #2441

gryznar opened this issue Jan 20, 2024 · 29 comments

Comments

@gryznar
Copy link

gryznar commented Jan 20, 2024

Description

Building app using Python 3.12 results in crash. On Python 3.11 problem does not occur

Code example to reproduce the issue:

flet build windows

Describe the results you received:

image

Describe the results you expected:

It should work

Additional information you deem important (e.g. issue happens only occasionally):

Flet version:

0.19

Operating system:

Windows 11

@FeodorFitsner
Copy link
Contributor

Please provide the log of flet build windows -vv.

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

Output with this flag is the same as on attached screenshot

Please provide the log of flet build windows -vv.

@FeodorFitsner
Copy link
Contributor

It shouldn't be the same.

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

They ma be small differences:
image

@FeodorFitsner
Copy link
Contributor

Do you have dart.file and flutter.file files in flutter's bin directory?

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

This is the content of flutter\bin:
image

flutter and dart commands works

@FeodorFitsner
Copy link
Contributor

Do you have 32- or 64-bit version of Python installed?

python -c "import sys; print(sys. maxsize > 2**32)"

The command will return True if Python is running in 64-bit and False if it's running in 32-bit.

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

64 bit

@FeodorFitsner
Copy link
Contributor

OK, could you give the output of this command:

python -c "import shutil; print(shutil.which('flutter'))"

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

image

@FeodorFitsner
Copy link
Contributor

Thank you. Finally, what is the path returned by this:

python -c "import os; print(os.getenv('ComSpec'))"

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

C:\WINDOWS\system32\cmd.exe

I have also PowerShell 7 installed

@FeodorFitsner
Copy link
Contributor

...and can the error be reproduced with this command?

python -c "import shutil, subprocess; f = shutil.which('flutter'); subprocess.run([f, '--version'])"

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

Yeap, it could

...and can the error be reproduced with this command?

python -c "import shutil, subprocess; f = shutil.which('flutter'); subprocess.run([f, '--version'])"

@FeodorFitsner
Copy link
Contributor

What is the full path to python.exe?

...I don't know if it's easy for you to test, but I'm wondering if flet build windows works well on your system with Python 3.11?

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

C:\Users\xxx\pypoetry\Cache\virtualenvs\app-XYKQrPPX-py3.12\Scripts\python.exe (poetry)

3.11 breaks later during building:
image

These earlier stages connected with packaging works OK:
image

@FeodorFitsner
Copy link
Contributor

So, flet dependency was installed with Poetry? What is flet command location?

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

So, flet dependency was installed with Poetry? What is flet command location?

Exactly. But the same settings (poetry used for 3.11) works. flet.exe is located under:
image

@FeodorFitsner
Copy link
Contributor

OK, so it's Python 3.12 specific error. Will investigate.

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

OK, so it's Python 3.12 specific error. Will investigate.

Thank you!

@FeodorFitsner
Copy link
Contributor

Re: cmake/nuget error - try this solution: bluefireteam/audioplayers#1615 (comment)

@FeodorFitsner
Copy link
Contributor

Btw, when you paste screenshots into issue instead of text it's a) impossible to copy/paste to google - I have to retype everything by hands and b) the contents of this issue is not indexed by search engines, so other users won't find the issue/solution.

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

Oh, I see, sorry! Next time I wold provide just text

@FeodorFitsner
Copy link
Contributor

So, did you fix nuget sources?

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

So, did you fix nuget sources?

Unfortunately not. I am searching for solution

Edit: I've found it (source: Baseflow/flutter-permission-handler#819 (comment))! This was really strange. I've never used nuget before. It occurred, that my nuget.confid was messed up.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
  </packageSources>
</configuration>

<packageSources> entry hasn't include nuget.org. Changing this to:

<packageSources>
  <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>

solved the problem. But still, this is strange, that default configuration is not set properly

Edit 2: Yet another error:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: Polecenie "setlocal   
[C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: "C:\Program Files     
(x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake 
[C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 
goto :cmEnd [C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmEnd
[C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: endlocal & call       
:cmErrorLevel %errorlevel% & goto :cmDone [C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmErrorLevel
[C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: exit /b %1
[C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmDone
[C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 
goto :VCEnd [C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" zosta�o       
zako�czone przez kod 1. [C:\Users\xxx\AppData\Local\Temp\flet_flutter_build_jofoQQyxFB\build\windows\x64\INSTALL.vcxproj]
Build process failed.

@gryznar
Copy link
Author

gryznar commented Jan 20, 2024

OK, so it's Python 3.12 specific error. Will investigate.

Only Python 3.12 related. Using pip instead of poetry does not change anything

@david-shu
Copy link

david-shu commented Jan 21, 2024

This is the content of flutter\bin: image

flutter and dart commands works

flutter and flutter.bat exists together and shutil.which('flutter') return flutterwhich is not executable on windows. rename or remove file flutter and dart

@gryznar
Copy link
Author

gryznar commented Jan 21, 2024

This is the content of flutter\bin: image
flutter and dart commands works

flutter and flutter.bat exists together and shutil.which('flutter') return flutterwhich is not executable on windows. rename or remove file flutter and dart

Indeed! This was bug related only to Python 3.12.0. 3.12.1 has fixed that. Closing

@gryznar gryznar closed this as completed Jan 21, 2024
@gryznar
Copy link
Author

gryznar commented Jan 21, 2024

Unfortunatelly, this is not finish with problems in my journey, but it's a topic on another issue

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

No branches or pull requests

3 participants