-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Problems with backend "TkAgg" on Linux #5718
Comments
What's your matplotlib version? I can't reproduce this with Matplotlib 2.1.0. Also, did you remove |
The matplotlib version is 2.0.0. I "removed" the matplotlib file via $ spyder3
/usr/lib64/python3.6/site-packages/matplotlib/__init__.py:852: UserWarning: Could not find matplotlibrc; using defaults
warnings.warn('Could not find matplotlibrc; using defaults')
/usr/lib64/python3.6/site-packages/matplotlib/__init__.py:1025: UserWarning: could not find rc file; returning defaults
warnings.warn(message)
loaded the Generic plugin Running the code snipplet now via an external system terminal gives the following message out: /usr/lib64/python3.6/site-packages/matplotlib/__init__.py:852: UserWarning: Could not find matplotlibrc; using defaults
warnings.warn('Could not find matplotlibrc; using defaults')
/usr/lib64/python3.6/site-packages/matplotlib/__init__.py:1025: UserWarning: could not find rc file; returning defaults
warnings.warn(message)
matplotlib.get_backend(): agg
>>> whereas trying to run the code snipplet in the internal ipython console gives the following messages out: In [1]: runfile('~/temp.py', wdir='~')
matplotlib.get_backend(): TkAgg
Traceback (most recent call last):
File "<ipython-input-1-3ae9c814a951>", line 1, in <module>
runfile('~/temp.py', wdir='~')
File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "~/temp.py", line 11, in <module>
plt.plot([1, 2, 3])
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 3307, in plot
ax = gca()
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 950, in gca
return gcf().gca(**kwargs)
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 586, in gcf
return figure()
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 535, in figure
**kwargs)
File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 81, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 97, in new_figure_manager_given_figure
icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.ppm')
File "/usr/lib64/python3.6/posixpath.py", line 78, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Traceback (most recent call last):
File "<ipython-input-1-3ae9c814a951>", line 1, in <module>
runfile('~/temp.py', wdir='~')
File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "~/temp.py", line 11, in <module>
plt.plot([1, 2, 3])
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 3307, in plot
ax = gca()
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 950, in gca
return gcf().gca(**kwargs)
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 586, in gcf
return figure()
File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 535, in figure
**kwargs)
File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 81, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 97, in new_figure_manager_given_figure
icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.ppm')
File "/usr/lib64/python3.6/posixpath.py", line 78, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
In [2]:
In [2]: |
There's nothing related to Spyder in the traceback you posted, except for the sitecustomize parts, that doesn't have anything to do with Matplotlib. As the last part of your traceback seems to indicate, this is an installation problem with Matplotlib. Sorry, but I don't know how else yo help you. |
Even your initial error
seems to point out to a Matplotlib packaging problem in Fedora. I'd suggest you to raise this issue with the Fedora developers. |
To summarize the two testcases:
So I have one last question: Why should I/one remove the |
Could you download and try this with Anaconda, please? I think this whole problem is generated by the way matplotlib is packaged in Fedora, so I'm almost sure it won't appear in Anaconda. |
Also, please post the contents of your
here |
The content of
Regarding the predefined backend |
I was looking for differences between an Spyder and matplotlib versions between linux distros and pip. For this I scanned the spyder/matplotlib folders of the different distros/pip via the command
The comparison of diff -r Fedora_spyder/__init__.py Ubuntu_spyder/__init__.py
39a40,44
> DATAPATH = '/usr/share/spyder/images'
> LOCALEPATH = '/usr/share/spyder/locale'
> DOCPATH = '/usr/share/doc/spyder-doc/html'
> MATHJAXPATH = '/usr/share/javascript/mathjax'
> JQUERYPATH = '/usr/share/javascript/jquery'
The comparison of the diff -r /home/ich/LokaleProgramme/python36-venv/lib64/python3.6/site-packages/matplotlib/__init__.py /usr/lib64/python3.6/site-packages/matplotlib/__init__.py
715a716
> path = '/usr/share/matplotlib/mpl-data'
718a720,721
> raise RuntimeError('Could not find the matplotlib data files')
>
846c849
< path = get_data_path() # guaranteed to exist or raise
---
> path = '/etc' # guaranteed to exist or raise The difference between the diff -r Fedora_matplotlib/__init__.py Ubuntu_matplotlib/__init__.py
715d714
< path = os.sep.join([os.path.dirname(_file), 'mpl-data']) For me as a not-developer the differences seem negligible but perhaps you can say more. |
@JakobJakobson, thanks for investigating further this issue. I'm working on a fix for this and issue #5541 right now. I was not seeing this problem because I had a |
Thanks @ccordoba12. Could you tell me the underlying problem? To me the bug is still very weird, chaotic, arbitrary and far from any logic. |
In this case it seems Spyder is not setting the Matplotlib backend correctly. Please test PR #5758 to see if it fixes this problem. |
And don't forget to restore your |
See #5758 |
Description of your problem
The TkAgg/Tkinter graphic backends behaves differently (one time it shows a plot, one time it shows a blank canvas) depending on the choice of the dialog
Preferences -> Run -> Console
I ran into this issue by investigating the bug #5541 and I would be glad if you could give me hints for debugging.
What steps will reproduce the problem?
Select the graphic backend as
Tkinter
viaPreferences-> IPython Console -> Graphics -> Graphics -> Graphics backend
Then test the two cases:
Execute in external system terminal
viaPreferences -> Run -> Console
in the external system terminal.Execute in current console
viaPreferences -> Run -> Console
in the current IPython console.What is the expected output? What do you see instead?
In case A everything works fine (Screenshots "CaseA")
whereas case B gives me the following output on the console
and a blank canvas in the plot window.
Also you can't close the plot window as it doesn't react on clicking.
Please provide any additional information below
It's an Fedora installation.
Version and main components
Dependencies
The text was updated successfully, but these errors were encountered: