Kalmat / PyWinCtl

Cross-Platform module to get info on and control windows on screen
Other
179 stars 19 forks source link

error: externally-managed-environment when installing in Ubuntu 23.04 #62

Closed RobRobM closed 1 year ago

RobRobM commented 1 year ago

I cannot get PyWinCtl installed with any of the options in the installation guide. With all I get the following error:

× 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.

Kalmat commented 1 year ago

Hi!

It seems to me that you are using the built-in python installation. so the distribution is implementing a deliberate policy to ensure you don't break your operating system and system packages by installing custom packages. I think the solution is either installing your own Python version (e.g. 3.10), or (as suggested by the error message), create a virtual environment. The easiest, if you are not used to manage virtual environments, is the first one, by executing this on a terminal:

sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10

Let me know if this works for you.