NSException on import of matplotlib, kivy in OSX

2024/10/15 15:21:40

I'm working on some kivy code that's working fine on windows 10, but crashes on osx sierra, I've isolated that the crash happens when I import kivy.core.window along side matplotlib:

import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
import kivy.core.window

It also crashes without matplotlib.use("TkAgg"). This is just included to show that the issue isn`t fixed by this as other questions suggest.

The output from the exception is:

2017-03-08 13:33:32.461 Python[28614:209475] -[SDLApplication _setup:]: unrecognized selector sent to instance 0x1020ea6c0
2017-03-08 13:33:32.464 Python[28614:209475] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SDLApplication _setup:]: unrecognized selector sent to instance 0x1020ea6c0'
*** First throw call stack:
(
0   CoreFoundation  0x00007fffa8716e7b  __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00007fffbd300cad objc_exception_throw + 48
...
)
libc++abi.dylib: terminating with uncaught exception of type NSException

What could be causing this, and where do I start looking to debug this type of exception it?

After solving this I ran into a perhaps related problem, noted in this question.

Answer

I managed to solved this problem through running

pip install kivy-gardens
garden install matplotlib

I'm not sure why this worked, but it did remove this root of the NSException.

I'm now getting a different NSException caused by a different interplay of dependencies that I'll post as a new question.

https://en.xdnf.cn/q/117820.html

Related Q&A

strange behavior with lamba: getattr(obj, x) inside a list [duplicate]

This question already has answers here:Creating functions (or lambdas) in a loop (or comprehension)(9 answers)Closed 11 years ago.In the following example:class A(object):passprop1 = 1prop2 = 2prop3 = …

Detect or Generate Regular Expression from String

I was wondering if there were any Python packages out there that detects a regular expression from a string. Conceptually this is easy enough to do but I wanted to see if there was anyone else who has …

Date regex python

I am trying to match dates in a string where the date is formatted as (month dd, yyyy). I am confused by what I see when I use my regex pattern below. It only matches strings that begin with a date. Wh…

Not able to install the python-module numpy

After hours of trying Im still not able to install numpy. I READ LOTS OF HINTS, ANSWERS USW. BUT IT DOESNT HELP. Furthermore I have windows 7, 32 bit, Python 27. What I did:download numpy-1.10.2.zi…

Windows Error: 32 when trying to rename file in python

Im trying to rename some PDF files using pyPdf and my code it seems to work fine until it reaches the rename sentence. The While/if block of code looks for the page number where string "This stri…

I dont quite understand the while loop in python

def AddSingleCard(self):symbols = [heart, diamond, club, spade]#newCardSign = newCardNumber, newCardSign = raw_input().split()try:newCardNumber = int(float(newCardNumber))except:newCardNumber, newCardS…

Adding a FileField to a custom SignupForm with django-allauth

I have the following custom SignupForm (simplified, works perfectly without my_file):class SignupForm(forms.Form):home_phone = forms.CharField(validators=[phone_regex], max_length=15)my_file = forms.Fi…

Checkbox to determine if an action is completed or not

I have a list of dictionaries of clients in a format like this:dict_list = [{Name of Business : Amazon, Contact Name : Jeff Bezos, Email : [email protected]}, {Name of Business : Microsoft, Contact Nam…

Python not concatenating string and unicode to link

When I append a Unicode string to the end of str, I can not click on the URL.Bad:base_url = https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=xml&tit…

Decrypt python/django password with Symfony 2.5 (using symfony security)

I want to use symfony 2.5.10 security in order to login in from users that were created with pyhton/django security. Passwords in db that are encrypted in this format:pbkdf2_sha256$12000$dVPTWPll8poG$3…