matplotlib with buildozer

339 views
Skip to first unread message

ISABEL MARIA MORENO CUADRADO

unread,
Sep 7, 2023, 4:17:32 AM9/7/23
to Kivy users support
Please, can someone tell me how I can do for using matplotlib in an app built with buildozer. Because I have this error
Edit mplsetup.cfg to change the build options; suppress output with --quiet.

BUILDING MATPLOTLIB
      python: yes [3.10.10 (main, Sep  6 2023, 19:06:53) [GCC 9.4.0]]
    platform: yes [linux]
       tests: no  [skipping due to configuration]
      macosx: no  [Mac OS-X only]

WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
running build_ext
error: Failed to download any of the following: ['http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz'].  Please download one of these urls and extract it into 'build/' at the top-level of the source repository.

berk berk

unread,
Sep 7, 2023, 11:14:56 AM9/7/23
to Kivy users support
I'm using matplotlib in my app. did you try these:
 requirements =... matplotlib, pillow
in buildozer.spec file?
Actually pillow need for kivymd requirements, but matplotlib also use pillow(but mayne not need put in requirements) 

7 Eylül 2023 Perşembe tarihinde saat 11:17:32 UTC+3 itibarıyla e.is...@go.ugr.es şunları yazdı:

ISABEL MARIA MORENO CUADRADO

unread,
Sep 7, 2023, 1:09:42 PM9/7/23
to Kivy users support
But do you have something more?
I mean an specfic configuration or something?

Juan Sanchez

unread,
Sep 7, 2023, 1:18:12 PM9/7/23
to kivy-...@googlegroups.com
Please see if the url in the error message can be downloaded.

error: Failed to download any of the following:
['http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz']. Please
download one of these urls and extract it into 'build/' at the
top-level of the source repository.

Maybe the server was temporarily down?

Regards,

Juan
> --
> You received this message because you are subscribed to the Google Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/0f99934b-b765-4949-9a5a-47da0cfe7379n%40googlegroups.com.

ISABEL MARIA MORENO CUADRADO

unread,
Sep 7, 2023, 1:19:57 PM9/7/23
to Kivy users support
Can someone send me a small project using matplotlib to see if everything it's right

ISABEL MARIA MORENO CUADRADO

unread,
Sep 7, 2023, 1:55:30 PM9/7/23
to Kivy users support
My app crash, this is the  logcat
09-07 19:54:25.583  8206  8247 I python  :  ImportError: dlopen failed: cannot locate symbol "_ZTVSt9bad_alloc" referenced by "/data/data/org.test.myapp/files/app/_python_bundle/site-packages/matplotlib/_path.so"...
09-07 19:54:25.583  8206  8247 I python  : Python for android ended.
09-07 19:54:25.617   583   583 I SurfaceFlinger: screenshot (org.test.myapp/org.kivy.android.PythonActivity#0)
09-07 19:54:25.617   583   583 I SurfaceFlinger: isIncludeStatusBarAndNavBar (1)
09-07 19:54:25.624  1544  1544 D NavBarTintController: onSampleCollected 0.0
09-07 19:54:25.652  2811  4964 I CarrierServices: [143] faf.handleMessage: RcsEngineImpl[DUAL_REG]:[6dc0d0c4-b2b3]>Handler: handleMessage processing message:[NOTIFY_UPTIME_IGNORE_STATE_CHANGED] with [non-null]:RcsEngineImpl reference

Robert

unread,
Sep 7, 2023, 2:15:47 PM9/7/23
to Kivy users support
This about matplotlib , not  garden.matplotlib correct?
https://github.com/Android-for-Python/Android-for-Python-Users#kivy-garden

I just tried
requirements = python3,kivy,matplotlib
everything else default.
Builds OK


> Because I have this error
> Edit mplsetup.cfg to change the build options; suppress output with --quiet.

I'm not certain what that means, but if it means you had to edit some config file - something else is wrong.
A check, did you follow the Buildozer install instructions?

If the build was hacked, I don't know if the crash is meaningful.

Juan Sanchez

unread,
Sep 7, 2023, 11:20:00 PM9/7/23
to kivy-...@googlegroups.com
Hi,

$ echo _ZTVSt9bad_alloc | c++filt
vtable for std::bad_alloc

matplotlib requires a c++ runtime library.

Does anyone know how to get the c++ runtime included in the build?

Regards,

Juan

On Thu, Sep 7, 2023 at 12:55 PM ISABEL MARIA MORENO CUADRADO
> To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/4583afd5-a5b8-46f1-8034-84addc1e9ce1n%40googlegroups.com.

Robert

unread,
Sep 8, 2023, 12:19:17 AM9/8/23
to Kivy users support
The c++ library is included automatically. The default builds and runs just fine.

There is presumably some pilot error there, but it is impossible to guess....

Try creating a SMALL example that plots a few points, use the default buildozer.spec with matplotlib added
Try it on the desktop first.

ISABEL MARIA MORENO CUADRADO

unread,
Sep 8, 2023, 5:39:32 AM9/8/23
to Kivy users support
Please does anyone know why?

Juan Sanchez

unread,
Sep 8, 2023, 8:40:08 AM9/8/23
to kivy-...@googlegroups.com
Hi,

The c++ runtime is not included by default. It appears that
matplotlib is a C++ recipe, and that should magically tell the build
system to include the C++ runtime. I can only guess that this might
be a bug in the build system, or something went wrong when you were
building the components.

Regards,

Juan

On Fri, Sep 8, 2023 at 4:39 AM ISABEL MARIA MORENO CUADRADO
> To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/3d51b562-e0e6-492b-b0c8-7126b7d77327n%40googlegroups.com.

Robert

unread,
Sep 8, 2023, 12:44:30 PM9/8/23
to Kivy users support
I am unable to replicate the issue.

I understood that you have a build issue, then it was reported as a run time issue
Not clear to me that I understand how the build issue was addressed.
Generally its best to focus on the first issue.

Usually magic is just reason we don't understand.


To test I used, but note that this depends on a local copy of garden.matplotlib


from garden_matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
import matplotlib.pyplot as plt

plt.plot([1, 23, 2, 4])
plt.ylabel('some numbers')

class MyApp(App):

    def build(self):
        box = BoxLayout()
        box.add_widget(FigureCanvasKivyAgg(plt.gcf()))
        return box

MyApp().run()

ISABEL MARIA MORENO CUADRADO

unread,
Sep 11, 2023, 4:14:58 AM9/11/23
to Kivy users support
The thing is that my application crash, and the error of 09-07 19:54:25.583  8206  8247 I python  :  ImportError: dlopen failed: cannot locate symbol "_ZTVSt9bad_alloc" referenced by "/data/data/org.test.myapp/files/app/_python_bundle/site-packages/matplotlib/_path.so"... appear

So can someone tell me the exactly steps follow to get an application that use matplotlib on the phone properly?

ISABEL MARIA MORENO CUADRADO

unread,
Sep 11, 2023, 4:18:52 AM9/11/23
to Kivy users support
I have read that a solution could be remove ccache from linux.
How can I remove ccache from linux ? Because if I say sudo apt-get remove ccache, the building of the application is not possible since it doesn't find "ccache"

El viernes, 8 de septiembre de 2023 a las 18:44:30 UTC+2, Robert escribió:

Robert

unread,
Sep 11, 2023, 12:51:09 PM9/11/23
to Kivy users support
Nobody can guess, as as I said I can't replicate the issue.

Create a small example (about the same size as mine) that illustrates the issue.
Reply all
Reply to author
Forward
0 new messages