Closed ghost closed 7 years ago
What's your matplotlib version? I can't reproduce this with Matplotlib 2.1.0.
Also, did you remove /etc/matplotlibrc
? And make sure you don't have another matplotlibrc
in your system.
The matplotlib version is 2.0.0.
I "removed" the matplotlib file via mv /etc/matplotlibrc /etc/mätpllötlibrc
and the ~/.config/matplotlib
folder is empty. Under these conditions starting spyder via the terminal gives me the following error messages:
$ 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
warnings.warn('Could not find matplotlibrc; using defaults')
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:
/etc/matplotlibrc
file causes the behaviour described in my first post./etc/matplotlibrc
file causes the behaviour described in my last post. So I have one last question: Why should I/one remove the /etc/matplotlibrc
file? Apparently matplotlib works better if a /etc/matplotlibrc
is provided (at least I can plot via a normal Python3 terminal).
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
/etc/matplotlibrc
here
The content of /etc/matplotlibrc
:
Regarding the predefined backend TkAgg
: Also Ubuntu and Debian define TkAgg
as the default 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 diff -r DIR1 DIR2
.
I ignored differences in .pyc
and .so
files in the following.
Fedora_spyder
is a copy of the Fedora folder /usr/lib/python3.6/site-packages/spyder
, Ubuntu_spyder
is a copy of the spyder folder from the ubuntu package python3-spyder_3.2.4+dfsg1-1_all.deb
and the Pip_spyder
is a copy from the spyder folder in the local virtual environment ~/LokaleProgramme/python36-venv/lib/python3.6/site-packages/spyder
.The comparison of Fedora_spyder
and pip_spyder
gives no difference in any interesting .py
file
whereas the comparison of Fedora_spyder
and Ubuntu_spyder
gives the following difference.
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'
Fedora_matplotlib
is a copy of the Fedora folder /usr/lib64/python3.6/site-packages/matplotlib
, Ubuntu_matplotlib
is a copy of the spyder folder from the ubuntu package python3-matplotlib_2.0.0+dfsg1-2ubuntu3_amd64.deb
and the Pip_spyder
from the spyder folder in the local virtual environment ~/LokaleProgramme/python36-venv/lib64/python3.6/site-packages/matplotlib
.The comparison of the Fedora_matplotlib
and pip_matplotlib
shows only a small difference in the __init__.py
file.
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 Fedora_matplotlib
and Ubuntu_matplotlib
gives:
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 matplotlibrc
in my home dir that superseded the one in /etc
.
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 /etc/matplotlibrc
file. That PR should take care of that.
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?
Take the following script
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