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

Variable Explorer is not showing variables in debug mode #3711

Closed
Paul-Yuchao-Dong opened this issue Nov 20, 2016 · 14 comments
Closed

Variable Explorer is not showing variables in debug mode #3711

Paul-Yuchao-Dong opened this issue Nov 20, 2016 · 14 comments

Comments

@Paul-Yuchao-Dong
Copy link

Paul-Yuchao-Dong commented Nov 20, 2016

Description of your problem

Variable Explorer not working with ipdb.

First off, let me say spyder is amazing, it is so far the only IDE that allow me to debug my code with ease and observe the variable changes, and that worked great for data analysts. Plus it is light weight and fast!

After the upgrade to spyder 3 though, I had a hard time to use this debugging feature.

What steps will reproduce the problem?

  1. reinstalled anaconda
  2. ran simple script such as
from itertools import product

def neibours_loc():
    locs = [-1, 1, 0]
    for x, y in product(locs, repeat=2):
        if x!=0 or y!=0:
            yield x,y

def count_neighbours(grid, row, col):

    s = 0
    for x, y in neibours_loc():
        try:
            if row+x>=0 and col+y>=0:
                s+=grid[row+x][col+y]
        except:
            pass                
    return s


if __name__ == '__main__':
    # These "asserts" using only for self-checking and not necessary for auto-testing

    assert count_neighbours(((1, 0, 0, 1, 0),
                         (0, 1, 0, 0, 0),
                         (0, 0, 1, 0, 1),
                         (1, 0, 0, 0, 0),
                         (0, 0, 1, 0, 0),), 1, 2) == 3, "1st example"
    assert count_neighbours(((1, 0, 0, 1, 0),
                             (0, 1, 0, 0, 0),
                             (0, 0, 1, 0, 1),
                             (1, 0, 0, 0, 0),
                             (0, 0, 1, 0, 0),), 0, 0) == 1, "2nd example"
    assert count_neighbours(((1, 1, 1),
                             (1, 1, 1),
                             (1, 1, 1),), 0, 2) == 3, "Dense corner"
    assert count_neighbours(((0, 0, 0),
                             (0, 1, 0),
                             (0, 0, 0),), 1, 1) == 0, "Single"
  1. debug the script, and check the variables when ipdb start up

What is the expected output? What do you see instead?
I expected to observe the variables in the explorer, but none showed up

Please provide any additional information below
Please let me know how I can provide more debugging info.

I further tested other use cases and found variable explorer (VE) is working fine with other scopes.

If I put code in cells and execute them one by one, I can see the values in the VE; also if I directly put variables in ipython console, it is working fine.

I think the problem may be with the linkage between ipdb and VE.

Versions and main components

  • Spyder Version:3.0.0
  • Python Version:3.5.2 64bits
  • Operating system:Ubuntu 16.04

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:
jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 1.5.3 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.1 (OK)
pandas >=0.13.1 : 0.18.1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
psutil >=0.3 : 4.3.1 (OK)
pyflakes >=0.6.0 : 1.3.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.5.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.4.6 (OK)
sympy >=0.7.3 : 1.0 (OK)

@ccordoba12
Copy link
Member

Could you update to Spyder 3.0.1 and try again?

Besides, could you tell at what point are you putting breakpoints in your code?

Thanks :-)

@Paul-Yuchao-Dong
Copy link
Author

Paul-Yuchao-Dong commented Nov 20, 2016

Wow that was quick! I hope someday I can learn enough to contribute to this wonderful software.

so I tried to update to Spyder 3.0.1, but was a bit unsure when conda prompted:

Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment /home/paul/anaconda3:

The following packages will be UPDATED:

    anaconda: 4.2.0-np111py35_0 --> custom-py35_0
    spyder:   3.0.0-py35_0      --> 3.0.1-py35_0 

Proceed ([y]/n)? 

I'm not really sure if I upgraded, I would need to re-install anaconda again at some point, and all the packages ...newbie here...

For the breakpoint, I didn't set any before, I just used ctrl + F5 to go line by line. Now that I tried to set break point by insert import pdb; pdb.set_trace() in my code, program stopped but still nothing showed up in Variable Explorer (VE). I also tried using F12 to set breakpoint, still to the same effect, but still nothing in the VE.

@Paul-Yuchao-Dong
Copy link
Author

Paul-Yuchao-Dong commented Nov 20, 2016

So I've upgraded to 3.0.1, and still the variable explorer wouldn't work.

I'm definitely happy to post any test / debug info, but due to my limited knowledge, I'm not sure where to find them.

The question is, is this the intended behavior of spyder3, i.e. the VE would not show the locals() in the ipdb? If that is the case, I think I have a legitimate use case to downgrade to spyder2.

@ccordoba12 ccordoba12 changed the title Variable Explorer is drawing blank on me Variable Explorer is not showing variables in debug mode Nov 20, 2016
@ccordoba12 ccordoba12 added this to the v3.1 milestone Nov 20, 2016
@ccordoba12
Copy link
Member

This is working fine for me on Linux, so I'm sure it's a Windows only problem.

We'll take a look at it for Spyder 3.1.

@Davo36
Copy link

Davo36 commented Nov 20, 2016

Thanks very much for looking at this.

@Paul-Yuchao-Dong
Copy link
Author

Sorry to differ. I ran spyder 3.0.1 under the Ubuntu 16.04. So I'm not really sure it is a windows only problem.

@hiccup7
Copy link

hiccup7 commented Nov 25, 2016

You may want to test Spyder v3.0.2, which fixes a bug with connecting to a remote ipython kernel.

@ccordoba12
Copy link
Member

Is this a problem with remote kernels? No one has said that :-)

@Soldalma
Copy link

I am running Spyder 3.02 on Windows 10. While in debug mode the variables appear in Variables Explorer. However, variables I create and assign to (a=1, for example) in the debug prompt (in IPython) do not show up in the Variables Explorer.

@Davo36
Copy link

Davo36 commented May 30, 2017

Thanks Carlos.

Can't wait for 3.2!!!!

@tdalis
Copy link

tdalis commented Jun 12, 2018

screenshot from 2018-06-12 13-05-13
I have a similar problem, I try to see the arrays in the form of a table when I double click on the Name of the Variable in Variable explorer but I get numpy.ndarray instead of numpy.array - Do I do something wrong in my settings? Do I need to reinstall both Anaconda and Spyder? I am using Ubuntu 18.04 LTS and Spyder version 3.2.6+dfsg1-2

@ccordoba12
Copy link
Member

@tdalis, please open a new issue about it. Don't forget to add a simple piece of code that reproduces your problem and a screenshot of what you're seeing in our Variable Explorer.

@misunkim
Copy link

I also experience a problem that Variable Explorer is not updating its variable, especially in the Debug mode. This problem happens occasionally and I can't reproduce the problem all the time. But I just found that undock the Variable Explorer and dock the Variable Explorer solves the problem sometimes. Undocking and docking magically show the variables which should be there in the first place. I am not sure whether this is a reliable way to fix the problem, but it might be worth to try. I am using Spyder5.3.3 (Python 3.9.13) on Debian 11 system.

@ghost
Copy link

ghost commented Mar 8, 2023

in IDE go to 'preferences' and choose 'reset to defaults' options. After restarting IDE you'll see variable explorer option

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

7 participants