spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.21k stars 1.59k forks source link

spyder variable explorer breaks when using dask #17400

Open jyk4100 opened 2 years ago

jyk4100 commented 2 years ago

Description

What steps will reproduce the problem?

import pandas as pd
from dask import dataframe as dd
df = pd.DataFrame({'x':range(1,10), 'y':range(10,1,-1)})
ddf = dd.from_pandas(df, npartitions=2)

after this line error window pops and variable explorer stops working

Traceback

Exception in comms call get_namespace_view:
  File "/Applications/Spyder.app/Contents/Resources/lib/python3.9/spyder_kernels/comms/commbase.py", line 317, in _comm_message
ModuleNotFoundError: No module named 'dask'

Versions

Dependencies

# Mandatory:
applaunchservices >=0.1.7     :  0.2.1 (OK)
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0;<8.0.0        :  7.31.1 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.4.0 (OK)
keyring >=17.0.0              :  23.5.0 (OK)
nbconvert >=4.0               :  6.4.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.0 (OK)
pygments >=2.0                :  2.11.2 (OK)
pylint >=2.5.0                :  2.12.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.3.2;<1.4.0          :  1.3.3 (OK)
pylsp_black >=1.0.0           :  1.0.1 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.2.1;<5.3.0      :  5.2.2 (OK)
qtpy >=1.5.0                  :  2.0.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  60.5.0 (OK)
sphinx >=0.6.6                :  4.4.0 (OK)
spyder_kernels >=2.2.1;<2.3.0 :  2.2.1 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.6 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  0.29.26 (OK)
matplotlib >=2.0.0            :  3.5.1 (OK)
numpy >=1.7                   :  1.22.1 (OK)
pandas >=1.1.1                :  1.3.5 (OK)
scipy >=0.17.0                :  1.7.3 (OK)
sympy >=0.7.3                 :  1.9 (OK)
steff456 commented 2 years ago

Hi @jyk4100,

You need to install dask in your environment for it to work. If you installed Spyder using the installers, please follow this tutorial to create your development environment and connect it to the app, https://www.youtube.com/watch?v=i7Njb3xO4Fw

Please let me know if you are able to fix the error

jyk4100 commented 2 years ago

Hello @steff456 thanks for the comment. Sorry I didn't add much detail on my setup. I have standalone Spyder installed on my local machine. I am connecting to a conda virtual environment with dask and spyder-kernels installed from a headless remote machine. Were you suggesting that dask and spyder has to be installed on the same conda environment for the variable explorer to work?

steff456 commented 2 years ago

Hi @jyk4100,

Your setup should work in Spyder if you change the python interpreter option, can you let me know if you already change it in preferences?

jyk4100 commented 2 years ago

Hello I have dask installed on both my local interpreter and my remote interpreter that I am connecting through spyder-kernels and still facing same issue with both local and remote interpreter. Once I call any dask function, spyder says "Spyder has encountered an internal problem!" and the error message below. Then the variable explorer stops working i.e. new objected defined but doesn't show up until I restart Spyder.

Exception in comms call get_namespace_view: File "/Applications/Spyder.app/Contents/Resources/lib/python3.9/spyder_kernels/comms/commbase.py", line 317, in _comm_message ModuleNotFoundError: No module named 'dask'

jyk4100 commented 2 years ago

Not sure why the error message is pointing to the python interpreter that came along with Spyder standalone installation when I am not sure that interpreter. I tried installing any python pkg on the interpreter but pip is not installed and I am still figuring out how to

steff456 commented 2 years ago

Hi @jyk4100!

Is this error still happening in the latest version of Spyder?