PIP error when trying to install Kivy: externally-managed-environment

184 views
Skip to first unread message

Henrik R.

unread,
Aug 17, 2024, 5:43:41 AM8/17/24
to Kivy users support
Hi!


I am trying to install Kivy on a new Linux Mint 22 Cinnamon partition.
I have tried these commands (and variations of it):

    :~$ python3 -m pip install --upgrade pip setuptools virtualenv --user
    :~$ python3 -m pip install --upgrade pip setuptools virtualenv

But I get this error:

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.12/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.


I don't really understand this message. Should I create a venv and do the install inside that? That does NOT seem logical to me. I want the Linux OS to always have access to Kivy.

PS: I found the following about that error, but they seem to suggest to either install in a venv or use the '--break-system-packages' flag in the pip command, which does not seem like a good idea:

I look forward to hear from you guys.

Henrik R.

unread,
Aug 18, 2024, 6:05:32 AM8/18/24
to Kivy users support
I guess this is an error in the official Kivy install instruction for Linux, so I have posted this here: 
Please respond there instead of here.
Message has been deleted

fabien

unread,
Aug 19, 2024, 2:05:59 AM8/19/24
to Kivy users support
Use pip in a virtual environment...

Henrik R.

unread,
Aug 19, 2024, 2:54:12 AM8/19/24
to Kivy users support
The point of that command in the Kivy install instructions is to update the virtualenv package BEFORE creating a virtual environment......

Henrik R.

unread,
Oct 3, 2024, 7:40:32 AM10/3/24
to Kivy users support
I need a solution to this problem!

I wonder if I am the only person in the world, who wants to install Kivy and Buildozer on an Ubuntu 24.04 ('noble') based distro (like Linux Mint 22)?
I have posted 2 issues on this:
But I have not yet gotten an answer to how to install or upgrade the virtual environment package BEFORE creating a virtual environment - as suggested by the Kivy install instructions...

Henrik R.

unread,
Oct 5, 2024, 10:52:36 AM10/5/24
to Kivy users support
Please note that I have just added the following to https://github.com/kivy/kivy/issues/8803 :

I ended up successfully installing Kivy in a virtual environment created with ".../mypython$ python3 -m venv venv-mint-22" which I think uses the 'python3-venv' package, which I THINK was already in Linux Mint 22 Cinnamon (a distro based on Ubuntu 24.04) by default...

But that does not change the fact that the Kivy install instructions do not really work for Ubuntu 24.04 based distros.

The install instructions for Buildozer - https://buildozer.readthedocs.io/en/latest/installation.html - are also not up to date:

It starts with: pip3 install --user --upgrade buildozer

Since it contains "--user" I can deduct that it should be executed outside the virtual environment, but that ALSO results in: error: externally-managed-environment

Does that mean I HAVE to install buildozer inside the virtual environment (on Ubuntu 24.04 based Linux versions)?


Henrik R.

unread,
Oct 5, 2024, 11:04:07 AM10/5/24
to Kivy users support
NOTE! I suggest you answer my question on https://github.com/kivy/kivy/issues/8803 !
Reply all
Reply to author
Forward
0 new messages