question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Briefcase can't install Python packages with binary modules on mobile platforms.

See original GitHub issue

Describe the bug

Briefcase is able to package any an app that has a dependency that is a pure-Python package (i.e., a package that contains only Python code).

However, if you’re targeting a mobile platform (iOS or Android), and the Python module has a binary component (i.e., it contains a C module), any attempt to import that module will fail, causing the app to crash.

Desktop platforms (macOS, Windows and Linux) are not affected by this problem.

To Reproduce Steps to reproduce the behavior:

  1. Set up a hello world application
  2. Add a package with a binary dependency (e.g., numpy or pillow) to the requires list, and add an import for that code (e.g., import numpy or import pil)
  3. Deploy the app to iOS or Android
  4. Try to run the app.

Expected behavior

The import should succeed and the app should continue to run.

Environment:

  • Operating System: iOS or Android
  • Python version: Any
  • Software versions:
    • Briefcase: Any

Additional context

This isn’t purely a Briefcase issue; pip and PyPI doesn’t currently have any support for mobile platforms.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:30 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
renefritzecommented, Jan 12, 2021

Is this limitation mentioned in the docs? I’ve run through the tutorials and only saw the “platform notice”. An explicit note would have saved me a good chunk of time 😞

1reaction
eliteraspberriescommented, Dec 7, 2021

I modified the hello world tutorial like so:

        import numpy
        label = toga.Label(
            'Hello NumPy, {}'.format(numpy.random.random()),
            style=Pack(padding=(10, 10))
        )
        main_box.add(label)

and the result:

Screenshot_20211207-101934_Hello World

Pull request incoming…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to package Python apps with BeeWare Briefcase
Take advantage of BeeWare Briefcase to make Python programs that are a ... First, Briefcase doesn't do cross-platform packaging; you need to ...
Read more >
Package Python Applications with BriefCase
briefcase run — Run the executable file for the platform. briefcase package — Post processing steps necessary to wrap the binary into an...
Read more >
Frequently Asked Questions — Briefcase documentation
Yes! Briefcase uses pip to install third-party packages into your app bundle. As long as the package is available on PyPI, or you...
Read more >
Installing Packages - Python Packaging User Guide - Python.org
This section covers the basics of how to install Python packages. ... of package that you import in your Python source code (i.e....
Read more >
Tutorial 7 - Get this (third)-party started - BeeWare
On mobile and web platforms, your options are slightly limited. In short; any pure Python package (i.e., packages that do not contain a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found