miurahr / aqtinstall

aqt: Another (unofficial) Qt CLI Installer on multi-platforms
https://aqtinstall.readthedocs.io/en/latest/
MIT License
915 stars 84 forks source link

Installation issue using aqt v2.2.3 and chocolatey package qt5-default #659

Closed flo-carrere closed 1 year ago

flo-carrere commented 1 year ago

Describe the bug

Since a few days, I actually noticed that my Gitlab CI pipeline is actually failing because it's not able to install qt5-default fully using chocolatey v1.3.1. This pipeline has not been modified, just rerun from a nightly job.

It might not be related to aqt directly but I have not spotted any other differences in the job output so far.

Here is a relevant (I guess) snippet from the failing pipeline:

$ choco install -y qt5-default ninja
Chocolatey v1.3.1
Installing the following packages:
qt5-default;ninja
By installing, you accept licenses for the packages.
Progress: Downloading qt5-default 5.15.2.20220508... 100%  <<<---- Still pulling the exact same version as before
Progress: Downloading aqt 2.2.3... 100%        <<<------ This is now pulling v2.2.3
Progress: Downloading mingw 8.1.0... 100%
// aqt v2.2.3 installed correctly
// Later
qt5-default v5.15.2.20220508 [Approved]
qt5-default package files install completed. Performing other installation steps.
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
Traceback (most recent call last):
  File "daa144671dcb11ed_aqt.py", line 33, in <module>
  File "daa144671dcb11ed_aqt.py", line 25, in importlib_load_entry_point
  File "importlib\metadata.py", line 86, in load
  File "importlib\__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
  File "aqt\__init__.py", line 31, in <module>
ModuleNotFoundError: No module named 'aqt.version'             <<<--------- Here it feels like there is mismatch between the version qt5 expects (or is bound to) and aqt v2.2.3 available

[2332] Failed to execute script 'daa144671dcb11ed_aqt' due to unhandled exception!   <<--- aqt installation is stopped
C:\Users\gitlab_runner\AppData\Roaming\QtProject\qtcreator
Only an exit code of non-zero will fail the package by default. Set
 `--failonstderr` if you want error messages to also fail a script. See
 `choco -h` for details.
 The install of qt5-default was successful.     <----- Still reporting the qt5-default installation as successful, while it's not!!
  Software install location not explicitly set, it could be in package or
  default install location of installer.
// Later
// Crash of my pipeline because **qmake.exe** is not found  <<---- Of course it's not installed (not even C:\Qt\5.15.2 is created)

On the other hand, a correct pipeline from few day ago:

$ choco install -y qt5-default ninja
Chocolatey v1.3.1
Installing the following packages:
qt5-default;ninja
By installing, you accept licenses for the packages.
Progress: Downloading qt5-default 5.15.2.20220508... 100%
Progress: Downloading aqt 2.1.0... 100%  <<<---- Pulling v2.1.0 was working fine
Progress: Downloading mingw 8.1.0... 100%
// later 
qt5-default v5.15.2.20220508 [Approved]
qt5-default package files install completed. Performing other installation steps.
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
aqtinstall(aqt) v2.1.0 on Python 3.9.12 [CPython MSC v.1929 64 bit (AMD64)]   <<<---- Here it feels like aqt is starting the effective installation
Downloading qtcharts...
...
// later
Finished installation of x86_64-8.1.0-release-posix-seh-rt_v6-rev0-runtime.7z in 1.25858660
Patching C:\Qt\5.15.2\mingw81_64\bin\qmake.exe      <<<------ This shows qmake will be there and can be used
Finished installation
Time elapsed: 93.31398370 second
C:\Users\gitlab_runner\AppData\Roaming\QtProject\qtcreator
Only an exit code of non-zero will fail the package by default. Set
 `--failonstderr` if you want error messages to also fail a script. See
 `choco -h` for details.
 The install of qt5-default was successful.                                   <<<------- Reporting a working qt5 successfully installed
  Software install location not explicitly set, it could be in package or
  default install location of installer.

To Reproduce Steps to reproduce the behavior:

  1. Using chocolatey v1.3.1 on Windows 10/11
  2. choco install -y qt5-default 1.1. Pulls automatically aqt v2.1.0 -> Installation is successful : OK 1.2 Pulls automatically aqt v2.2.3 -> Installation is stopped : NOK

