question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spyder was unable to retrieve the value of this variable from the console

See original GitHub issue

Problem Description

I am unable to observe the variable, as in the photo:

1615325185235

What steps reproduce the problem?

  1. Spyder version: 4.2.1
  2. Python version: 3.7.9

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

I should be able to read the variable in the variable explorer, but I failed to have that.

Paste Traceback/Error Below (if applicable)


  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 344, in _handle_remote_call
    self._set_call_return_value(msg_dict, return_value)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 382, in _set_call_return_value
    comm_id=self.calling_comm_id)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 245, in _send_message
    data, protocol=self._comms[comm_id]['pickle_protocol'])]

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/site-packages/cloudpickle/cloudpickle.py", line 1148, in dumps
    cp.dump(obj)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/site-packages/cloudpickle/cloudpickle.py", line 491, in dump
    return Pickler.dump(self, obj)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 437, in dump
    self.save(obj)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 819, in save_list
    self._batch_appends(obj)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 843, in _batch_appends
    save(x)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 819, in save_list
    self._batch_appends(obj)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 846, in _batch_appends
    save(tmp[0])

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)

  File "/Users/yuyang01/miniconda3/envs/py38/lib/python3.7/pickle.py", line 524, in save
    rv = reduce(self.proto)

TypeError: can't pickle _thread.RLock objects

Versions

  • Spyder version: 4.2.1
  • Python version: 3.7.9
  • Qt version: 5.9.6
  • PyQt version: 5.9.2
  • Operating System name/version: Darwin 18.7.0

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             :  1.3.0 (OK)
diff_match_patch >=20181111     :  20200713 (OK)
intervaltree >=3.0.2            :  3.1.0 (OK)
IPython >=7.6.0                 :  7.21.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)
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.0 (OK)
pylint >=1.0                    :  2.7.2 (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.0             :  0.3.2 (OK)
qdarkstyle >=2.8                :  2.8.1 (OK)
qtawesome >=0.5.7               :  1.0.1 (OK)
qtconsole >=5.0.1               :  5.0.2 (OK)
qtpy >=1.5.0                    :  1.9.0 (OK)
rtree >=0.8.3                   :  0.9.4 (OK)
setuptools >=39.0.0             :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                  :  3.5.1 (OK)
spyder_kernels >=1.10.1;<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               :  1.0.2 (OK)
zmq >=17                        :  20.0.0 (OK)

# Optional:
cython >=0.21                   :  None (NOK)
matplotlib >=2.0.0              :  3.3.4 (OK)
numpy >=1.7                     :  1.19.2 (OK)
pandas >=1.1.1                  :  1.2.3 (OK)
scipy >=0.17.0                  :  1.6.1 (OK)
sympy >=0.7.3                   :  None (NOK)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Mar 10, 2021

I like the idea of making the variable explorer just say this that the variable isn’t readable. I scratched my head to determine what was wrong, but I couldn’t figure it out. I’ve had the same issue pop up, but when using the pint module

Ok, we’ll improve our current message to be clearer about it.

Is there a way to see all of the available information and just mark the parts that are not available anymore?

No, there isn’t, sorry. That’s not a limitation on Spyder but on the way Python itself works.

I can look in sim1, but sim2 gives the ‘TypeError: cannon pickle ‘weakref’ object’ message

It’s the same problem as before @yywangvr. There are some objects whose contents can be retrieved to be displayed in the Variable Explorer.

0reactions
ccordoba12commented, Mar 16, 2021

It probably should just say: “This is not a pickable variable, no value to show” instead of the 6 lines error message.

The problem is most people don’t know what “pickable” is and they need to know we can’t solve this error so they don’t need to report it on Github.

Or we just show the text in the variable editor, e.g.: “lock object of _thread module” when we are unable to get more infos.

I like this idea. We could show a similar message to the one we’re showing now and the error in another widget that is hidden by default (in much the same way as the error report dialog works).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spyder was unable to retrieve the value depends on ... - GitHub
In the variable explorer I get the error message "Spyder was unable to retrieve the value of this variable from the console.
Read more >
"Spyder was unable to retrieve the value of this variable" after ...
So, I had to downgrade my Pandas package to 1.3. 5 version using pip install -Iv --user pandas==1.3. 5 on cmd , and...
Read more >
Spyder was unable to retrieve the value of this variable from ...
This is a spyder-related bug, and from an MNE perspective, there is nothing that can be done. You can however use the console...
Read more >
Variable Explorer not showing anything? - Google Groups
You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails...
Read more >
spyder-ide/public - Gitter
I have been using Spyder through the Anaconda Navigator setup for a while now, ... was unable to retrieve the value of this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found