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

Plots not showing in Spyder 6 using external Python interpreter #22420

Open
ZiadHatab opened this issue Sep 3, 2024 · 24 comments
Open

Plots not showing in Spyder 6 using external Python interpreter #22420

ZiadHatab opened this issue Sep 3, 2024 · 24 comments

Comments

@ZiadHatab
Copy link

Hey, I installed the new Spyder 6. I set it up as usual with my existing Python interperter and installed all spyder dependcies as usual. However, for some reason, inline graphics with matplotlib no longer works for me.
image

When I try plotting with TK, a figure does pop up, but it gets frozen and nothing shows.
image

I'm using Python 3.12. This is the same python version I was using with Spyder 5.

Thanks!

@tlstevenson
Copy link

tlstevenson commented Sep 3, 2024

I am having this same exact problem and it also broke my Spyder 5.5.4 installation's ability to show plots. I have tried uninstalling and reinstalling Spyder 5.5.6, 5.5.5, and 5.5.4 and none of the versions worked. I have tried re-creating my conda environment and that didn't work. I have tried removing the .spyder-py3 settings folder and that didn't work. What could have permanently changed on my machine to permanently break plotting with a different python interpreter? I cannot work if I cannot generate plots.

Here is my conda environment:
Name Version Build Channel
anyio 4.2.0 py312haa95532_0
argon2-cffi 21.3.0 pyhd3eb1b0_0
argon2-cffi-bindings 21.2.0 py312h2bbff1b_0
asttokens 2.0.5 pyhd3eb1b0_0
async-lru 2.0.4 py312haa95532_0
attrs 23.1.0 py312haa95532_0
babel 2.11.0 py312haa95532_0
beautifulsoup4 4.12.3 py312haa95532_0
blas 1.0 mkl
bleach 4.1.0 pyhd3eb1b0_0
bottleneck 1.3.7 py312he558020_0
brotli 1.0.9 h2bbff1b_8
brotli-bin 1.0.9 h2bbff1b_8
brotli-python 1.0.9 py312hd77b12b_8
bzip2 1.0.8 h2bbff1b_6
ca-certificates 2024.7.2 haa95532_0
certifi 2024.7.4 py312haa95532_0
cffi 1.16.0 py312h2bbff1b_1
charset-normalizer 3.3.2 pyhd3eb1b0_0
cloudpickle 3.0.0 py312haa95532_0
colorama 0.4.6 py312haa95532_0
comm 0.2.1 py312haa95532_0
contourpy 1.2.0 py312h59b6b97_0
cycler 0.11.0 pyhd3eb1b0_0
debugpy 1.6.7 py312hd77b12b_0
decorator 5.1.1 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
executing 0.8.3 pyhd3eb1b0_0
expat 2.6.2 hd77b12b_0
filelock 3.13.1 py312haa95532_0
fonttools 4.51.0 py312h2bbff1b_0
freetype 2.12.1 ha860e81_0
fsspec 2024.6.1 py312haa95532_0
h5py 3.11.0 py312h59a1360_0
hdf5 1.12.1 h51c971a_3
icc_rt 2022.1.0 h6049295_2
icu 73.1 h6c2663c_0
idna 3.7 py312haa95532_0
intel-openmp 2023.1.0 h59b6b97_46320
ipykernel 6.28.0 py312haa95532_0
ipython 8.25.0 py312haa95532_0
jedi 0.19.1 py312haa95532_0
jinja2 3.1.4 py312haa95532_0
joblib 1.4.2 py312haa95532_0
jpeg 9e h827c3e9_3
json5 0.9.6 pyhd3eb1b0_0
jsonschema 4.19.2 py312haa95532_0
jsonschema-specifications 2023.7.1 py312haa95532_0
jupyter-lsp 2.2.0 py312haa95532_0
jupyter_client 8.6.0 py312haa95532_0
jupyter_core 5.7.2 py312haa95532_0
jupyter_events 0.10.0 py312haa95532_0
jupyter_server 2.14.1 py312haa95532_0
jupyter_server_terminals 0.4.4 py312haa95532_1
jupyterlab 4.0.11 py312haa95532_0
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 2.25.1 py312haa95532_0
kiwisolver 1.4.4 py312hd77b12b_0
krb5 1.20.1 h5b6d351_0
lcms2 2.12 h83e58a3_0
lerc 3.0 hd77b12b_0
libbrotlicommon 1.0.9 h2bbff1b_8
libbrotlidec 1.0.9 h2bbff1b_8
libbrotlienc 1.0.9 h2bbff1b_8
libclang 14.0.6 default_hb5a9fac_1
libclang13 14.0.6 default_h8e68704_1
libdeflate 1.17 h2bbff1b_1
libexpat 2.6.2 h63175ca_0 conda-forge
libffi 3.4.4 hd77b12b_1
libiconv 1.16 h2bbff1b_3
libpng 1.6.39 h8cc25b3_0
libpq 12.17 h906ac69_0
libsodium 1.0.18 h62dcd97_0
libsqlite 3.46.1 h2466b09_0 conda-forge
libtiff 4.5.1 hd77b12b_0
libuv 1.48.0 h827c3e9_0
libwebp-base 1.3.2 h2bbff1b_0
libxml2 2.13.1 h24da03e_2
libxslt 1.1.41 h0739af5_0
libzlib 1.2.13 h2466b09_6 conda-forge
lxml 5.2.1 py312h395c83e_1
lz4-c 1.9.4 h2bbff1b_1
markupsafe 2.1.3 py312h2bbff1b_0
matplotlib 3.9.2 py312haa95532_0
matplotlib-base 3.9.2 py312hbdc63d0_0
matplotlib-inline 0.1.6 py312haa95532_0
mistune 2.0.4 py312haa95532_0
mkl 2023.1.0 h6b88ed4_46358
mkl-service 2.4.0 py312h2bbff1b_1
mkl_fft 1.3.10 py312h827c3e9_0
mkl_random 1.2.7 py312h0158946_0
mpmath 1.3.0 py312haa95532_0
mysql-common 8.3.0 hde014ed_4 conda-forge
mysql-connector-python 8.3.0 py312h53d5487_0 conda-forge
mysql-libs 8.3.0 h8b0d2c3_4 conda-forge
nbclient 0.8.0 py312haa95532_0
nbconvert 7.10.0 py312haa95532_0
nbformat 5.9.2 py312haa95532_0
nest-asyncio 1.6.0 py312haa95532_0
networkx 3.3 py312haa95532_0
notebook 7.0.8 py312haa95532_2
notebook-shim 0.2.3 py312haa95532_0
numexpr 2.8.7 py312h96b7d27_0
numpy 1.26.4 py312hfd52020_0
numpy-base 1.26.4 py312h4dde369_0
openjpeg 2.5.2 hae555c5_0
openssl 3.3.1 h2466b09_3 conda-forge
overrides 7.4.0 py312haa95532_0
packaging 24.1 py312haa95532_0
pandas 2.2.2 py312h0158946_0
pandocfilters 1.5.0 pyhd3eb1b0_0
parso 0.8.3 pyhd3eb1b0_0
patsy 0.5.6 py312haa95532_0
pillow 10.4.0 py312h827c3e9_0
pip 24.2 py312haa95532_0
platformdirs 3.10.0 py312haa95532_0
ply 3.11 py312haa95532_1
prometheus_client 0.14.1 py312haa95532_0
prompt-toolkit 3.0.43 py312haa95532_0
prompt_toolkit 3.0.43 hd3eb1b0_0
psutil 5.9.0 py312h2bbff1b_0
pure_eval 0.2.2 pyhd3eb1b0_0
pybind11-abi 5 hd3eb1b0_0
pycparser 2.21 pyhd3eb1b0_0
pygments 2.15.1 py312haa95532_1
pyparsing 3.1.2 py312haa95532_0
pyqt 5.15.10 py312hd77b12b_0
pyqt5-sip 12.13.0 py312h2bbff1b_0
pysocks 1.7.1 py312haa95532_0
python 3.12.3 h2628c8c_0_cpython conda-forge
python-dateutil 2.9.0post0 py312haa95532_2
python-fastjsonschema 2.16.2 py312haa95532_0
python-json-logger 2.0.7 py312haa95532_0
python-pptx 0.6.23 py312haa95532_1
python-tzdata 2023.3 pyhd3eb1b0_0
python_abi 3.12 5_cp312 conda-forge
pytorch 2.3.0 cpu_py312h83d76c9_0
pytz 2024.1 py312haa95532_0
pywin32 305 py312h2bbff1b_0
pywinpty 2.0.10 py312h5da7b33_0
pyyaml 6.0.1 py312h2bbff1b_0
pyzmq 25.1.2 py312hd77b12b_0
qt-main 5.15.2 h19c9488_10
referencing 0.30.2 py312haa95532_0
requests 2.32.3 py312haa95532_0
rfc3339-validator 0.1.4 py312haa95532_0
rfc3986-validator 0.1.1 py312haa95532_0
rpds-py 0.10.6 py312h062c2fa_0
scikit-learn 1.5.1 py312h0158946_0
scipy 1.13.1 py312hbb039d4_0
seaborn 0.13.2 py312haa95532_0
send2trash 1.8.2 py312haa95532_0
setuptools 72.1.0 py312haa95532_0
sip 6.7.12 py312hd77b12b_0
six 1.16.0 pyhd3eb1b0_1
sniffio 1.3.0 py312haa95532_0
soupsieve 2.5 py312haa95532_0
spyder-kernels 2.5.0 py312haa95532_0
sqlite 3.45.3 h2bbff1b_0
stack_data 0.2.0 pyhd3eb1b0_0
statsmodels 0.14.2 py312h4b0e54e_0
sympy 1.13.2 py312haa95532_0
tbb 2021.8.0 h59b6b97_0
terminado 0.17.1 py312haa95532_0
threadpoolctl 3.5.0 py312hfc267ef_0
tinycss2 1.2.1 py312haa95532_0
tk 8.6.14 h0416ee5_0
tornado 6.4.1 py312h827c3e9_0
traitlets 5.14.3 py312haa95532_0
typing-extensions 4.11.0 py312haa95532_0
typing_extensions 4.11.0 py312haa95532_0
tzdata 2024a h04d1e81_0
ucrt 10.0.20348.0 haa95532_0
unicodedata2 15.1.0 py312h2bbff1b_0
urllib3 2.2.2 py312haa95532_0
vc 14.40 h2eaa2aa_0
vc14_runtime 14.40.33810 hcc2c482_20 conda-forge
vs2015_runtime 14.40.33810 h3bf8584_20 conda-forge
wcwidth 0.2.5 pyhd3eb1b0_0
webencodings 0.5.1 py312haa95532_2
websocket-client 1.8.0 py312haa95532_0
wheel 0.43.0 py312haa95532_0
win_inet_pton 1.1.0 py312haa95532_0
winpty 0.4.3 4
xlsxwriter 3.1.1 py312haa95532_0
xz 5.4.6 h8cc25b3_1
yaml 0.2.5 he774522_0
zeromq 4.3.5 hd77b12b_0
zlib 1.2.13 h2466b09_6 conda-forge
zstd 1.5.5 hd43e919_2

@lwq-star
Copy link

lwq-star commented Sep 4, 2024

When I update spyder to 6, I have same problem.

@elliothowell
Copy link

Depending on how you all installed, I managed to "fix" it by just downgrading via "pip install spyder=5.5.6" via the pip installation.
If you have installed spyder via a standalone installer its a similar method with conda, etc.

@angelo-ml
Copy link

Hi all,
I face the same issue, when I run the console in a specific conda environment.

I have tested that when I create a new environment, after installing spyder-kernels 3.0, everything works fine.

I have already checked that the environment I have issues with, has the updated versions of: spyder-kernels, matplotlib, matplotlib-inline, python 3.9, ipykernel. So, apparently, there is a conflict with some other package(s) installed there.

If you want to use the latest version of Spyder, and you face similar issues, I guess the most straightforward solution is creating a new environment with spyder-kernels 3, and reinstall there any extra packages you may need.

@tlstevenson
Copy link

Hi all, I face the same issue, when I run the console in a specific conda environment.

I have tested that when I create a new environment, after installing spyder-kernels 3.0, everything works fine.

I have already checked that the environment I have issues with, has the updated versions of: spyder-kernels, matplotlib, matplotlib-inline, python 3.9, ipykernel. So, apparently, there is a conflict with some other package(s) installed there.

If you want to use the latest version of Spyder, and you face similar issues, I guess the most straightforward solution is creating a new environment with spyder-kernels 3, and reinstall there any extra packages you may need.

Thanks for sharing. I did make a new conda environment from a yml file, but that still didn't work. Would you mind sharing your conda environment so I can see what may be different with mine?

@angelo-ml
Copy link

Environments typically have hundreds of packages, and it's not obvious which packages are related to this issue.
So, I wouldn't recommend you checking this manually.

I have deleted the testing one I created, but you can create a similar one using

conda create -n spyder_env python=3.10 spyder-kernels=3 matplotlib

First, open spyder, create a console in this new environment, and test if the plots are working properly, with something like:

from matplotlib import pyplot as plt; plt.plot([1,2,3])

If it works, then you can re-install there the rest of the packages you need, or you can export the packages of the new evironment, and check their installed versions.

@dalthviz
Copy link
Member

dalthviz commented Sep 6, 2024

Hi everyone and thank you for the reports and feedback posted here! I would say as @angelo-ml that seems like there is some sort of version incompatibility causing issues here. Checking as @tlstevenson pointed this maybe is related with #22224 It would be nice to trace the specific packages combination causing this behavior and @angelo-ml suggestion (creating a new env, checking if the plots work or not while re-installing needed packages one by one) could help. If anyone runs this kind of test let us know!

@tlstevenson
Copy link

I have deleted the testing one I created, but you can create a similar one using

conda create -n spyder_env python=3.10 spyder-kernels=3 matplotlib

First, open spyder, create a console in this new environment, and test if the plots are working properly, with something like:

from matplotlib import pyplot as plt; plt.plot([1,2,3])

If it works, then you can re-install there the rest of the packages you need, or you can export the packages of the new evironment, and check their installed versions.

I have tried this with python 3.10, 3.11, and 3.12 and none of them worked. I even tried updating IPython to 8.27.0 as mentioned here and that didn't work as well. Perhaps there is some other package that needs to be updated to work? @angelo-ml would you mind creating a basic environment that works on your end and sharing the installed packages so I can compare with mine?

@tlstevenson
Copy link

Okay, I have figured out what was wrong in my own environments! All I had to do was update matplotlib-inline from 0.1.6 (the default installed by miniconda) to 0.1.7. I hope this helps someone else!

@jitseniesen
Copy link
Member

Thanks a lot, I managed to reproduce the issue with that hint. For the record, here are the versions that I tried and their result (no other packages changed except for matplotlib-base which always has the same version as matplotlib):

  • matplotlib 3.9.1, matplotlib-inline 0.1.7: Plots are displayed.
  • matplotlib 3.9.1, matplotlib-inline 0.1.6 or 0.1.5: Plots are not displayed.
  • matplotlib 3.8.4, matplotlib-inline 0.1.7 or 0.1.6 or 0.1.5: Plots are displayed.

Looking at the changes in matplotlib-inline, the only relevant one seems to be ipython/matplotlib-inline#34.

@salashhab
Copy link

salashhab commented Sep 12, 2024

IF you run ipython --matplotlib qt directly on windows powershell it will draw it. But not from Spyder v6

`import matplotlib.pyplot as plt
%matplotlib qt

plt.figure(figsize=(10, 6))
plt.plot([1, 2, 3], [4, 5, 6])
plt.show()`

@jitseniesen
Copy link
Member

I am seeing the same problem with Jupyter Lab. If I install matplotlib 3.9.1 and matplotlib-inline 0.1.6 then the following code (from the matploblib-inline readme) in a notebook does not show a plot:

%matplotlib inline

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 3*np.pi, 500)
plt.plot(x, np.sin(x**2))
plt.title('A simple chirp');

@ccordoba12 Is it worthwhile to report this as an issue to the Jupyter people?

@ccordoba12
Copy link
Member

Let me think about it and I'll let you know. We should be able to submit a PR upstream to fix this.

@danilo-css
Copy link

danilo-css commented Sep 16, 2024

I am also having the same issue. These are the basic specs of my environment:

Python 3.11
Spyder 6.0.0
Windows 10

Downgrading to 5.5.6 with

pip install --upgrade "spyder==5.5.6"

fixes it for the time being.

@soonawan
Copy link

Update all packages specially Matplotlib, plotly etc It works ,

use

pip list --outdated

Open a command shell by typing ‘powershell’ in the Search Box of the Task bar
Enter:

pip freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}

@hirennan
Copy link

Thanks a lot, I managed to reproduce the issue with that hint. For the record, here are the versions that I tried and their result (no other packages changed except for matplotlib-base which always has the same version as matplotlib):

* matplotlib 3.9.1, matplotlib-inline 0.1.7: Plots are displayed.

* matplotlib 3.9.1, matplotlib-inline 0.1.6 or 0.1.5: Plots are **not** displayed.

* matplotlib 3.8.4, matplotlib-inline 0.1.7 or 0.1.6 or 0.1.5: Plots are displayed.

Looking at the changes in matplotlib-inline, the only relevant one seems to be ipython/matplotlib-inline#34.

I tried the combination of matplotlib 3.9.1, matplotlib-inline 0.1.7 but the issue seems to persist for me

@ccordoba12
Copy link
Member

@hirennan, you also need to update IPython (8.27.0) to its latest version to work with the latest matplotlib and matplotlib-inline versions.

Please do that and report back.

@RocketCityElectromagnetics
Copy link

RocketCityElectromagnetics commented Sep 20, 2024

I am using matplotlib 3.9.2, matpltolib-inline 0.1.7, ipython 8.27.0 and spyder 6.0.0 and on my personal laptop (i3-5020U running Win 10 Home 22H2 19045.4894) and my office PC (i9-7900X Win 10 Pro 22H2 19045.4170) and plots still work on my personal laptop (in the theme of this thread -- "do not work" translates to "do not plot in the Spyder IDE"), they do not work on my office PC. I rolled back the matplotlib and matplotlib-inline to a few versions on separate attempets to no avail. I tried rolling back Spyder. When I roll back Spyder to 5.5.6, it works on my office PC regardless of combinations of matplotlib, matplotlib-inline and ipython (at least with respect to all combination of versions within the past year). Matplotlib does not work in any of the Spyder 6 release candidates on my office PC. Again, on my personal laptop, Spyder 6 and matplotlib play nice together. Could this be due to my office using the stable enterprise edition of Windows which lags a bit -- version 19045.4170 vs 19045.4894? Would there be any GP settings keeping any of the modules from properly installing (I believe this is normally only the case for things like the NVidia CUDA modules which compile for machine-specific configurations, like cupy, but I may be wrong, and I even learned a means to compile cupy that makes my GP happy, eseentially I was initially oversimplifiying the process expecting niavely 'pip install cupy' to work or 'pip install cupy-cuda117' to work. It wasn't that simple but not difficult either).

@hirennan
Copy link

@ccordoba12 I updated IPython to the latest version (8.27.0) but I was still unable to view plots. Finally, downgraded from Spyder 6.0.0 to 5.5.6 and the issue seems to be resolved

@ccordoba12
Copy link
Member

@hirennan or @RocketCityElectromagnetics, could you try our Windows installer? The error shouldn't be present in it.

@hirennan
Copy link

@ccordoba12 Im on a macos machine, so I can't run the windows installer. Please me know if there's anything I can help with

@ccordoba12
Copy link
Member

Sorry, then please download ans install Spyder using our Mac installer (you can grab it from the same link I posted above).

@hirennan
Copy link

@ccordoba12 I should've mentioned this earlier but I installed Spyder 6.0 via the Mac installer. When I downgraded to 5.5.6 (currently on) I did it via the Mac installer available on the releases page. Please find the matplotlib and other relevant packages versions being used currently below

  • matplotlib: 3.9.1
  • matplotlib-inline: 0.1.7
  • spyder-kernels: 2.5.2

@laurcopp
Copy link

Hi,
Same issue but I have updated all packages and it works perfectly now with Spyder 6:
pip list --outdated
pip install pip-review
pip-review --local --auto

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