Expected behavior I would expect qt5-default on chocolatey referencing a working aqt version (this is not the responsibility of aqt) I would expect a more recent version of aqt (v2.2.3) to be

Desktop (please complete the following information):

flo-carrere commented 1 year ago

I have implemented a workaround locally by pulling explicitly aqt v2.1.0 prior to qt5-default, this prevents qt5-default from pulling "any" aqt version (resulting currently in pull v2.2.3 that is not compliant in terms of version).

choco install -y aqt --version=2.1.0  <<--- Making aqt available
choco install -y qt5-default <<--- Here qt5-default will not pull aqt and just use the one available

It's OK as-is for me, but it is strange that qt5-default is not actually pulling a fixed version of aqt

ddalcino commented 1 year ago

I think it’s worthwhile to report this directly to the maintainers of the chocolatey packages qt-default and aqt. They will have a lot more control over this than we will.

This error:

ModuleNotFoundError: No module named 'aqt.version'

… is a thing that sometimes happens when aqt has not been packaged correctly. IIRC, there’s a setup script that generates the version.py file, and if it isn’t run, then aqt cannot run at all.

Have you tried installing aqtinstall via pip, as in the readme, or using aqt.exe from the releases page?

miurahr commented 1 year ago

@lebarsfa Any suggestions?

miurahr commented 1 year ago

choco's script looks downloading aqt.exe

It seems that the executable may be broken.

$ErrorActionPreference = 'Stop'; # stop on all errors
$toolsDir   = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$url        = 'https://github.com/miurahr/aqtinstall/releases/download/v2.2.3/aqt_x86.exe'
$url64      = 'https://github.com/miurahr/aqtinstall/releases/download/v2.2.3/aqt_x64.exe'

$packageArgs = @{
  packageName   = $env:ChocolateyPackageName
  fileFullPath  = "$toolsDir\aqt.exe"
  url           = $url
  url64bit      = $url64
  checksum      = '6C6288EEACC022DD94B83842474B42F40F17C9A3A0A013098EF914E18A6E6CF6'
  checksumType  = 'sha256'
  checksum64    = 'AEF2B202B2D1A9A60ECC2E5DEC897BD318BE58CEDF6A6EBAFDFD5EB0B26A2C69'
  checksumType64= 'sha256'
  forceDownload = $true
}

Get-ChocolateyWebFile @packageArgs
miurahr commented 1 year ago

A modification in v2.2.3 is #557 to fix windows standalone binary with work-around. I think it was uncompleted.

Because the error was reported in #564 "Trying to install it on windows I get the error: "No module named 'aqt.version'" " , and fixed in #565 "Run gravitybee with pyproject.toml " that was integrated into 3.0 (CHANGELOG)

lebarsfa commented 1 year ago

OK, I unlisted that version from Chocolatey.

It is highly possible that I never tested v2.2.3 because my initial plan was to submit v2.2.3 (as it was last v2) and immediately v3.1.2 (which I tested) but I realized that I had to wait for v2.2.3 to be manually approved by the moderators (due to virus checks false positives on Chocolatey) before submitting another version, which was done some days ago, so now we have to wait for v3.1.2 to be approved... So now that v2.2.3 is unlisted, it is v2.1.0 that normally appears as the latest, until v3.1.2 is approved. Sorry for the mess!

miurahr commented 1 year ago

I'd like to work for v2.2.4 that has a backport of the fixes.

miurahr commented 1 year ago

Just pushed the release. @flo-carrere @lebarsfa could you check and test it? https://github.com/miurahr/aqtinstall/releases/tag/v2.2.4

Now I'd like to work also on 3.0.x for security only fix.

flo-carrere commented 1 year ago

@lebarsfa I indeed verified this morning that aqt v2.1.0 is correctly pulled by default from choco when installing qt5-default.

This is solving my issue.

@miurahr Sorry I have no time to check aqt v2.2.4 and install it locally, this is not my workflow to check aqt standalone.

Thanks to all for your reactivity!

lebarsfa commented 1 year ago

I confirm v2.2.4 looks OK.