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

Installation of Qt 5.15.2 on macOS fails with python exception KeyError(name) #85

Closed
dalboris opened this issue Feb 24, 2021 · 11 comments
Closed

Comments

@dalboris
Copy link

dalboris commented Feb 24, 2021

First of all, thanks for developing and maintaining this action!

The action was working perfectly up to yesterday, but I just did another commit today and the action is now failing, see the job here:

https://github.com/vgc/vgc/runs/1972493790

python3 -m aqt install 5.15.2 mac desktop -O /Users/runner/work/vgc/Qt
Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 170, in __getitem__
    return next(iter(self.select(name=name)))
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aqt/__main__.py", line 28, in <module>
    sys.exit(main())
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aqt/__init__.py", line 38, in main
    return cli.run()
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aqt/installer.py", line 433, in run
    return args.func(args)
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aqt/installer.py", line 186, in run_install
    self._run_common_part(output_dir, base)
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aqt/installer.py", line 145, in _run_common_part
    self.show_aqt_version()
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/aqt/installer.py", line 323, in show_aqt_version
    module_name = dist.entry_points[0].name
  File "/Users/runner/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 172, in __getitem__
    raise KeyError(name)
KeyError: 0
Error: The process 'python3' failed with exit code 1

Not sure what's wrong, I haven't tried investigating yet what the problem is, just reporting here.

Here is the workflow Yaml file that I use:

https://github.com/vgc/vgc/blob/master/.github/workflows/macosbuild.yml

Relevant subset:

name: macOS Build

on: [push, pull_request]

env:
  BUILD_TYPE: Release
  QT_VERSION: 5.15.2

jobs:
  build:
    runs-on: macos-10.15

    steps:

    [...]

    - name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
        version: ${{env.QT_VERSION}}
        setup-python: false

    [...]

Perhaps I need to set setup-python to true, I don't remember why I have explicitly set it up to false (perhaps it was too slow?).

@dalboris
Copy link
Author

Alright, I fixed the problem.

The reason I had disabled install-qt-action > setup-python is that my build requires to use a specific version of Python, in this case Python 3.7. So I am in fact explicitly setting the version of Python in one of the steps, here was the relevant YAML:

    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.7'
        architecture: 'x64'

    - name: Install python packages
      shell: bash
      working-directory: ${{runner.workspace}}
      run:
        pip3 install dmgbuild

    - name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
        version: ${{env.QT_VERSION}}
        setup-python: false

If I used setup-python: true in the above YAML, then install-qt-action would override Python from 3.7 to 3.9, causing build errors later on because the dmgbuild package (installed by pip 3.7) wasn't found. This is why I used setup-python: false, which worked until today.

But since today it seems that using Python 3.7 breaks the installation of Qt. The solution is simply to install Qt first with setup-python: true (which sets Python to version 3.9), and only then manually setup Python to 3.7 and install pip dependencies:

    - name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
        version: ${{env.QT_VERSION}}
        setup-python: true

    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.7'
        architecture: 'x64'

    - name: Install python packages
      shell: bash
      working-directory: ${{runner.workspace}}
      run:
        pip3 install dmgbuild

@jurplel
Copy link
Owner

jurplel commented Feb 24, 2021

Oh that's interesting, I wonder why now python 3.7 doesn't work? aqtinstall is meant to work with python 3.6 and higher. Well I'm glad you got it fixed regardless.

@akiyosi
Copy link

akiyosi commented Feb 25, 2021

Hi
I'm facing the same problem with Linux targets.
And setup-python: false was not effective.
Are there the other workarounds?

  Downloading https://files.pythonhosted.org/packages/23/fc/8a49991f7905261f9ca9df5aa9b58363c3c821ce3e7f671895442b7100f2/urllib3-1.26.3-py2.py3-none-any.whl (137kB)
Installing collected packages: pycryptodome, texttable, zipp, typing-extensions, importlib-metadata, py7zr, pyparsing, packaging, idna, certifi, chardet, urllib3, requests, wheel, aqtinstall
Successfully installed aqtinstall-0.9.7 certifi-2020.12.5 chardet-4.0.0 idna-2.10 importlib-metadata-3.7.0 packaging-20.9 py7zr-0.10.1 pycryptodome-3.10.1 pyparsing-2.4.7 requests-2.25.1 texttable-1.6.3 typing-extensions-3.7.4.3 urllib3-1.26.3 wheel-0.36.2 zipp-3.4.0
python3 -m aqt install 5.13.0 linux desktop -m qtcharts qtdatavis3d qtpurchasing qtvirtualkeyboard qtwebengine qtnetworkauth qtwebglplugin qtscript -O /home/runner/work/goneovim/goneovim/Qt -b http://mirrors.ocf.berkeley.edu/qt/
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 170, in __getitem__
    return next(iter(self.select(name=name)))
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/runner/.local/lib/python3.6/site-packages/aqt/__main__.py", line 28, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.6/site-packages/aqt/__init__.py", line 38, in main
    return cli.run()
  File "/home/runner/.local/lib/python3.6/site-packages/aqt/cli.py", line 352, in run
    return args.func(args)
  File "/home/runner/.local/lib/python3.6/site-packages/aqt/cli.py", line 142, in run_install
    self._run_common_part(output_dir, mirror)
  File "/home/runner/.local/lib/python3.6/site-packages/aqt/cli.py", line 123, in _run_common_part
    self.show_aqt_version()
  File "/home/runner/.local/lib/python3.6/site-packages/aqt/cli.py", line 245, in show_aqt_version
    module_name = dist.entry_points[0].name
  File "/home/runner/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 172, in __getitem__
    raise KeyError(name)
KeyError: 0
Error: The process 'python3' failed with exit code 1

@dalboris
Copy link
Author

Hi @akiyosi , you should actually try with setup-python: true, have you tried that? Here, aqtinstall is using Python 3.6, and by using setup-python: true it should bump the Python version and perhaps fix the problem.

If the rest of your build does depend on Python 3.6, you can roll it back to this version after the Qt Install step, like this:

    - name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
        version: ${{env.QT_VERSION}}
        setup-python: true

    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.6'
        architecture: 'x64'

@dalboris
Copy link
Author

Relevant: https://github.com/miurahr/aqtinstall/releases/tag/v1.1.3

This is a new release of aqtinstall released 4 hours ago with the following changelog:

Fixed
-----

* Key error on 3.6.13, 3.7.10, 3.8.8, and 3.9.2(#221)

@dalboris dalboris reopened this Feb 25, 2021
@dalboris
Copy link
Author

In light of this new info, I'm reopening this issue. I think the proper course of action would be for install-qt-action to set the default aqtversion to v1.1.3.

In the meantime, @akiyosi and others, you could try something like that:

- name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
        version: '5.15.2'
        setup-python: true
        aqtversion: '>=1.1.3'

@dalboris
Copy link
Author

Also see: miurahr/aqtinstall#221

@jurplel
Copy link
Owner

jurplel commented Feb 25, 2021

Will update aqtinstall asap

@jurplel
Copy link
Owner

jurplel commented Feb 25, 2021

done

@dalboris
Copy link
Author

Thanks! I closed the issue, I suppose anyone should feel free to reopen if there are still issues about this.

@akiyosi
Copy link

akiyosi commented Feb 26, 2021

@dalboris @jurplel
Thanks :D

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