-
-
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
Spyder crashes after typing plt.plot( at the ipython console #5514
Comments
This is the problem, and it's not related to Spyder. Anaconda has not updated Qt to work with High Sierra, so you'll have to wait a couple of weeks until that happens. |
Qt is the graphical toolkit upon which Spyder is built. |
But the problem does not happen on High Sierra, only on Ubuntu 16.04 LTS.
…On Fri, Oct 20, 2017 at 4:27 PM, Carlos Cordoba ***@***.***> wrote:
I run Anaconda/Spyder on macOS High Sierra
This is the problem, and it's not related to Spyder. Anaconda has not
updated Qt to work with High Sierra, so you'll have to wait a couple of
weeks until that happens.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5514 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfbqC0PDZudHRCiC65M3g5fhXfOxpTo3ks5suK27gaJpZM4QAq6l>
.
|
You said you were working on High Sierra, I don't understand... |
No, I tried it on High Sierra just to see if I could reproduce it on that
OS too (but I could not). It only occurs on Ubuntu 16.04 LTS.
…On Fri, Oct 20, 2017 at 4:38 PM, Carlos Cordoba ***@***.***> wrote:
You said you were working on High Sierra, I don't understand...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5514 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfbqC6NuSoXEzo99AogZOf-53nLJGYNqks5suLBTgaJpZM4QAq6l>
.
|
@rlaverde, please try to reproduce this one. |
@evangelos1 From your report it seem that you have the preference I can't reproduce this bug. I didn't try matplotlib 2.1. Did you install matplotlib 2.1 through pip? If so it could mess with anaconda. My system: IPython >=4.0 : 6.1.0 (OK) |
That is correct. The crash happens only if the automatic connection to
IPython is enabled and as soon as I type plt.plot( at the IPython console.
Interestingly, if I type matplotlib.pyplot.plot( then Spyder does not
crash; but it doesn't display plot's documentation either.
…On Sat, Oct 21, 2017 at 12:06 AM, bcolsen ***@***.***> wrote:
@evangelos1 <https://github.com/evangelos1> From your report it seem that
you have the preference Help -> Automatic connections -> IPython enabled.
Is this correct?
I can't reproduce this.
My system:
Python 3.6.2 64bits, Qt 5.6.2, PyQt5 5.6 Ubuntu 6.04
matplotlib 2.02
IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.26.1 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.12.1 (OK)
pandas >=0.13.1 : 0.20.3 (OK
<https://maps.google.com/?q=20.3+(OK&entry=gmail&source=g>)
psutil >=0.3 : 5.4.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5514 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfbqC-GJhpw8jhw-fNu6AKxremTyRi75ks5suRlYgaJpZM4QAq6l>
.
|
I didn't see your second question in time: No, I've installed all packages
via Anaconda Navigator.
…On Sat, Oct 21, 2017 at 12:06 AM, bcolsen ***@***.***> wrote:
@evangelos1 <https://github.com/evangelos1> From your report it seem that
you have the preference Help -> Automatic connections -> IPython enabled.
Is this correct?
I can't reproduce this.
My system:
Python 3.6.2 64bits, Qt 5.6.2, PyQt5 5.6 Ubuntu 6.04
matplotlib 2.02
IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.26.1 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.12.1 (OK)
pandas >=0.13.1 : 0.20.3 (OK
<https://maps.google.com/?q=20.3+(OK&entry=gmail&source=g>)
psutil >=0.3 : 5.4.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5514 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfbqC-GJhpw8jhw-fNu6AKxremTyRi75ks5suRlYgaJpZM4QAq6l>
.
|
I only asked because I don't see matplotlib 2.1 in the standard channel yet through the |
With the auto help off, what happens if you press |
I see that the documentation for plt.plot appears in the help window and
Spyder crashes immediately. If I do the same thing but with plt.scatter
instead, then everything works.
…On Sat, Oct 21, 2017 at 12:33 AM, bcolsen ***@***.***> wrote:
With the auto help off, what happens if you press ctrl-i at the end of
plt.plot
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5514 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfbqC-A1P1wiDrCV0fSRHJlXCK1CtgbDks5suR_AgaJpZM4QAq6l>
.
|
Try changing the help widget to render in |
IPython console + Plain text works; Spyder doesn't crash. It looks like the
entire documentation for plt.plot is shown in this case.
Editor + plain text doesn't crash Spyder. But only the arguments of
plt.plot are shown in the help window.
…On Sat, Oct 21, 2017 at 1:00 AM, bcolsen ***@***.***> wrote:
Try changing the help widget to render in plain text
The option is under the gear drop down menu on the help widget
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5514 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfbqC5rwhmtWsJh5S_qafP0RmMAcPfDtks5suSYTgaJpZM4QAq6l>
.
|
Good so the problem is with the rich text conversion. We're getting somewhere! Can you post the plain text of the the plt.plot help here? or to pastebin |
|
Git hub sort of mangled that. Can you edit it so it has |
If the problem only occurs with the rich docs generation, then this should be a problem with Sphinx. |
I can reproduce this with the latest anaconda updates. It might be graphics related Spyder Crashes right to spyder 3.2.4 and latest master Python 3.6.2 64bits, Qt 5.6.2, PyQt5 5.6 on Linux IPython >=4.0 : 6.1.0 (OK) |
It's not graphics related. I reproduced on a different machine It has to do with the super long 2Dlines |
Solution 1:Find out why Sphinx is crashing and fix it. This could be hard. Solution 2:This is a work around, but it would be fixed if you know why |
@bcolsen, what if we wrap MPL docstrings using the |
Hi, sorry for the late reply, thanks @bcolsen for figuring out that the problem was the help richtext. After some debugging I achieve to reproduce this bug, and It's caused by the docs lines mentioned by @bcolsen
It's not a Sphinx problem (the html generation is working) The segmentation fault is caused after setting the generated html to the QWebEngineView. (I wasn't able to reproduce it with a basic Qt example), and the html actually renders and after a second crashes The segfault is caused by something else executed after setting the html, although I haven't found exactly what |
@rlaverde, please work on this one. |
Sorry for not being clear, but the problem is in MPL 2.0.2 as well if I downgrade to 2.0.2 from 2.1. I included all the packages that were updated because I think that one of those updates might actually be at fault. Unfortunately. I can't update or down grade any of those packages individually, so I can't narrow it down. As a work around:
Will downgrade several packages including MPL to 2.0.2, but spyder doesn't crash afterwards. |
After a lot of debugging I found the cause of the error, the mathjax library, commenting it out fix the problem Although I don't know how to fix it, I tried updating mathjax to the latest version but It didn't work For a really weird reason, changing the base_url argument of Maybe the problem is that we aren't loading correctly the mathjax library |
I made a minimal test that crashed Qt5 web view in anaconda. Both the html and the python don't use spyder code just mathjax from the internet and
I works on firefox and chrome so I seems like a Qt problem. import PyQt5
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtWebKitWidgets import QWebView , QWebPage
from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtNetwork import *
import sys
from optparse import OptionParser
class MyBrowser(QWebPage):
''' Settings for the browser.'''
def userAgentForUrl(self, url):
''' Returns a User Agent that will be seen by the website. '''
return "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
class Browser(QWebView):
def __init__(self):
# QWebView
self.view = QWebView.__init__(self)
#self.view.setPage(MyBrowser())
self.setWindowTitle('Loading...')
self.titleChanged.connect(self.adjustTitle)
#super(Browser).connect(self.ui.webView,QtCore.SIGNAL("titleChanged (const QString&)"), self.adjustTitle)
def load(self,url):
self.setUrl(QUrl(url))
def adjustTitle(self):
self.setWindowTitle(self.title())
def disableJS(self):
settings = QWebSettings.globalSettings()
settings.setAttribute(QWebSettings.JavascriptEnabled, False)
app = QApplication(sys.argv)
view = Browser()
view.showMaximized()
view.load("file:////path/to/test.html") # Change me
app.exec_() test.html: <html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
<div>
<p>[‘miter’ | ‘round’ | ‘bevel’]</p>
</div>
</body></html> |
Thanks a lot @bcolsen for the minimal reproducible example
Yes, I think we should report it upstream, although I'm not sure if this is a Qt issue or anaconda Qt packages Btw, what we should do to prevent the segfaults in spyder? deactivate mathjax? 😕 @ccordoba12 ? |
Yeah, It might not be a Qt problem either. I forgot about the work around I mentioned above, which still works in this minimal example. That downgrades a bunch of support packages as well as Qt. Here is another minimal text that crashes <p>a‘aaaaa’ a ‘aaaaa’ a ‘aaaaa’a</p> As for a work around, the crash is incredibly text specific, so simply disabling http://docutils.sourceforge.net/docs/user/config.html#smart-quotes |
I searched the Sphinx documentation also the code and I didn't find a way to deactivate smart-quotes |
This is the option but it's depreciated: They suggest instead to change smart-quotes... http://docutils.sourceforge.net/docs/user/config.html#smart-quotes in a separate From http://www.sphinx-doc.org/en/stable/config.html:
|
I tried adding a
Btw, |
This is true for docutils, but sphinx has it enabled by default:
I have confirmed that changing this line: spyder/spyder/utils/help/conf.py Line 102 in 79fe9cb
to: html_use_smartypants = False removes the smart quotes and This is a work around of course, but it is simple. Hopefully next time anaconda compiles Qt the problem will be fixed. |
Just a quick note that this is not specific to the anaconda Qt binaries. I see the same issue in Ubuntu Linux 17.10 using spyder in a virtualenv with the qt libraries shipped with ubuntu 17.10 (that is 5.9.1). Using latest spyder, sphinx and matplotlib. Disabling the spyder option to |
I confirm that also on linux disabling smartpants quotes works around the issue. I recommend reporting to the QT developers. |
We don't have time for that, sorry. You're welcome to do it and link it to this issue. |
I'll do it. Before that - since I'll sure be asked about it - would switching to the QWebEngineView be an option? Looks like the sample code to reproduce the crash by @bcolsen immediately stops crashing if one changes the browser class to be based on QWebEngineView rather than QWebView. I'm getting the impression that webkit is being phased out from Qt and I have a feeling that it may be considered 'done' with no fixes being applied at this point. |
Consider following https://bugreports.qt.io/browse/QTBUG-64922 |
We try to use QWebEngineView if both are installed, so I find this strange. How did you find we are using QWebView instead of QWebEngineView? |
This is great news! The test code by @bcolsen, a few posts above, explicitly uses QWebView.
To change it to use QWebEngine, I had to install a package that was not originally installed on my machine python3-pyqt5.qtwebengine. After that, the test code did not produce any segmentation fault. Now, after your post, I tried removing the smartypants workaround from the
which is likely a sign that spyder is using the QWebEngineView |
As a side note, QT developers are not happy about the python test code and would like a C++ sample. But I think we can drop the matter now. |
@callegar, thanks a lot for doing the extra effort of testing this with QWebEngineView. It's even better news to know that updating Qt will fix this problem!
Yep, don't worry about it. At least they are now informed about the crash and translating @bcolsen snippet to C++ is really easy. |
Hello experts, my spyder python 3.8 suddenly stoped ploting figures when I tried to plot 4 subplots. Although it was working fine and even ploted 4 subplots but after 2 trials it stopped and now its not plotting figures anymore. Please I highly need some suggestions. |
Description of your problem
Typing plt.plot( at the ipython console results in Spyder crashing. If I open Spyder via a terminal, then the following message appears: Segmentation fault (core dumped).
What steps will reproduce the problem?
What is the expected output? What do you see instead?
I expect to see documentation relevant to plt.plot at the help window. Instead, Spyder crashes to the desktop.
Please provide any additional information below
The problem does not occur when:
I type plt.plot( at the editor. However, the help window shows only the basic arguments of the command and displays the following message: No further help available
I type matplotlib.pyplot.plot( at the ipython console
I turn off help for the ipython console
I type other pyplot functions (e.g. scatter, loglog etc)
I run Anaconda/Spyder on macOS High Sierra
Versions and main components
Spyder Version: 3.2.4
Python Version: 3.6.3 (also 2.7.14)
Qt Version: 5.6.2
PyQt Version: 5.6.0
Operating system: Ubuntu 16.04 LTS
Matplotlib: 2.1.0 and 2.0.2
Dependencies
IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.26.1 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.13.3 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
psutil >=0.3 : 5.4.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
The text was updated successfully, but these errors were encountered: