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

Using Matplotlib with IOS #480

Closed
proftc opened this issue Aug 25, 2020 · 3 comments
Closed

Using Matplotlib with IOS #480

proftc opened this issue Aug 25, 2020 · 3 comments

Comments

@proftc
Copy link

proftc commented Aug 25, 2020

I have a small app based on toga_chart which runs and installs perfectly on my Mac OS 10.14.6 using briefcase.
However when I tried to create an IOS version I found theses issues - which may not be fatal? but the app doesn't run on the simulator just shows a beeware splash screen then just exit?s Here are the messages I got sorry its a long paste. Any insight much appreciated. Thanks!

(beeware-venv) IT036317:simplechart terry$ briefcase create IOS

Application simplechart already exists; overwrite [y/N]? y

[simplechart] Removing old application bundle...

[simplechart] Generating application template...
Using app template: https://github.com/beeware/briefcase-iOS-Xcode-template.git
Using existing template (sha 185a566d3a5829784d5fd5b3e0273573b3d29de4, updated Sun Jun 21 12:41:13 2020)

[simplechart] Installing support package...
Using support package https://briefcase-support.org/python?platform=iOS&version=3.8
... using most recent revision
Python-3.8-iOS-support.b3.tar.gz already downloaded
Unpacking support package...

[simplechart] Installing dependencies...
Collecting toga-iOS>=0.3.0.dev20
  Using cached toga_iOS-0.3.0.dev22-py3-none-any.whl (33 kB)
Collecting toga-chart
  Using cached toga_chart-0.1.0-py3-none-any.whl (5.5 kB)
Collecting rubicon-objc>=0.3.0
  Using cached rubicon_objc-0.4.0-py3-none-any.whl (53 kB)
Collecting toga-core==0.3.0.dev22
  Using cached toga_core-0.3.0.dev22-py3-none-any.whl (482 kB)
Collecting matplotlib>=3.0.3
  Using cached matplotlib-3.3.1-cp38-cp38-macosx_10_9_x86_64.whl (8.5 MB)
Collecting toga>=0.3.0.dev22
  Using cached toga-0.3.0.dev22-py3-none-any.whl (3.9 kB)
Collecting travertino>=0.1.3
  Using cached travertino-0.1.3-py3-none-any.whl (15 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl (60 kB)
Collecting pillow>=6.2.0
  Using cached Pillow-7.2.0-cp38-cp38-macosx_10_10_x86_64.whl (2.2 MB)
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting cycler>=0.10
  Using cached cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting numpy>=1.15
  Using cached numpy-1.19.1-cp38-cp38-macosx_10_9_x86_64.whl (15.3 MB)
Collecting python-dateutil>=2.1
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting certifi>=2020.06.20
  Using cached certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting toga-cocoa==0.3.0.dev22; sys_platform == "darwin"
  Using cached toga_cocoa-0.3.0.dev22-py3-none-any.whl (57 kB)
Collecting six
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: rubicon-objc, travertino, toga-core, toga-iOS, kiwisolver, pillow, pyparsing, six, cycler, numpy, python-dateutil, certifi, matplotlib, toga-cocoa, toga, toga-chart
Successfully installed certifi-2020.6.20 cycler-0.10.0 kiwisolver-1.2.0 matplotlib-3.3.1 numpy-1.19.1 pillow-7.2.0 pyparsing-2.4.7 python-dateutil-2.8.1 rubicon-objc-0.4.0 six-1.15.0 toga-0.3.0.dev22 toga-chart-0.1.0 toga-cocoa-0.3.0.dev22 toga-core-0.3.0.dev22 toga-iOS-0.3.0.dev22 travertino-0.1.3

[simplechart] Installing application code...
Installing src/simplechart...

[simplechart] Installing application resources...
Unable to find src/simplechart/resources/simplechart-20.png for 20px application icon; using default
Unable to find src/simplechart/resources/simplechart-29.png for 29px application icon; using default
Unable to find src/simplechart/resources/simplechart-40.png for 40px application icon; using default
Unable to find src/simplechart/resources/simplechart-58.png for 58px application icon; using default
Unable to find src/simplechart/resources/simplechart-60.png for 60px application icon; using default
Unable to find src/simplechart/resources/simplechart-76.png for 76px application icon; using default
Unable to find src/simplechart/resources/simplechart-80.png for 80px application icon; using default
Unable to find src/simplechart/resources/simplechart-87.png for 87px application icon; using default
Unable to find src/simplechart/resources/simplechart-120.png for 120px application icon; using default
Unable to find src/simplechart/resources/simplechart-152.png for 152px application icon; using default
Unable to find src/simplechart/resources/simplechart-167.png for 167px application icon; using default
Unable to find src/simplechart/resources/simplechart-180.png for 180px application icon; using default
Unable to find src/simplechart/resources/simplechart-1024.png for 1024px application icon; using default

[simplechart] Created iOS/Simple Chart
(beeware-venv) IT036317:simplechart terry$ briefcase build iOS

Select simulator device:

  1) iPad (7th generation)
  2) iPad Air (3rd generation)
  3) iPad Pro (11-inch)
  4) iPad Pro (12.9-inch) (3rd generation)
  5) iPad Pro (9.7-inch)
  6) iPhone 11
  7) iPhone 11 Pro
  8) iPhone 11 Pro Max
  9) iPhone 8
  10) iPhone 8 Plus

> 6
In future, you could specify this device by running:

    briefcase build iOS -d "iPhone 11::iOS 13.3"

or:

    briefcase build iOS -d CB3AE3A3-3BE4-458C-B605-7302E7A40968

Targeting an iPhone 11 running iOS iOS 13.3 (device UDID CB3AE3A3-3BE4-458C-B605-7302E7A40968)

[simplechart] Building XCode project...

note: Using new build system
note: Planning build
note: Constructing build description
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Simple Chart editor. (in target 'Simple Chart' from project 'Simple Chart')
Build succeeded.

[simplechart] Built iOS/Simple Chart/build/Debug-iphonesimulator/Simple Chart.app
(beeware-venv) IT036317:simplechart terry$ briefcase run iOS

Select simulator device:

  1) iPad (7th generation)
  2) iPad Air (3rd generation)
  3) iPad Pro (11-inch)
  4) iPad Pro (12.9-inch) (3rd generation)
  5) iPad Pro (9.7-inch)
  6) iPhone 11
  7) iPhone 11 Pro
  8) iPhone 11 Pro Max
  9) iPhone 8
  10) iPhone 8 Plus

> 6
In future, you could specify this device by running:

    briefcase run iOS -d "iPhone 11::iOS 13.3"

or:

    briefcase run iOS -d CB3AE3A3-3BE4-458C-B605-7302E7A40968

[simplechart] Starting app on an iPhone 11 running iOS iOS 13.3 (device UDID CB3AE3A3-3BE4-458C-B605-7302E7A40968)
Booting iPhone 11 simulator running iOS iOS 13.3...
Opening iPhone 11 simulator running iOS iOS 13.3...
[simplechart] Uninstalling old app version...
[simplechart] Installing new app version...
[simplechart] Starting app...
com.example.simplechart: 34705
@freakboy3742
Copy link
Member

Ok - so the icon warnings are just that - warnings; it's telling you that your app will, at present, have the default 'grey bee' icon.

The warning about signing permissions also isn't anything to worry about; it's something you'll need to address before you can publish an app to a physical device or the App Store, but that's a way off yet.

However: There is a problem - Matplotlib isn't a pure python library (for some reason I thought it was...).

That's going to be a problem - Briefcase can't currently package python libraries that have binary components. This is a limitation of PyPI - it doesn't currently have any representation for iOS/Android modules.

To absolutely confirm this, you can open the Xcode project that Briefcase has generated, and run the app inside Xcode. From there, you'll be able to view the logs for the running app, which should show that the app starts, but then throws an error when the code tries to import one of the matplotlib directories.

@proftc
Copy link
Author

proftc commented Aug 25, 2020

This was the xcode error it appears to be a numpy related C library -looks difficult to sort out?
Thanks

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
2020-08-25 07:44:17.049298+0100 Simple Chart[35093:1238953]
2020-08-25 07:44:17.049385+0100 Simple Chart[35093:1238953] Importing the numpy C-extensions failed. This error can happen for
2020-08-25 07:44:17.049483+0100 Simple Chart[35093:1238953] many reasons, often due to issues with your setup or how NumPy was
2020-08-25 07:44:17.049627+0100 Simple Chart[35093:1238953] installed.
2020-08-25 07:44:17.049704+0100 Simple Chart[35093:1238953]
2020-08-25 07:44:17.049843+0100 Simple Chart[35093:1238953] We have compiled some common reasons and troubleshooting tips at:
2020-08-25 07:44:17.049923+0100 Simple Chart[35093:1238953]
2020-08-25 07:44:17.050024+0100 Simple Chart[35093:1238953] https://numpy.org/devdocs/user/troubleshooting-importerror.html
2020-08-25 07:44:17.050188+0100 Simple Chart[35093:1238953]
2020-08-25 07:44:17.050366+0100 Simple Chart[35093:1238953] Please note and check the following:
2020-08-25 07:44:17.050520+0100 Simple Chart[35093:1238953]
2020-08-25 07:44:17.050721+0100 Simple Chart[35093:1238953] * The Python version is: Python3.8 from "/Users/terry/Library/Developer/CoreSimulator/Devices/635A5FBD-883A-4E2B-BF9F-D34F32D1BA19/data/Containers/Bundle/Application/2AB25BCE-9BA0-46CE-897D-44BE07595BE0/Simple Chart.app/Simple Chart"
2020-08-25 07:44:17.050882+0100 Simple Chart[35093:1238953] * The NumPy version is: "1.19.1"
2020-08-25 07:44:17.051081+0100 Simple Chart[35093:1238953]
2020-08-25 07:44:17.051295+0100 Simple Chart[35093:1238953] and make sure that they are the versions you expect.
2020-08-25 07:44:17.051476+0100 Simple Chart[35093:1238953] Please carefully study the documentation linked above for further help.
2020-08-25 07:44:17.051653+0100 Simple Chart[35093:1238953]
2020-08-25 07:44:17.051815+0100 Simple Chart[35093:1238953] Original error was: No module named 'numpy.core._multiarray_umath'

@freakboy3742
Copy link
Member

Right - that's confirming exactly what I thought. It's looking for a numpy binary module (_multiarray_umath), which won't exist because it's a C-module.

That means this is a duplicate of #471 - on that basis, I'm going to close this ticket.

@freakboy3742 freakboy3742 added duplicate A duplicate of an existing ticket. question and removed duplicate A duplicate of an existing ticket. labels Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants