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

KeyError when installing Qt 5.12.3 linux desktop #221

Closed
samfrances opened this issue Feb 24, 2021 · 5 comments
Closed

KeyError when installing Qt 5.12.3 linux desktop #221

samfrances opened this issue Feb 24, 2021 · 5 comments

Comments

@samfrances
Copy link

I'm getting the following error, which just started happening today, on multiple machines and using the last 3 versions of aqtinstall.

$ aqt install -O ~/Qt 5.12.3 linux desktop
Traceback (most recent call last):
  File "/home/sam/tempenv/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 "/home/sam/tempenv/bin/aqt", line 10, in <module>
    sys.exit(main())
  File "/home/sam/tempenv/lib/python3.7/site-packages/aqt/__init__.py", line 38, in main
    return cli.run()
  File "/home/sam/tempenv/lib/python3.7/site-packages/aqt/installer.py", line 475, in run
    return args.func(args)
  File "/home/sam/tempenv/lib/python3.7/site-packages/aqt/installer.py", line 214, in run_install
    self._run_common_part(output_dir, base)
  File "/home/sam/tempenv/lib/python3.7/site-packages/aqt/installer.py", line 157, in _run_common_part
    self.show_aqt_version()
  File "/home/sam/tempenv/lib/python3.7/site-packages/aqt/installer.py", line 362, in show_aqt_version
    module_name = dist.entry_points[0].name
  File "/home/sam/tempenv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 172, in __getitem__
    raise KeyError(name)
KeyError: 0

Any help much appreciated.

@samfrances samfrances changed the title KeyError when installing Qt 1.12.3 linux desktop KeyError when installing Qt 5.12.3 linux desktop Feb 24, 2021
@pestophagous
Copy link

Issue #222 is the same. Sorry for opening a dupe. I literally noticed this at about the same time (several hours ago), and I checked for open bugs, found none. Then I was researching it on and off for a couple hours before opening my issue. I didn't refresh the issues list during that time, so I missed the fact that your ticket appeared.

Anyway we're in the (proverbial) same boat.

I wrote a "hack-around" that you might find useful:

sudo sed -i "s/        module_name = dist.entry_points\[0\]\.name/        module_name = 'HACKED'/" /usr/local/lib/python3.6/dist-packages/aqt/installer.py

Although your path would be /home/sam/tempenv/lib/python3.7/site-packages/aqt/installer.py

@pestophagous
Copy link

I'm going to paste my other content here and close my duplicate issue.

@pestophagous
Copy link

Fatal uncaught exception "aqt/installer.py", line 362, in show_aqt_version. Related: python3.6/dist-packages/importlib_metadata

module_name = dist.entry_points[0].name

I'm not confident to say whether or not this is a bug in aqtinstall or not.

Other possibilities:

  • something wrong with py 3.6 importlib_metadata
  • something wrong with the packaging or dist-info or "entry_points.txt" that pip downloads

This started failing for me "out of nowhere." It was working in one CI job, then the next time I ran the same job (with no changes to my code or build scripts), this failure happened.

I have a way to replicate it using Docker (see below).

This is the error:

        + python3 -m aqt install --base http://mirrors.ocf.berkeley.edu/qt/ --outputdir /opt/atlassian/pipelines/agent/build/dl_third_party/Qt_desktop 5.15.0 linux desktop --archives icu qtbase qtconnectivity qtdeclarative qtgraphicaleffects qtimageformats qtquickcontrols qtquickcontrols2 qtsvg qttools
        Traceback (most recent call last):
          File "/usr/local/lib/python3.6/dist-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 "/usr/local/lib/python3.6/dist-packages/aqt/__main__.py", line 27, in <module>
            sys.exit(main())
          File "/usr/local/lib/python3.6/dist-packages/aqt/__init__.py", line 38, in main
            return cli.run()
          File "/usr/local/lib/python3.6/dist-packages/aqt/installer.py", line 475, in run
            return args.func(args)
          File "/usr/local/lib/python3.6/dist-packages/aqt/installer.py", line 214, in run_install
            self._run_common_part(output_dir, base)
          File "/usr/local/lib/python3.6/dist-packages/aqt/installer.py", line 157, in _run_common_part
            self.show_aqt_version()
          File "/usr/local/lib/python3.6/dist-packages/aqt/installer.py", line 362, in show_aqt_version
            module_name = dist.entry_points[0].name
          File "/usr/local/lib/python3.6/dist-packages/importlib_metadata/__init__.py", line 172, in __getitem__
            raise KeyError(name)
        KeyError: 0

Here is a docker file that will reproduce the failure:

FROM ubuntu:18.04

RUN apt-get update

RUN apt-get --assume-yes install  python3
RUN apt-get --assume-yes install  python3-pip

RUN pip3 install -Iv aqtinstall==1.1.2

RUN python3 -m aqt install --base  --outputdir /tmp/Qt 5.15.0 linux desktop --archives icu qtbase qtconnectivity qtdeclarative qtgraphicaleffects qtimageformats qtquickcontrols qtquickcontrols2 qtsvg qttools

Versioning clue?? If you simply replace this:

FROM ubuntu:18.04

With this:

FROM ubuntu:20.04

And re-run docker build, then you can see it succeeds on Ubuntu 20.

@pestophagous
Copy link

Possibly related: python/importlib_metadata#278

@pestophagous
Copy link

If I do this, then I can once again run aqt as before:

pip3 uninstall importlib_metadata
pip3 install -Iv importlib_metadata==3.5.0

The entry_points uncaught exception reappears if I use importlib_metadata==3.6.0 or importlib_metadata==3.7.0

miurahr added a commit that referenced this issue Feb 25, 2021
Fixed
-----

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

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
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

2 participants