Repository: spyder-ide/spyder

Issue:
Running the size of a dask dataframe file
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

import dask.dataframe as dd
file = dd.read_csv(v_file)
file.size

### Traceback
```python-traceback
  File "C:\ProgramData\Anaconda3\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\ProgramData\Anaconda3\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 330, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 265, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 473, in _handle_remote_call_reply
    callback(buffer)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 399, in process_remote_view
    self.set_data(remote_view)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 408, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\ProgramData\Anaconda3\lib\site-packages\dask\delayed.py", line 582, in __bool__
    raise TypeError("Truth of Delayed objects is not supported")
TypeError: Truth of Delayed objects is not supported
ERROR:traitlets:Exception in comm_msg for 0802096347bb11ecaa213814288c76e5
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\ProgramData\Anaconda3\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 330, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 265, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 473, in _handle_remote_call_reply
    callback(buffer)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 399, in process_remote_view
    self.set_data(remote_view)
  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 408, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\ProgramData\Anaconda3\lib\site-packages\dask\delayed.py", line 582, in __bool__
    raise TypeError("Truth of Delayed objects is not supported")
TypeError: Truth of Delayed objects is not supported
```

## Versions

* Spyder version: 4.2.5 
* Python version: 3.8.8
* Qt version: 5.9.7
* PyQt5 version: 5.9.2
* Operating System: Windows 10

### Dependencies

```

# Mandatory:
atomicwrites >=1.2.0            :  1.4.0 (OK)
chardet >=2.0.0                 :  4.0.0 (OK)
cloudpickle >=0.5.0             :  1.6.0 (OK)
diff_match_patch >=20181111     :  20200713 (OK)
intervaltree >=3.0.2            :  3.1.0 (OK)
IPython >=7.6.0                 :  7.22.0 (OK)
jedi =0.17.2                    :  0.17.2 (OK)
jsonschema >=3.2.0              :  3.2.0 (OK)
keyring >=17.0.0                :  22.3.0 (OK)
nbconvert >=4.0                 :  6.0.7 (OK)
numpydoc >=0.6.0                :  1.1.0 (OK)
paramiko >=2.4.0                :  2.7.2 (OK)
parso =0.7.0                    :  0.7.0 (OK)
pexpect >=4.4.0                 :  4.8.0 (OK)
pickleshare >=0.4               :  0.7.5 (OK)
psutil >=5.3                    :  5.8.0 (OK)
pygments >=2.0                  :  2.8.1 (OK)
pylint >=1.0                    :  2.7.4 (OK)
pyls >=0.36.2;<1.0.0            :  0.36.2 (OK)
pyls_black >=0.4.6              :  0.4.6 (OK)
pyls_spyder >=0.3.2             :  0.3.2 (OK)
qdarkstyle >=2.8;<3.0           :  2.8.1 (OK)
qtawesome >=0.5.7               :  1.0.2 (OK)
qtconsole >=5.0.3               :  5.0.3 (OK)
qtpy >=1.5.0                    :  1.9.0 (OK)
rtree >=0.8.3                   :  0.9.7 (OK)
setuptools >=39.0.0             :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                  :  4.0.1 (OK)
spyder_kernels >=1.10.2;<1.11.0 :  1.10.2 (OK)
textdistance >=4.2.0            :  4.2.1 (OK)
three_merge >=0.1.1             :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0        :  1.0.2 (OK)
zmq >=17                        :  20.0.0 (OK)

# Optional:
cython >=0.21                   :  0.29.23 (OK)
matplotlib >=2.0.0              :  3.3.4 (OK)
numpy >=1.7                     :  1.20.1 (OK)
pandas >=1.1.1                  :  1.2.4 (OK)
scipy >=0.17.0                  :  1.6.2 (OK)
sympy >=0.7.3                   :  1.8 (OK)
```



Discussion:
Hi @HariGovindSatheesan thank you for the feedback. I think the issue here is that you need to call `compute()` to get the size of the Dask dataframe if you use the `size` attributte. So `file.size.compute()` instead of `file.size`.

However, checking the traceback, how is this error happening to you? You just created the variable and the issues raises or you call directly `file.size`?

Let us know!
Closing due to lack of response
@dalthviz, I think this is a bug in our side and I was able to reproduce it.

@HariGovindSatheesan, we'll try to fix it in a future release.
@ccordoba12 I was checking this and the following code worked for me using Spyder 5.2.2:

```python
import dask
import dask.dataframe as dd
df = dask.datasets.timeseries()
```

![imagen](https://user-images.githubusercontent.com/16781833/157294663-08954298-2797-4338-aadf-40285d3601d3.png)

And in the variable explorer I can see the `df` variable if I have the `Exclude unsupported data types` option unchecked:

![imagen](https://user-images.githubusercontent.com/16781833/157294845-e74697b9-720b-4e7b-b385-401c18bbdd5d.png)

Double clicking the variable brings the Object Explorer:

![imagen](https://user-images.githubusercontent.com/16781833/157295177-5cefc74e-a096-4846-9321-ac3721761956.png)

Edit: Actually, now that I see the cmd from where I launched Spyder, a traceback appears:

<details>

```
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 609, in <lambda>
    return lambda *args, **kwargs: method(*args, **kwargs)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 659, in __call__
    return call_function(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 636, in call_function
    graph = HighLevelGraph.from_collections(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\highlevelgraph.py", line 701, in from_collections
    deps[name] |= set(collection.__dask_layers__())
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 516, in __dask_layers__
    return (self._layer,)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 553, in __getattr__
    raise AttributeError(f"Attribute {attr} not found")
AttributeError: Attribute _layer not found
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 609, in <lambda>
    return lambda *args, **kwargs: method(*args, **kwargs)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 659, in __call__
    return call_function(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 636, in call_function
    graph = HighLevelGraph.from_collections(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\highlevelgraph.py", line 701, in from_collections
    deps[name] |= set(collection.__dask_layers__())
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 516, in __dask_layers__
    return (self._layer,)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 553, in __getattr__
    raise AttributeError(f"Attribute {attr} not found")
AttributeError: Attribute _layer not found
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 609, in <lambda>
    return lambda *args, **kwargs: method(*args, **kwargs)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 659, in __call__
    return call_function(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 636, in call_function
    graph = HighLevelGraph.from_collections(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\highlevelgraph.py", line 701, in from_collections
    deps[name] |= set(collection.__dask_layers__())
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 516, in __dask_layers__
    return (self._layer,)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 553, in __getattr__
    raise AttributeError(f"Attribute {attr} not found")
AttributeError: Attribute _layer not found
INFO: Kernel command: ['C:\\Users\\dalth\\anaconda3\\envs\\spy5\\python.exe', '-m', 'spyder_kernels.console', '-f', '{connection_file}']
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 597, in __bool__
    raise TypeError("Truth of Delayed objects is not supported")
TypeError: Truth of Delayed objects is not supported
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 609, in <lambda>
    return lambda *args, **kwargs: method(*args, **kwargs)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 659, in __call__
    return call_function(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 636, in call_function
    graph = HighLevelGraph.from_collections(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\highlevelgraph.py", line 701, in from_collections
    deps[name] |= set(collection.__dask_layers__())
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 516, in __dask_layers__
    return (self._layer,)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 553, in __getattr__
    raise AttributeError(f"Attribute {attr} not found")
AttributeError: Attribute _layer not found
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 597, in __bool__
    raise TypeError("Truth of Delayed objects is not supported")
TypeError: Truth of Delayed objects is not supported
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 609, in <lambda>
    return lambda *args, **kwargs: method(*args, **kwargs)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 659, in __call__
    return call_function(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 636, in call_function
    graph = HighLevelGraph.from_collections(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\highlevelgraph.py", line 701, in from_collections
    deps[name] |= set(collection.__dask_layers__())
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 516, in __dask_layers__
    return (self._layer,)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 553, in __getattr__
    raise AttributeError(f"Attribute {attr} not found")
AttributeError: Attribute _layer not found
ERROR: Exception in comm_msg for %s
Traceback (most recent call last):
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 176, in comm_msg
    comm.handle_msg(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\qtconsole\comms.py", line 264, in handle_msg
    return self._msg_callback(msg)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 333, in _comm_message
    self._message_handlers[spyder_msg_type](
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 289, in _handle_remote_call_reply
    super(KernelComm, self)._handle_remote_call_reply(
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder_kernels\comms\commbase.py", line 476, in _handle_remote_call_reply
    callback(buffer)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 74, in set_namespace_view
    self.namespacebrowser.process_remote_view(view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 151, in process_remote_view
    self.set_data(remote_view)
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 160, in set_data
    if data != self.editor.source_model.get_data():
  File "C:\Users\dalth\anaconda3\envs\spy5\lib\site-packages\dask\delayed.py", line 597, in __bool__
    raise TypeError("Truth of Delayed objects is not supported")
TypeError: Truth of Delayed objects is not supported
```

</details>







Resolving patch:
diff --git a/external-deps/spyder-kernels/spyder_kernels/utils/nsview.py b/external-deps/spyder-kernels/spyder_kernels/utils/nsview.py
--- a/external-deps/spyder-kernels/spyder_kernels/utils/nsview.py
+++ b/external-deps/spyder-kernels/spyder_kernels/utils/nsview.py
@@ -85,8 +85,19 @@ def try_to_eval(value):
 def get_size(item):
     """Return shape/size/len of an item of arbitrary type"""
     try:
-        if (hasattr(item, 'shape') and
-                isinstance(item.shape, (tuple, np.integer))):
+        if (
+            hasattr(item, 'size') and hasattr(item.size, 'compute') or
+            hasattr(item, 'shape') and hasattr(item.shape, 'compute')
+        ):
+            # This is necessary to avoid an error when trying to
+            # get the size/shape of dask objects. We don't compute the
+            # size/shape since such operation could be expensive.
+            # Fixes spyder-ide/spyder#16844
+            return 1
+        elif (
+            hasattr(item, 'shape') and
+            isinstance(item.shape, (tuple, np.integer))
+        ):
             try:
                 if item.shape:
                     # This is needed since values could return as


Test patch: