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

Failure on macos-latest: externally-managed-environment #239

Closed
elB4RTO opened this issue May 6, 2024 · 4 comments
Closed

Failure on macos-latest: externally-managed-environment #239

elB4RTO opened this issue May 6, 2024 · 4 comments

Comments

@elB4RTO
Copy link

elB4RTO commented May 6, 2024

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
Copy link
Owner

jurplel commented May 6, 2024

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

@jurplel
Copy link
Owner

jurplel commented May 7, 2024

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
Copy link
Contributor

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

@elB4RTO
Copy link
Author

elB4RTO commented May 7, 2024

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

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