Open HeRo002 opened 1 month ago
In the end I had to choose Linux Mint 21.3 (which is based on Ubuntu 22.04) to make it work.
Hi,
It looks like this may be a new "feature":
pip3 install --user buildozer
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.
On my ubuntu 24.04 system, I am able to do:
sudo apt install python3.12-venv python3-pip
python3 -mvenv venv
pip3 install --user buildozer --break-system-packages
If I need to undo, this I delete the ~/.local
directory.
Then:
python3 -mvenv venv
source venv/bin/activate
I then get these errors:
$ sudo apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev
[sudo] password for jsanchez:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libncurses-dev' instead of 'libncurses5-dev'
Note, selecting 'libncurses-dev' instead of 'libncursesw5-dev'
E: Unable to locate package libtinfo5
So I tried:
sudo apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses-dev libtinfo6 cmake libffi-dev libssl-dev
which works.
~/.local/bin/buildozer init
~/.local/bin/buildozer -v android debug
This fails, so I have to:
pip install cython
which fails due to the externally manage environment
and so then I find on the web, I can do:
export PIP_BREAK_SYSTEM_PACKAGES=1
~/.local/bin/buildozer -v android debug
which looks like it is proceeding well. I'll let you know if it finishes.
Ok, it is still running. I found this concerning the future of externally managed installs: https://peps.python.org/pep-0668/
My build runs all the way through to me not having a main.py, which seems pretty good for now.
touch main.py
and rerunning is a success. I can't test it since I am a few weeks from needing to do anything with this.
This seems to be working for me, with using buildozer in a virtual environment on Ubuntu 24.04
Install System Prerequisites:
sudo apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool \
pkg-config zlib1g-dev libncurses-dev libtinfo6 cmake libffi-dev libssl-dev
Clean up:
# remove user system packages
rm -rf ~/.local
# remove existing buildozer files
rm -rf .buildozer
Initial build:
pip3 -mvenv venv
source venv/bin/activate
pip install buildozer
pip install setuptools
pip install cython
$VIRTUAL_ENV/bin/buildozer init
$VIRTUAL_ENV/bin/buildozer -v android debug
And if the build gets interrupted
rm -rf .buildozer
$VIRTUAL_ENV/bin/buildozer -v android debug
Versions
Description
First I concluded that the install instructions for Buildozer - https://buildozer.readthedocs.io/en/latest/installation.html - are not up to date (not valid) for Ubuntu 24.04 based distros, since the command "pip3 install --user --upgrade buildozer" results in "error: externally-managed-environment".
So instead I entered my venv (virtual environment) and used "pip3 install --upgrade buildozer", which installed Buildozer 1.5.0.
But then the Android specific commands (still in the venv) resulted in:
$ sudo apt update
((All packages are up to date.))
(venv-mint-22) h@hen:/mnt/xxx/mypython/venv-mint-22$ apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev
Reading package lists... Done Building dependency tree... Done Reading state information... Done Note, selecting 'libncurses-dev' instead of 'libncurses5-dev' Note, selecting 'libncurses-dev' instead of 'libncursesw5-dev' E: Unable to locate package libtinfo5
So it seems impossible to use Buildozer (and thus Kivy) on Ubuntu 24.04 based distros... Can anyone confirm this or tell me what I am doing wrong?
I am posting it here, both because I think it's a bug, and because questions on other forums (Google Kivy group and Discord Kivy Android) has led to nothing.