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 `macos-latest`: externally-managed-environment #239

Closed elB4RTO closed 5 months ago

elB4RTO commented 5 months ago

Issue still exist, see #230

Details

Fails at: /opt/homebrew/bin/python3 -m pip install setuptools wheel py7zr==0.20.*

With this error:

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.

    If you wish to install a Python library that isn't in Homebrew,
    use a virtual environment:

    python3 -m venv path/to/venv
    source path/to/venv/bin/activate
    python3 -m pip install xyz

    If you wish to install a Python application that isn't in Homebrew,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. You can install pipx with

    brew install pipx

    You may restore the old behavior of pip by passing
    the '--break-system-packages' flag to pip, or by adding
    'break-system-packages = true' to your pip.conf file. The latter
    will permanently disable this error.

    If you disable this error, we STRONGLY recommend that you additionally
    pass the '--user' flag to pip, or set 'user = true' in your pip.conf
    file. Failure to do this can result in a broken Homebrew installation.

    Read more about this behavior here: <https://peps.python.org/pep-0668/>

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Workaround

The following worked for me, but it would be nice to have everything packed into one action (if that's possible):

    - name: Install Qt6
+      if: runner.os != 'macos'
      uses: jurplel/install-qt-action@v3
      with:
        target: 'desktop'
        arch: '${{matrix.config.arch}}'
        version: '${{env.QT_VERSION}}'
        modules: 'qtcharts'
        archives: 'icu qtbase qttools qttranslations'
        tools: 'tools_ifw tools_cmake tools_qtcreator,qt.tools.qtcreator'
        install-deps: 'true'
        setup-python: 'false'

+    - name: Install Qt6
+      if: runner.os == 'macos'
+      run: |
+        brew update
+        brew install qt
jurplel commented 5 months ago

Should be resolvable with --break-system-packages (not the cleanest solution)

jurplel commented 5 months ago

Oh, I see. The issue is because you are using setup-python: 'false'. It is using a Python ostensibly installed through Homebrew.

Have you tried making the suggested change to pip.conf? It should solve this.

pzhlkj6612 commented 5 months ago

Didn't dig into this deeply, but: maybe we could setup a virtualenv (venv) for aqtinstall, regardless of the "setup-python" config?

elB4RTO commented 5 months ago

Oh, I see. The issue is because you are using setup-python: 'false'. It is using a Python ostensibly installed through Homebrew.

Have you tried making the suggested change to pip.conf? It should solve this.

Removing the setup-python: 'false' configuration solved the issue

Thanks