jurplel / install-qt-action

Install Qt on your Github Actions workflows with just one simple action
MIT License
464 stars 82 forks source link

failure on Ubuntu 18.04, ModuleNotFoundError: No module named 'setuptools' #163

Closed bhaller closed 2 years ago

bhaller commented 2 years ago

Hi! I'm pretty clueless about Python, GitHub Actions, etc. I've got a project that uses install-qt-action; it has been working nicely for months, using @v2 (but this issue is for @v3, read on), and then that recently stopped working on macos-10.15 with this error (log: https://github.com/MesserLab/SLiM/runs/8253692308?check_suite_focus=true):

python3 -m pip install py7zr==0.16.1
Collecting py7zr==0.16.1
  Downloading py7zr-0.16.1-py3-none-any.whl (65 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.7/65.7 kB 1.5 MB/s eta 0:00:00
Collecting texttable
  Downloading texttable-1.6.4-py2.py3-none-any.whl (10 kB)
Collecting pyzstd<0.15.0,>=0.14.4
  Downloading pyzstd-0.14.4.tar.gz (659 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 659.7/659.7 kB 22.0 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting bcj-cffi<0.6.0,>=0.5.1
  Downloading bcj-cffi-0.5.1.tar.gz (35 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
  WARNING: Requested bcj-cffi<0.6.0,>=0.5.1 from https://files.pythonhosted.org/packages/97/9c/681442a5b3a5bb3a1210a8ddc6cc6f6a47ea90834b80daa15af767b1c29a/bcj-cffi-0.5.1.tar.gz (from py7zr==0.16.1), but installing version 0.0.0
Discarding https://files.pythonhosted.org/packages/97/9c/681442a5b3a5bb3a1210a8ddc6cc6f6a47ea90834b80daa15af767b1c29a/bcj-cffi-0.5.1.tar.gz (from https://pypi.org/simple/bcj-cffi/): Requested bcj-cffi<0.6.0,>=0.5.1 from https://files.pythonhosted.org/packages/97/9c/681442a5b3a5bb3a1210a8ddc6cc6f6a47ea90834b80daa15af767b1c29a/bcj-cffi-0.5.1.tar.gz (from py7zr==0.16.1) has inconsistent version: filename has '0.5.1', but metadata has '0.0.0'
ERROR: Could not find a version that satisfies the requirement bcj-cffi<0.6.0,>=0.5.1 (from py7zr) (from versions: 0.3.1, 0.4.0, 0.5.0, 0.5.1)
ERROR: No matching distribution found for bcj-cffi<0.6.0,>=0.5.1
Error: The process 'python3' failed with exit code 1

After a bit of head-scratching I realized that @v3 had been released so I updated my tests.yml to that. Unfortunately, that now gives a different error, now on ubuntu-18.04 (log: https://github.com/MesserLab/SLiM/runs/8254237001?check_suite_focus=true):

/usr/bin/python3 -m pip install setuptools wheel py7zr==0.19.* aqtinstall==2.1.*
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/b0/3a/88b210db68e56854d0bcf4b38e165e03be377e13907746f825790f3df5bf/setuptools-59.6.0-py3-none-any.whl (952kB)
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl
Collecting py7zr==0.19.*
  Downloading https://files.pythonhosted.org/packages/a2/4e/4e09d932374a0a9ced425cf438aabf385ee1dfb1157d0c8cf4de3f35babf/py7zr-0.19.0-py3-none-any.whl (65kB)
Collecting aqtinstall==2.1.*
  Downloading https://files.pythonhosted.org/packages/b8/42/dacb97cbaa19189f9595f056f67de6073b533a47359d4d4bd10ea96be5e0/aqtinstall-2.1.0-py2.py3-none-any.whl (53kB)
Collecting pyzstd>=0.14.4 (from py7zr==0.19.*)
  Downloading https://files.pythonhosted.org/packages/dc/1a/bea7694b0364981e807afe7b21639f47e559ee181b02cee11ceb3fe551b6/pyzstd-0.15.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (377kB)
Collecting pybcj>=0.6.0 (from py7zr==0.19.*)
  Downloading https://files.pythonhosted.org/packages/26/ff/25952179fa892e7d082a34e5917d747d05a227ba3c83dd3adac1c3f0be24/pybcj-1.0.1.tar.gz (2.1MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'

I have no idea what any of this means, but it looks like @v3 is in some way unhappy on ubuntu-18.04. My next stab in the dark will be to conditionally use either @v2 or @v3 depending upon the platform, if I can figure out the syntax for doing that. :-> But this seemed like possibly an issue worth reporting; or more likely, you can at least tell me what I'm doing wrong. Thanks.

jurplel commented 2 years ago

Why do you have setup-python set to false? I am thinking that might cause the issue

bhaller commented 2 years ago

Why do you have setup-python set to false? I am thinking that might cause the issue

Well, I am not sure – somebody else initially set up the GitHub workflow script for me, and I'm still trying to understand all the details of it. It's at https://github.com/MesserLab/SLiM/blob/master/.github/workflows/tests.yml by the way. I think perhaps Python gets set up previously somehow? It worked fine, with install-qt-action@v2, until it suddenly broke some time between 12 days ago and today.

bhaller commented 2 years ago

Upon further head-scratching: there are a couple of "jobs" in the YAML. The "CLI" job needs python, and installs it, and it does not need Qt so it does not run install-qt-action. That seems to be fine. The "GUI" job needs Qt so it runs install-qt-action; it doesn't need python for anything, though, so I guess it passes false for setup-python because it simply doesn't need python. That used to work with @v2. I guess it seems like with @v3, install-qt-action is failing with the above python-related error even though setup-python is false (and thus I would expect install-qt-action to simply not try to do anything pythonic at all). So my guess is that perhaps some part of install-qt-action should be checking for setup-python being false and skipping some pythonic stuff in that case; or maybe setup-python being false should simply no longer be supported, if doing pythonic stuff is now always necessary...? But I'm still struggling to understand what's going on, so I could be totally wrong about all this.

bhaller commented 2 years ago

It looks like with my latest commit to the workflow YAML, I got the CI working by using @v2 for ubuntu-18.04 and @v3 for the other platforms:

      # The jurplel/install-qt-action script @v3 seems to not work on this platform, stick for @v2 for now
      # once https://github.com/jurplel/install-qt-action/issues/163 is fixed this can probably be removed
      - name: Install Qt v2
        if: matrix.qtinstaller_v == 'v2'
        uses: jurplel/install-qt-action@v2
        with:
          version: ${{ matrix.qt }}
          setup-python: false

      - name: Install Qt v3
        if: matrix.qtinstaller_v == 'v3'
        uses: jurplel/install-qt-action@v3
        with:
          version: ${{ matrix.qt }}
          setup-python: false

So it does seem like @v3 is just failing on ubuntu-18.04 for some reason, with the settings I'm using, and reverting to @v2 on that platform fixes the problem.

jurplel commented 2 years ago

Okay, so the way it works, setup-python calls the setup-python github action to set up a known working version of python.

The software that actually installs Qt is entirely written in Python and requires a supported version of Python to run.

setup-python is most commonly used for self-hosted runners, where the setup-python github action doesn't work.

It might not be working now because v3 updated the python library's major version--it might be less accepting of old python versions? I would encourage you to just try setting it to true to see if it works.

bhaller commented 2 years ago

OK, I'll try that, hold on.

bhaller commented 2 years ago

OK, the new build with that fix has gotten past the Qt install on all platforms with @v3, I think, so all seems to be well. Thanks very much for your advice, flipping this flag would not have occurred to me for a very long time. :-> Closing.

jurplel commented 2 years ago

Glad I could help!