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

3.2.5 fails to activate Matplotlib Qt5 backend #6091

Closed
gb119 opened this issue Dec 29, 2017 · 10 comments
Closed

3.2.5 fails to activate Matplotlib Qt5 backend #6091

gb119 opened this issue Dec 29, 2017 · 10 comments

Comments

@gb119
Copy link

gb119 commented Dec 29, 2017

Description

Having updated to 3.2.5 in both a Python 2.7 and Python 3.6 conda environment, I've noticed that in the 3.6 environment, pylab and numpy are not automatically loaded into the console despite the option being ticked and the startup banner message being correct. In the 2.7 environment this is all fine.

This appears to be just on my linux x64 box, my windows 7 x64 seems to be fine, so possibly some weird versioning problems?

What steps will reproduce the problem?

  1. Startup spyder from my 3.6 conda environment- observe the banner message on the console says:

ython 3.6.3 | packaged by conda-forge | (default, Oct 5 2017, 14:07:33)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

Populating the interactive namespace from numpy and matplotlib

NOTE: Spyder can't set your selected Matplotlib backend because there is a previous backend already in use.

Your backend will be Qt5Agg

  1. Confirm that numpy etc is not loaded:

In [1]: sin
Traceback (most recent call last):

File "", line 1, in
sin

NameError: name 'sin' is not defined

What is the expected output? What do you see instead?

Something more like the 2.7 environment:

Please provide any additional information below

Python 2.7.13 | packaged by conda-forge | (default, May 2 2017, 12:48:11)
Type "copyright", "credits" or "license" for more information.

IPython 5.4.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

Populating the interactive namespace from numpy and matplotlib

In [1]:sin
Out[1]: <ufunc 'sin'>

Version and main components

  • Spyder Version: 3.2.5
  • Python Version: 3.6.3
  • Qt Versions: 5.6.2, PyQt5 5.6 on Linux

Dependencies

pyflakes >=0.6.0 :  1.6.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.3 (OK)
numpy >=1.7      :  1.13.3 (OK)
sphinx >=0.6.6   :  1.6.5 (OK)
rope >=0.9.4     :  0.10.7 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
psutil >=0.3     :  5.4.0 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
cython >=0.21    :  0.27.2 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
IPython >=4.0    :  6.2.1 (OK)
pylint >=0.25    :  1.7.1 (OK)

@gb119
Copy link
Author

gb119 commented Dec 29, 2017

FWIW, here is the versioning info from my working Windows 7 Python 3.6 environment:

Version and main components

  • Spyder Version: 3.2.5
  • Python Version: 3.6.3
  • Qt Versions: 5.6.2, PyQt5 5.6 on Windows

Dependencies

pyflakes >=0.6.0 :  1.6.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.3 (OK)
numpy >=1.7      :  1.13.3 (OK)
sphinx >=0.6.6   :  1.6.3 (OK)
rope >=0.9.4     :  0.10.5 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
cython >=0.21    :  0.26.1 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
IPython >=4.0    :  6.1.0 (OK)
pylint >=0.25    :  1.7.4 (OK)

@gb119
Copy link
Author

gb119 commented Dec 29, 2017

Hmm, Ipython 6.2.1 (broken) versus 6.1.0 (working) significant?

@gb119
Copy link
Author

gb119 commented Dec 29, 2017

Ok, yes I can confirm that downgrading to IPython 6.1.0 fixes this issue - looks like something changed between 6.1 and 6.2.1 in a way that spyder didn't like... may not be a 3.2.5 problem at all.

@gb119 gb119 changed the title 3.2.5 Fails to preload numpy and pylab in console under Python 3.6 3.2.5 or IPython 6.2 Fails to preload numpy and pylab in console under Python 3.6 Dec 29, 2017
@ccordoba12 ccordoba12 added this to the v3.2.6 milestone Dec 30, 2017
@ccordoba12 ccordoba12 removed this from the v3.2.6 milestone Jan 2, 2018
@ccordoba12
Copy link
Member

I can't reproduce this on Linux. Please let us know if you find how to do it.

Also, please notice that Spyder is telling you this:

NOTE: Spyder can't set your selected Matplotlib backend because there is a previous backend already in use.

@gb119
Copy link
Author

gb119 commented Jan 2, 2018

Ok, I can reproduce it with the following steps:

conda create -n testing python=3.6.4 spyder=3.2.5
conda activate testing
conda install matplotlib
(yes I should have done this on the create line!)
spyder
-> Spyder starts all ok, so change the preferences for the i[ython console to automatically load numpy and pylab and set the matplotlib backed to automatic (I like to zoom and pan my plot windows:-) !)
-> Exit spyder
spyder
->Now it doesn't load the symbols
-> Preferences, put the mpl backed back to inline, quit spyder
spyder
-> loads numpy and pylab ok
conda install ipython==6.1.0
spyder
-> all ok, change backed back to automatic, exit spyder
spyder
-> all ok still

Here's my testing conda environment so you can see everything that is installed in it if that helps:

name: testing
channels:

  • defaults
    dependencies:
  • alabaster=0.7.10=py36h306e16b_0
  • asn1crypto=0.23.0=py36h4639342_0
  • astroid=1.5.3=py36hbdb9df2_0
  • babel=2.5.0=py36h7d14adf_0
  • bleach=2.1.1=py36hd521086_0
  • ca-certificates=2017.08.26=h1d4fec5_0
  • certifi=2017.11.5=py36hf29ccca_0
  • cffi=1.11.2=py36h2825082_0
  • chardet=3.0.4=py36h0f667ec_1
  • cloudpickle=0.5.2=py36h84cdd9c_0
  • cryptography=2.1.4=py36hd09be54_0
  • cycler=0.10.0=py36h93f1223_0
  • dbus=1.10.22=h3b5a359_0
  • decorator=4.1.2=py36hd076ac8_0
  • docutils=0.14=py36hb0f60f5_0
  • entrypoints=0.2.3=py36h1aec115_2
  • expat=2.2.5=he0dffb1_0
  • fontconfig=2.12.4=h88586e7_1
  • freetype=2.8=hab7d2ae_1
  • glib=2.53.6=h5d9569c_2
  • gmp=6.1.2=h6c8ec71_1
  • gst-plugins-base=1.12.2=he3457e5_0
  • gstreamer=1.12.2=h4f93127_0
  • html5lib=1.0.1=py36h2f9c1c0_0
  • icu=58.2=h9c2bf20_1
  • idna=2.6=py36h82fb2a8_1
  • imagesize=0.7.1=py36h52d8127_0
  • intel-openmp=2018.0.0=hc7b2577_8
  • ipykernel=4.7.0=py36h2f9c1c0_0
  • ipython=6.2.1=py36h88c514a_1
  • ipython_genutils=0.2.0=py36hb52b0d5_0
  • isort=4.2.15=py36had401c0_0
  • jedi=0.11.0=py36_2
  • jinja2=2.10=py36ha16c418_0
  • jpeg=9b=h024ee3a_2
  • jsonschema=2.6.0=py36h006f8b5_0
  • jupyter_client=5.1.0=py36h614e9ea_0
  • jupyter_core=4.4.0=py36h7c827e3_0
  • lazy-object-proxy=1.3.1=py36h10fcdad_0
  • libedit=3.1=heed3624_0
  • libffi=3.2.1=hd88cf55_4
  • libgcc-ng=7.2.0=h7cc24e2_2
  • libpng=1.6.32=hbd3595f_4
  • libsodium=1.0.15=hf101ebd_0
  • libstdcxx-ng=7.2.0=h7a57d05_2
  • libxcb=1.12=hcd93eb1_4
  • libxml2=2.9.4=h2e8b1d7_6
  • markupsafe=1.0=py36hd9260cd_1
  • matplotlib=2.1.1=py36ha26af80_0
  • mccabe=0.6.1=py36h5ad9710_1
  • mistune=0.8.1=py36h3d5977c_0
  • mkl=2018.0.1=h19d6760_4
  • nbconvert=5.3.1=py36hb41ffb7_0
  • nbformat=4.4.0=py36h31c9010_0
  • ncurses=6.0=h9df7e31_2
  • numpy=1.13.3=py36ha12f23b_0
  • numpydoc=0.7.0=py36h18f165f_0
  • openssl=1.0.2n=hb7f436b_0
  • pandoc=1.19.2.1=hea2e7c5_1
  • pandocfilters=1.4.2=py36ha6701b7_1
  • parso=0.1.1=py36h35f843b_0
  • pcre=8.41=hc27e229_1
  • pexpect=4.3.0=py36h673ed17_0
  • pickleshare=0.7.4=py36h63277f8_0
  • pip=9.0.1=py36h6c6f9ce_4
  • prompt_toolkit=1.0.15=py36h17d85b1_0
  • psutil=5.4.1=py36hecd8e42_0
  • ptyprocess=0.5.2=py36h69acd42_0
  • pycodestyle=2.3.1=py36hf609f19_0
  • pycparser=2.18=py36hf9f622e_1
  • pyflakes=1.6.0=py36h7bd6a15_0
  • pygments=2.2.0=py36h0d3125c_0
  • pylint=1.7.4=py36hb9d4533_0
  • pyopenssl=17.5.0=py36h20ba746_0
  • pyparsing=2.2.0=py36hee85983_1
  • pyqt=5.6.0=py36h0386399_5
  • pysocks=1.6.7=py36hd97a5b1_1
  • python=3.6.4=hc3d631a_0
  • python-dateutil=2.6.1=py36h88d3b88_1
  • pytz=2017.3=py36h63b9c63_0
  • pyzmq=16.0.3=py36he2533c7_0
  • qt=5.6.2=h974d657_12
  • qtawesome=0.4.4=py36h609ed8c_0
  • qtconsole=4.3.1=py36h8f73b5b_0
  • qtpy=1.3.1=py36h3691cc8_0
  • readline=7.0=ha6073c6_4
  • requests=2.18.4=py36he2e5f8d_1
  • rope=0.10.7=py36h147e2ec_0
  • setuptools=36.5.0=py36he42e2e1_0
  • simplegeneric=0.8.1=py36h2cb9092_0
  • sip=4.18.1=py36h51ed4ed_2
  • six=1.11.0=py36h372c433_1
  • snowballstemmer=1.2.1=py36h6febd40_0
  • sphinx=1.6.3=py36he5f0bdb_0
  • sphinxcontrib=1.0=py36h6d0f590_1
  • sphinxcontrib-websupport=1.0.1=py36hb5cb234_1
  • spyder=3.2.5=py36_0
  • sqlite=3.20.1=hb898158_2
  • testpath=0.3.1=py36h8cadb63_0
  • tk=8.6.7=hc745277_3
  • tornado=4.5.2=py36h1283b2a_0
  • traitlets=4.3.2=py36h674d592_0
  • typing=3.6.2=py36h7da032a_0
  • urllib3=1.22=py36hbe7ace6_0
  • wcwidth=0.1.7=py36hdf4376a_0
  • webencodings=0.5.1=py36h800622e_1
  • wheel=0.30.0=py36hfd4bba0_1
  • wrapt=1.10.11=py36h28b7045_0
  • xz=5.2.3=h55aa19d_2
  • zeromq=4.2.2=hbedb6e5_2
  • zlib=1.2.11=ha838bed_2
    prefix: /opt/anaconda/envs/testing

@ccordoba12 ccordoba12 added this to the v3.2.6 milestone Jan 2, 2018
@ccordoba12
Copy link
Member

I see, so the problem is with the Automatic backend. Thanks for tracking it down!

@ccordoba12 ccordoba12 modified the milestones: v3.2.6, v3.2.7 Jan 2, 2018
@ccordoba12
Copy link
Member

Still can't reproduce it, sorry.

@hiccup7
Copy link

hiccup7 commented Jan 3, 2018

I am seeing the same problem as @gb119 on Windows 8.1 in WinPython-64bit 3.6.4.0Qt5b2, which includes "spyder-3.2.6dev20171230+". My preferences include IPython console > Graphics > Backend=Qt5, so the problem is not only with the Automatic backend. I reverted this WinPython environment to Spyder 3.2.4, and the problem goes away.

@ccordoba12
Copy link
Member

I reproduced this problem, the key to it was restarting Spyder. I'll take a look at it for 3.2.6.

@hiccup7
Copy link

hiccup7 commented Jan 3, 2018

To reproduce the problem of "NOTE: Spyder can't set your selected Matplotlib backend because there is a previous backend already in use. Your backend will be Qt5Agg", the default preferences plus "IPython console > Graphics > Backend=Qt5" is sufficient. In other words, enabling "IPython console > Graphics > Automatically load Pylab and Numpy modules" is not necessary. Thus, the title of this PR could be changed to make the issue more clear. Something like "3.2.5 or IPython 6.2 Fails to use Qt5 or Automatic backend for matplotlib in Python 3.6".

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

4 participants