Spyder: Variables don't show up or refresh in variable explorer on fresh install of Anaconda.

Created on 7 Jun 2018  路  8Comments  路  Source: spyder-ide/spyder

Problem Description

On a fresh install of Anaconda (June 7th 2018), Spyder is not updating the variables in the variable explorer after each execution. In addition, after running the code once I can no longer change what variable types are displayed through the options gear. I updated Sypder (through anaconda) and reset it through the command prompt.

For example, if I run,
n=100

the variable explores says n=100, but if I then run

n=0

the variable explores still reads n=100 even though python gives me n=0 if I type n into the terminal.

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

  • Spyder version: 3.2.8
  • Python version: 3.6.5
  • Qt version: 5.9.4
  • PyQt version: 5.9.2
  • Operating System name/version: Windows 10

Dependencies

IPython >=4.0    :  6.4.0 (OK)
cython >=0.21    :  0.28.2 (OK)
jedi >=0.9.0     :  0.12.0 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
numpy >=1.7      :  1.14.3 (OK)
pandas >=0.13.1  :  0.23.0 (OK)
pycodestyle >=2.3:  2.4.0 (OK)
pyflakes >=0.6.0 :  1.6.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.8.4 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
rope >=0.9.4     :  0.10.7 (OK)
sphinx >=0.6.6   :  1.7.4 (OK)
sympy >=0.7.3    :  1.1.1 (OK)

IPython Console Bug

Most helpful comment

variable explorer bug (not showing new variables, or clean up after restart kernel) is still exist! (Spyder V4.1.3)

All 8 comments

We have several tests for this and they are passing without problems. So unless you can give us more details about your setup or problem, I'm afraid we'll have to close this issue.

Sorry, I did a poor job troubleshooting. I have tracked the problem to the resetting of the IPython consul every time I run the code. I use the code,

from IPython import get_ipython
get_ipython().magic('reset -sf')

That I got from your comment in issue #2563. This is causing the variable explorer to disconnect from the consul. If I remove the s for soft reset the code works but an error is returned. To expand, running

from IPython import get_ipython
get_ipython().magic('reset -f')

returns

`runfile('C:/Users/cceelab/Downloads/temp.py', wdir='C:/Users/cceelab/Downloads')
Traceback (most recent call last):

  File "<ipython-input-13-45252b3bd8bf>", line 1, in <module>
    runfile('C:/Users/cceelab/Downloads/temp.py', wdir='C:/Users/cceelab/Downloads')

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 709, in runfile
    namespace.pop('__file__')

KeyError: '__file__'`

While it does return an error, the code does execute and the variable explorer does update. Again, sorry for my less than perfect troubleshooting before. I use this on all my code so I forgot it was there.

Best,
Austin.

from IPython import get_ipython
get_ipython().magic('reset -sf')

This code resets your namespace, i.e. it removes all variables present in your console. That's why the variable explorer shows you an empty view after you run it.

I don't understand what you want to achieve by adding it to the code you're running in Spyder, but instead of doing it, you can simply go to the menu

Run > Configuration per file

or

Tools > Preferences > Run

and select the option called Remove all variables before execution to have the same effect, without errors.

I feel that I have not done an excellent job explaining the issue I have, so I created two videos. The first shows a simple code working on Spyder 3.2.6, and the second shows the same code not working in Spyder 3.2.8 while also showing how the variable explorer's response to different inputs.

First, here is the code working in Spyder 3.2.6
https://www.youtube.com/watch?v=kvzjD0QdKlQ&feature=youtu.be

and not working in Spyder 3.2.8
https://www.youtube.com/watch?v=LEmf7z_LXbc&feature=youtu.be

This is the code I am running, where the n=2 is after IP.get_ipython().magic('reset -sf'). In this case, I should be left with n=2 in the variable explorer.

import IPython as IP
IP.get_ipython().magic('reset -sf')
n=2

I know I can use the clear option under Tools > Preferences > Run but I build code on Python that I also run on a cluster and the IPython command is a helpful check is those cases. Lastly, I think IPython should run in spyder without any interference. (I know that is a bold thing to say when I am not the one writing the code)

Again, thanks for all your hard work.

Best,
Austin.

Thanks for the videos. I'll take a look at this during the weekend.

from IPython import get_ipython
get_ipython().magic('reset -sf')

Variable explorer stopped functioning after I used the above commands. I had to install Spyder again and everything is fine now. Not sure about the logic.

This is fixed in our latest release (3.3.6).

variable explorer bug (not showing new variables, or clean up after restart kernel) is still exist! (Spyder V4.1.3)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ok97465 picture ok97465  路  3Comments

goanpeca picture goanpeca  路  3Comments

JesterEE picture JesterEE  路  3Comments

marianux picture marianux  路  3Comments

danieltomasz picture danieltomasz  路  3Comments