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

Not possible to install Buildozer on Ubuntu 24.04 based distros #1859

Closed
HeRo002 opened this issue Oct 7, 2024 · 8 comments
Closed

Not possible to install Buildozer on Ubuntu 24.04 based distros #1859

HeRo002 opened this issue Oct 7, 2024 · 8 comments
Labels

Comments

@HeRo002
Copy link

HeRo002 commented Oct 7, 2024

Versions

  • Python: 3.12.3
  • OS: Linux Mint 22 Cinnamon 6.2.9
  • Buildozer: 1.5.0

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.

@HeRo002
Copy link
Author

HeRo002 commented Oct 12, 2024

In the end I had to choose Linux Mint 21.3 (which is based on Ubuntu 22.04) to make it work.

@tcaduser
Copy link

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.

@tcaduser
Copy link

Ok, it is still running. I found this concerning the future of externally managed installs:
https://peps.python.org/pep-0668/

@tcaduser
Copy link

My build runs all the way through to me not having a main.py, which seems pretty good for now.

@tcaduser
Copy link

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.

@tcaduser
Copy link

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

Copy link

github-actions bot commented Dec 6, 2024

👋 @HeRo002,
Sorry to hear you are having difficulties with Kivy's Buildozer; Kivy unites a number of different technologies, so building apps can be temperamental.
We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to Buildozer. This issue has been closed, because it doesn't describe a bug or new feature request for Buildozer.
There is a mailing list and a Discord channel to support Kivy users debugging their own systems, which should be able to help. They are linked in the ReadMe.
Of course, if it turns out you have stumbled over a bug in Buildozer, we do want to hear about it here. The support channels should be able to help you craft an appropriate bug report.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2024
@Wanxp
Copy link

Wanxp commented Dec 17, 2024

rm -rf ~/.local

becareful use rm -rf ~/.local it will make your system wrong. Because of most user application install this path, such as JetBrains application Idea、PyCharm and so on..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants