alejandroautalan / pygubu

A simple GUI builder for the python tkinter module
MIT License
2.01k stars 213 forks source link

The environment of Python 3.11 is externally managed by default. #283

Open larryw3i opened 1 year ago

larryw3i commented 1 year ago

Hey! @alejandroautalan , The environment of Python 3.11 is externally managed by default, it means that the site-packages can be installed via system's packages management tool only by default. So, may both pygubu and pygubu-designer need to be uploaded to Ubuntu software sources or Debian software sources.

The error logs are following:

larry@zx:~/Downloads$ pip3 install -U pygubu pygubu-designer
error: externally-managed-environment

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

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

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.
larry@zx:~/Downloads$ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Regards, larryw3i

Aesonus commented 10 months ago

The fix for this is to use pip from a virtual environment as described in the error message:

If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed.

rdbende commented 10 months ago

The fix for this is to use pip from a virtual environment as described in the error message:

But you shouldn't have to. It's okay to manage the venv for a library or another project, but as an end user of an app it's not. Having a distro package for pygubu-designer would be great, but in the meantime we should recommend pipx (as the error message does, too), which pulls the packages from Pypi and automatically manages the venv for the application.

Aesonus commented 10 months ago

I don't see any issues with allowing the detailed error message from the operating system to instruct potential users on how to use a virtual environment to install the designer. They already need command line experience to install the software in the first place, and this only affects versions of Ubuntu that rely on Python 3.11 for critical system functions. It would be great to cover every possible install environment, but I think that goes beyond what is necessary at this point.

rdbende commented 10 months ago

I mean, even if users can follow the error message, set up a venv, and activate it before each launch, using pipx for this purpose is still much simpler. (And anyways, if users rely on the error message only, they may end up using --break-system-packages, which would be BAAD)

this only affects versions of Ubuntu that rely on Python 3.11 for critical system functions.

* Affects most Debian-based distros with Python >=3.11 installed, and AFAIK Arch has it now as well.