Skip to content
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

Closed
evangelos1 opened this issue Oct 20, 2017 · 47 comments
Closed

Spyder crashes after typing plt.plot( at the ipython console #5514

evangelos1 opened this issue Oct 20, 2017 · 47 comments

Comments

@evangelos1
Copy link

evangelos1 commented Oct 20, 2017

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?

  1. Run Spyder
  2. Type plt.plot( at the ipython console

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:

  1. 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

  2. I type matplotlib.pyplot.plot( at the ipython console

  3. I turn off help for the ipython console

  4. I type other pyplot functions (e.g. scatter, loglog etc)

  5. 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)

@ccordoba12
Copy link
Member

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.

@ccordoba12
Copy link
Member

Qt is the graphical toolkit upon which Spyder is built.

@evangelos1
Copy link
Author

evangelos1 commented Oct 20, 2017 via email

@ccordoba12
Copy link
Member

You said you were working on High Sierra, I don't understand...

@evangelos1
Copy link
Author

evangelos1 commented Oct 20, 2017 via email

@ccordoba12 ccordoba12 reopened this Oct 20, 2017
@ccordoba12
Copy link
Member

@rlaverde, please try to reproduce this one.

@bcolsen
Copy link
Member

bcolsen commented Oct 20, 2017

@evangelos1 From your report it seem that you have the preference Help -> Automatic connections -> IPython enabled. Is this correct?

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:
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)
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)

@evangelos1
Copy link
Author

evangelos1 commented Oct 20, 2017 via email

@evangelos1
Copy link
Author

evangelos1 commented Oct 20, 2017 via email

@bcolsen
Copy link
Member

bcolsen commented Oct 20, 2017

I didn't see your second question in time: No, I've installed all packages via Anaconda Navigator.

I only asked because I don't see matplotlib 2.1 in the standard channel yet through the conda upgrade command.

@bcolsen
Copy link
Member

bcolsen commented Oct 20, 2017

With the auto help off, what happens if you press ctrl-i at the end of plt.plot?

@evangelos1
Copy link
Author

evangelos1 commented Oct 20, 2017 via email

@bcolsen
Copy link
Member

bcolsen commented Oct 20, 2017

Try changing the help widget to render in plain text
The option is under the gear drop down menu on the help widget

@evangelos1
Copy link
Author

evangelos1 commented Oct 20, 2017 via email

@bcolsen
Copy link
Member

bcolsen commented Oct 20, 2017

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

@evangelos1
Copy link
Author

evangelos1 commented Oct 20, 2017

====
plot
====

Definition: plot(*args, **kwargs)
Type: Function of matplotlib.pyplot module

----

Plot lines and/or markers to the
:class:`~matplotlib.axes.Axes`.  *args* is a variable length
argument, allowing for multiple *x*, *y* pairs with an
optional format string.  For example, each of the following is
legal::

    plot(x, y)        # plot x and y using default line style and color
    plot(x, y, 'bo')  # plot x and y using blue circle markers
    plot(y)           # plot y using x as index array 0..N-1
    plot(y, 'r+')     # ditto, but with red plusses

If *x* and/or *y* is 2-dimensional, then the corresponding columns
will be plotted.

If used with labeled data, make sure that the color spec is not
included as an element in data, as otherwise the last case
``plot("v","r", data={"v":..., "r":...)``
can be interpreted as the first case which would do ``plot(v, r)``
using the default line style and color.

If not used with labeled data (i.e., without a data argument),
an arbitrary number of *x*, *y*, *fmt* groups can be specified, as in::

    a.plot(x1, y1, 'g^', x2, y2, 'g-')

Return value is a list of lines that were added.

By default, each line is assigned a different style specified by a
'style cycle'.  To change this behavior, you can edit the
axes.prop_cycle rcParam.

The following format string characters are accepted to control
the line style or marker:

================    ===============================
character           description
================    ===============================
``'-'``             solid line style
``'--'``            dashed line style
``'-.'``            dash-dot line style
``':'``             dotted line style
``'.'``             point marker
``','``             pixel marker
``'o'``             circle marker
``'v'``             triangle_down marker
``'^'``             triangle_up marker
``'<'``             triangle_left marker
``'>'``             triangle_right marker
``'1'``             tri_down marker
``'2'``             tri_up marker
``'3'``             tri_left marker
``'4'``             tri_right marker
``'s'``             square marker
``'p'``             pentagon marker
``'*'``             star marker
``'h'``             hexagon1 marker
``'H'``             hexagon2 marker
``'+'``             plus marker
``'x'``             x marker
``'D'``             diamond marker
``'d'``             thin_diamond marker
``'|'``             vline marker
``'_'``             hline marker
================    ===============================


The following color abbreviations are supported:

==========  ========
character   color
==========  ========
'b'         blue
'g'         green
'r'         red
'c'         cyan
'm'         magenta
'y'         yellow
'k'         black
'w'         white
==========  ========

In addition, you can specify colors in many weird and
wonderful ways, including full names (``'green'``), hex
strings (``'#008000'``), RGB or RGBA tuples (``(0,1,0,1)``) or
grayscale intensities as a string (``'0.8'``).  Of these, the
string specifications can be used in place of a ``fmt`` group,
but the tuple forms can be used only as ``kwargs``.

Line styles and colors are combined in a single format string, as in
``'bo'`` for blue circles.

The *kwargs* can be used to set line properties (any property that has
a ``set_*`` method).  You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc.  Here is an
example::

    plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
    plot([1,2,3], [1,4,9], 'rs',  label='line 2')
    axis([0, 4, 0, 10])
    legend()

If you make multiple lines with one plot command, the kwargs
apply to all those lines, e.g.::

    plot(x1, y1, x2, y2, antialiased=False)

Neither line will be antialiased.

You do not need to use format strings, which are just
abbreviations.  All of the line properties can be controlled
by keyword arguments.  For example, you can set the color,
marker, linestyle, and markercolor with::

    plot(x, y, color='green', linestyle='dashed', marker='o',
         markerfacecolor='blue', markersize=12).

See :class:`~matplotlib.lines.Line2D` for details.

The kwargs are :class:`~matplotlib.lines.Line2D` properties:


  =====================================================================================   ===============================================================================================================================================
  Property                                                                                Description                                                                                                                                    
  =====================================================================================   ===============================================================================================================================================
  :meth:`agg_filter <matplotlib.artist.Artist.set_agg_filter>`                            unknown                                                                                                                                        
  :meth:`alpha <matplotlib.artist.Artist.set_alpha>`                                      float (0.0 transparent through 1.0 opaque)                                                                                                     
  :meth:`animated <matplotlib.artist.Artist.set_animated>`                                [True | False]                                                                                                                                 
  :meth:`antialiased <matplotlib.lines.Line2D.set_antialiased>` or aa                     [True | False]                                                                                                                                 
  :meth:`clip_box <matplotlib.artist.Artist.set_clip_box>`                                a :class:`matplotlib.transforms.Bbox` instance                                                                                                 
  :meth:`clip_on <matplotlib.artist.Artist.set_clip_on>`                                  [True | False]                                                                                                                                 
  :meth:`clip_path <matplotlib.artist.Artist.set_clip_path>`                              [ (:class:`~matplotlib.path.Path`, :class:`~matplotlib.transforms.Transform`) | :class:`~matplotlib.patches.Patch` | None ]                    
  :meth:`color <matplotlib.lines.Line2D.set_color>` or c                                  any matplotlib color                                                                                                                           
  :meth:`contains <matplotlib.artist.Artist.set_contains>`                                a callable function                                                                                                                            
  :meth:`dash_capstyle <matplotlib.lines.Line2D.set_dash_capstyle>`                       ['butt' | 'round' | 'projecting']                                                                                                              
  :meth:`dash_joinstyle <matplotlib.lines.Line2D.set_dash_joinstyle>`                     ['miter' | 'round' | 'bevel']                                                                                                                  
  :meth:`dashes <matplotlib.lines.Line2D.set_dashes>`                                     sequence of on/off ink in points                                                                                                               
  :meth:`drawstyle <matplotlib.lines.Line2D.set_drawstyle>`                               ['default' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post']                                                                               
  :meth:`figure <matplotlib.artist.Artist.set_figure>`                                    a :class:`matplotlib.figure.Figure` instance                                                                                                   
  :meth:`fillstyle <matplotlib.lines.Line2D.set_fillstyle>`                               ['full' | 'left' | 'right' | 'bottom' | 'top' | 'none']                                                                                        
  :meth:`gid <matplotlib.artist.Artist.set_gid>`                                          an id string                                                                                                                                   
  :meth:`label <matplotlib.artist.Artist.set_label>`                                      string or anything printable with '%s' conversion.                                                                                             
  :meth:`linestyle <matplotlib.lines.Line2D.set_linestyle>` or ls                         ['solid' | 'dashed', 'dashdot', 'dotted' | (offset, on-off-dash-seq) | ``'-'`` | ``'--'`` | ``'-.'`` | ``':'`` | ``'None'`` | ``' '`` | ``''``]
  :meth:`linewidth <matplotlib.lines.Line2D.set_linewidth>` or lw                         float value in points                                                                                                                          
  :meth:`marker <matplotlib.lines.Line2D.set_marker>`                                     :mod:`A valid marker style <matplotlib.markers>`                                                                                               
  :meth:`markeredgecolor <matplotlib.lines.Line2D.set_markeredgecolor>` or mec            any matplotlib color                                                                                                                           
  :meth:`markeredgewidth <matplotlib.lines.Line2D.set_markeredgewidth>` or mew            float value in points                                                                                                                          
  :meth:`markerfacecolor <matplotlib.lines.Line2D.set_markerfacecolor>` or mfc            any matplotlib color                                                                                                                           
  :meth:`markerfacecoloralt <matplotlib.lines.Line2D.set_markerfacecoloralt>` or mfcalt   any matplotlib color                                                                                                                           
  :meth:`markersize <matplotlib.lines.Line2D.set_markersize>` or ms                       float                                                                                                                                          
  :meth:`markevery <matplotlib.lines.Line2D.set_markevery>`                               [None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float]                                             
  :meth:`path_effects <matplotlib.artist.Artist.set_path_effects>`                        unknown                                                                                                                                        
  :meth:`picker <matplotlib.lines.Line2D.set_picker>`                                     float distance in points or callable pick function ``fn(artist, event)``                                                                       
  :meth:`pickradius <matplotlib.lines.Line2D.set_pickradius>`                             float distance in points                                                                                                                       
  :meth:`rasterized <matplotlib.artist.Artist.set_rasterized>`                            [True | False | None]                                                                                                                          
  :meth:`sketch_params <matplotlib.artist.Artist.set_sketch_params>`                      unknown                                                                                                                                        
  :meth:`snap <matplotlib.artist.Artist.set_snap>`                                        unknown                                                                                                                                        
  :meth:`solid_capstyle <matplotlib.lines.Line2D.set_solid_capstyle>`                     ['butt' | 'round' |  'projecting']                                                                                                             
  :meth:`solid_joinstyle <matplotlib.lines.Line2D.set_solid_joinstyle>`                   ['miter' | 'round' | 'bevel']                                                                                                                  
  :meth:`transform <matplotlib.lines.Line2D.set_transform>`                               a :class:`matplotlib.transforms.Transform` instance                                                                                            
  :meth:`url <matplotlib.artist.Artist.set_url>`                                          a url string                                                                                                                                   
  :meth:`visible <matplotlib.artist.Artist.set_visible>`                                  [True | False]                                                                                                                                 
  :meth:`xdata <matplotlib.lines.Line2D.set_xdata>`                                       1D array                                                                                                                                       
  :meth:`ydata <matplotlib.lines.Line2D.set_ydata>`                                       1D array                                                                                                                                       
  :meth:`zorder <matplotlib.artist.Artist.set_zorder>`                                    any number                                                                                                                                     
  =====================================================================================   ===============================================================================================================================================


kwargs *scalex* and *scaley*, if defined, are passed on to
:meth:`~matplotlib.axes.Axes.autoscale_view` to determine
whether the *x* and *y* axes are autoscaled; the default is
*True*.

.. note::
    In addition to the above described arguments, this function can take a
    **data** keyword argument. If such a **data** argument is given, the
    following arguments are replaced by **data[<arg>]**:

    * All arguments with the following names: 'x', 'y'.

@bcolsen
Copy link
Member

bcolsen commented Oct 20, 2017

Git hub sort of mangled that. Can you edit it so it has ``` (triple backticks..to the left of 1) at the top and the bottom of your last post

@ccordoba12
Copy link
Member

If the problem only occurs with the rich docs generation, then this should be a problem with Sphinx.

@bcolsen
Copy link
Member

bcolsen commented Oct 23, 2017

I can reproduce this with the latest anaconda updates. It might be graphics related

Spyder Crashes right to Segmentation fault (core dumped) nothing on debug level=3

spyder 3.2.4 and latest master

Python 3.6.2 64bits, Qt 5.6.2, PyQt5 5.6 on Linux
Ubuntu 16.04 64-bit
matplotlib 2.1 or 2.0.2

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.1 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
psutil >=0.3 : 5.2.2 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.5.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.2 (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)

@bcolsen
Copy link
Member

bcolsen commented Oct 23, 2017

It's not graphics related. I reproduced on a different machine

It has to do with the super long 2Dlines properties and description section

@bcolsen
Copy link
Member

bcolsen commented Oct 23, 2017

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 plt.plot? in jupyter-qtconsole doesn't have the super long 2Dlines properties and description section and it does in the spyder-qtconsole. We can stop it from crashing.

@ccordoba12
Copy link
Member

@bcolsen, what if we wrap MPL docstrings using the textwrap module, before sending them to Sphinx?

@rlaverde
Copy link
Member

rlaverde commented Oct 23, 2017

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

If the problem only occurs with the rich docs generation, then this should be a problem with Sphinx.

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

@ccordoba12
Copy link
Member

@rlaverde, please work on this one.

@bcolsen
Copy link
Member

bcolsen commented Nov 3, 2017

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:

conda install cairo=1.14.8

Will downgrade several packages including MPL to 2.0.2, but spyder doesn't crash afterwards.

@rlaverde
Copy link
Member

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 setHtml() to a wrong Url fix the problem, is like the mathjax library where trying to load something and that caused the segfault

Maybe the problem is that we aren't loading correctly the mathjax library

@bcolsen
Copy link
Member

bcolsen commented Nov 11, 2017

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 [‘miter’ | ‘round’ | ‘bevel’] in the html makes it crash.

[‘miter’ | ‘round’ | ‘bevel’] (note the utf-8 single quotes) is the only thing that I could get it to crash with even [‘a’ | ‘a’ | ‘a’] and $$ x = y $$ work find. Very strange.

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>

@rlaverde
Copy link
Member

rlaverde commented Nov 11, 2017

Thanks a lot @bcolsen for the minimal reproducible example

It works on firefox and chrome so I seems like a Qt problem.

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 ?

@bcolsen
Copy link
Member

bcolsen commented Nov 11, 2017

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 a can be replaced by any character but the spaces, the quotes and the number of characters are important(there has to be 5 a's in the quotes) and it must be in html tags that are on the same line. This might be from some weird comping error in qt or one of its dependencies.

<p>a‘aaaaa’ a ‘aaaaa’ a ‘aaaaa’a</p>

As for a work around, the crash is incredibly text specific, so simply disabling smart-quotes in docutils might work:

http://docutils.sourceforge.net/docs/user/config.html#smart-quotes

@rlaverde
Copy link
Member

As for a work around, the crash is incredibly text specific, so simply disabling smart-quotes in docutils might work

I searched the Sphinx documentation also the code and I didn't find a way to deactivate smart-quotes

@bcolsen
Copy link
Member

bcolsen commented Nov 15, 2017

This is the option but it's depreciated:
http://www.sphinx-doc.org/en/stable/config.html#confval-html_use_smartypants

They suggest instead to change smart-quotes...

http://docutils.sourceforge.net/docs/user/config.html#smart-quotes

in a separate docutils.conf file:

From http://www.sphinx-doc.org/en/stable/config.html:

The configuration directory must contain a file named conf.py. This file (containing Python code) is called the “build configuration file” and contains (almost) all configuration needed to customize Sphinx input and output behavior.

An optional file docutils.conf can be added to the configuration directory to adjust Docutils configuration if not otherwise overriden or set by Sphinx.

@rlaverde
Copy link
Member

I tried adding a docutils.conf to the scrdir, but it doesn't work, I don't know what i'm doing wrong:

# Docutils configurations
[restructuredtext parser]
smart_quotes: no

As for a work around, the crash is incredibly text specific, so simply disabling smart-quotes in docutils might work:

Btw, smart-quotes are disabled by default

@bcolsen
Copy link
Member

bcolsen commented Nov 16, 2017

Btw, smart-quotes are disabled by default

This is true for docutils, but sphinx has it enabled by default:


html_use_smartypants

    If true, SmartyPants will be used to convert quotes and dashes to typographically correct entities. Default: True.

    Deprecated since version 1.6: To disable or customize smart quotes, use the Docutils configuration file (docutils.conf) instead to set there its smart_quotes option.

I have confirmed that changing this line:

#html_use_smartypants = True

to:

    html_use_smartypants = False

removes the smart quotes and plt.plot() docs to not crash.

This is a work around of course, but it is simple. Hopefully next time anaconda compiles Qt the problem will be fixed.

@ccordoba12
Copy link
Member

ccordoba12 commented Nov 17, 2017

This is awesome!! Thanks @rlaverde and @bcolsen for getting to the bottom of this one!

@bcolsen, could you open a PR with this fix? Thanks!

@callegar
Copy link

callegar commented Dec 1, 2017

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 render mathematical equations in the help viewer works around the issue, testifying that here too the problem is tied to mathjax.

@callegar
Copy link

callegar commented Dec 1, 2017

I confirm that also on linux disabling smartpants quotes works around the issue.

I recommend reporting to the QT developers.

@ccordoba12
Copy link
Member

We don't have time for that, sorry. You're welcome to do it and link it to this issue.

@callegar
Copy link

callegar commented Dec 1, 2017

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.

@callegar
Copy link

callegar commented Dec 1, 2017

Consider following https://bugreports.qt.io/browse/QTBUG-64922

@ccordoba12
Copy link
Member

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

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?

@callegar
Copy link

callegar commented Dec 2, 2017

This is great news!

The test code by @bcolsen, a few posts above, explicitly uses QWebView.

from PyQt5.QtWebKitWidgets import 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 util/help/conf.py and spyder does not crash anymore either. Another visible change is that I get tons of warnings on the console

ATTENTION: option value of option force_s3tc_enable ignored.

which is likely a sign that spyder is using the QWebEngineView

@callegar
Copy link

callegar commented Dec 2, 2017

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.

@ccordoba12
Copy link
Member

@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!

But I think we can drop the matter now.

Yep, don't worry about it. At least they are now informed about the crash and translating @bcolsen snippet to C++ is really easy.

@Sadia328
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants