Code Monkey home page Code Monkey logo

Comments (6)

DavidAntliff avatar DavidAntliff commented on August 23, 2024 46

For completeness, you can also create this file, to avoid a code change (which may or may not be preferable):

$ mkdir -p ~/.matplotlib
$ echo "backend: TkAgg" > ~/.matplotlib/matplotlibrc

from sms-tools.

janosh avatar janosh commented on August 23, 2024 30

@xserra I don't think this is solved. I'm still running into this issue with matplotlib v3.0.2 installed into a miniconda environment on macOS:

conda list matplotlib
# packages in environment at /usr/local/miniconda3/envs/te:
#
# Name                    Version                   Build  Channel
matplotlib                3.0.2                 py36_1001    conda-forge
matplotlib-base           3.0.2           py36hf043ca5_1001    conda-forge

Attempting

from matplotlib import pyplot as plt
plt.plot(range(10))

throws the following exception

python[35172:6260598] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fccc5e0a500'
*** First throw call stack:
(
        0   CoreFoundation                      0x00007fff2f3c9ecd __exceptionPreprocess + 256
        1   libobjc.A.dylib                     0x00007fff5b481720 objc_exception_throw + 48
        2   CoreFoundation                      0x00007fff2f447275 -[NSObject(NSObject) __retain_OA] + 0
        3   CoreFoundation                      0x00007fff2f36bb40 ___forwarding___ + 1486
        4   CoreFoundation                      0x00007fff2f36b4e8 _CF_forwarding_prep_0 + 120
        5   libtk8.6.dylib                      0x0000000121d0b134 TkpInit + 324
        6   libtk8.6.dylib                      0x0000000121c630ce Initialize + 2622
        7   _tkinter.cpython-36m-darwin.so      0x0000000121a8ca46 _tkinter_create + 1174
        ...

If I instead run the following, everything works fine.

import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
plt.plot(range(10))
plt.show()

from sms-tools.

ValeryToda avatar ValeryToda commented on August 23, 2024 28

...Same here and same Stackoverflow source. I had to insert the following lines:

from sys import platform as sys_pf
if sys_pf == 'darwin':
    import matplotlib
    matplotlib.use("TkAgg")

at the top of the file

sms-tools/software/models_interface/models_GUI.py

to get rid of the crash.

from sms-tools.

mjspeck avatar mjspeck commented on August 23, 2024 8

Why is the solution to this to use TkAgg instead of macosx for the backend?

from sms-tools.

tardate avatar tardate commented on August 23, 2024

nice. that works. Suggest a pull request would be a great idea.

The specific error this fixed for me was:

$ python models_GUI.py
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fedcb3a0830'

from sms-tools.

xserra avatar xserra commented on August 23, 2024

Solved, so closing.

from sms-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.