spyder: Variables don't show up in variable explorer (Python 3.6)

Description

What steps will reproduce the problem?

  1. Open Spyder
  2. Write some code with variables (even a constant)
  3. Run the code and variables don’t show up, not even the constant ‘epsilon’

What is the expected output? What do you see instead? I expect to see some output in the variables explorer. This happens on both Spyder 3.1.2 Linux and Windows.

Please provide any additional information below Here is my code, attempting to implement Gaussian elmimination:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 16 17:40:09 2017

@author: 
"""

import numpy as np


def f(x):
    return 100*np.exp(-10*x)

def exact(x):
    return 1.0-(1-np.exp(-10))*x-np.exp(-10*x)

# Hardcoded params for simplicity
#fileout = pyOutput
exponent = 4
#n = 4

for k in range(1, exponent):
    # Weird thing we didn't understand
    n = 10**k
    
    # Append i to filename
    fileout = 'pyOutputSimple'
    fileout += str(k)
    
    # descretization resolution
    h = 1/n
    hh = h*h
  
    ''''''
  
    d = np.zeros(n+1)
    b = np.zeros(n+1)
    x = np.zeros(n+1)
    solution = np.zeros(n+1)
    
    d[0] = 2
    d[n] = 2
    solution[0] = 0
    solution[n] = 0
    for i in range(1,n):
        d[i] = (i+1)/i
    for i in range(0,n+1):
        x[i] = i*h
        b[i] = hh*f(i*h)
    
    # FW sub
    for i in range(2,n):
        b[i] = b[i] + b[i-1]/d[i-1]
    # Backward sub
    solution[n-1] = b[n-1]/d[n-1]    
    for i in range((n-2),0):
        solution[i] = (b[i]+solution[i+1])/d[i]
        
    with open(fileout, 'w') as fout:
        fout.write('x:\t\tApprox:\t\tExact:\t\tRelative Error:\n')
        for j in range(0,n):
            RelativeError = np.abs((exact(x[j])-solution[j])/exact(x[j]))
            fout.writelines('{0:.8f}'.format(x[j]) + '\t')
            fout.writelines('{0:.8f}'.format(solution[j]) + '\t')
            fout.writelines('{0:.8f}'.format(exact(x[j])) + '\t')
            fout.writelines('{0:.8f}'.format(np.log10(RelativeError)) + '\n')
    fout.closed
    print('File: ' + str(k) + '/' + str(exponent) + ' written.')

Version and main components

  • Spyder Version: 3.1.2
  • Python Version: 3.6.0
  • Qt Versions: 5.6.2, PyQt5 5.6 on Linux

Dependencies

numpy is used

pyflakes >=0.6.0 :  1.5.0 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
pandas >=0.13.1  :  0.19.2 (OK)
numpy >=1.7      :  1.11.3 (OK)
sphinx >=0.6.6   :  1.5.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.8.1     :  0.9.0 (OK)
psutil >=0.3     :  5.0.1 (OK)
matplotlib >=1.0 :  2.0.0 (OK)
sympy >=0.7.3    :  1.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 46 (14 by maintainers)

Most upvoted comments

There is an option in the Variable Explorer called Exclude unsupported types that if uncheck will show all variable types on it.

Thanks @vishalnadagiri. Currently object-arrays (with dtype=object, meaning with non numeric data) are not supported. There is already an on-going PR (#5260) to add this functionality. It will be available in a future release.

Meanwhile:

  • you can view your data X if you keep it as a DataFrame (just remove .values in your line 10)
  • or you can view it as an array if you remove the non-numeric data (the first column in your case)

image

I had the same problem as soon as I upgraded from spyder 3.1.3 to spyder 3.1.4. Notice that under Tools / Preferences / Variable Explorer / Autorefresh there is a checkbox which might need to be checked (mine was off after the upgrade)