Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't Spyder obey my IPython config file?

This used to work, but now it doesn't, in IPython 4.2.0 and Spyder 2.3.9 from Anaconda. Argh.

If I get the IPython config it looks correct, as though it read the file correctly:

get_ipython().config
Out[1]: 
{'IPCompleter': {'greedy': True},
 'IPKernelApp': {'exec_lines': ['%pylab qt']},
 'InlineBackendConfig': {},
 'InteractiveShell': {'xmode': 'Plain'},
 'InteractiveShellApp': {'exec_lines': ['from __future__ import division',
   'from __future__ import print_function',
   'from __future__ import with_statement',
   'from numpy import set_printoptions',
   'set_printoptions(suppress=True, precision=4)',
   'from sympy import init_printing',
   'init_printing(forecolor="White")'],
  'pylab': 'auto'},
 'StoreMagics': {'autorestore': True},
 'ZMQInteractiveShell': {'autocall': 0, 'banner1': ''}}

So it's supposed to have future division and numpy suppression, but it actually doesn't:

division
Out[1]: _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)

4/5
Out[2]: 0

np.get_printoptions()
Out[3]: 
{'edgeitems': 3,
 'formatter': None,
 'infstr': 'inf',
 'linewidth': 75,
 'nanstr': 'nan',
 'precision': 8,
 'suppress': False,
 'threshold': 1000}

eps = np.finfo(float).eps; x = np.arange(4.); x**2 - (x + eps)**2
Out[4]: 
array([ -4.93038066e-32,  -4.44089210e-16,   0.00000000e+00,
         0.00000000e+00])

This is what it should do:

from __future__ import division

division
Out[2]: _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)

4/5
Out[3]: 0.8

np.set_printoptions(suppress=True)

eps = np.finfo(float).eps; x = np.arange(4.); x**2 - (x + eps)**2
Out[5]: array([-0., -0.,  0.,  0.])

np.get_printoptions()
Out[6]: 
{'edgeitems': 3,
 'formatter': None,
 'infstr': 'inf',
 'linewidth': 75,
 'nanstr': 'nan',
 'precision': 8,
 'suppress': True,
 'threshold': 1000}

Regular IPython works correctly (C:\Anaconda2\python.exe C:\Anaconda2\cwp.py C:\Anaconda2 "C:/Anaconda2/python.exe" "C:/Anaconda2/Scripts/ipython-script.py")

Jupyter QTConsole works correctly (C:\Anaconda2\pythonw.exe C:\Anaconda2\cwp.py C:\Anaconda2 "C:/Anaconda2/pythonw.exe" "C:/Anaconda2/Scripts/jupyter-qtconsole-script.py")

like image 677
endolith Avatar asked Jul 27 '16 02:07

endolith


1 Answers

im not sure what is the problem either I was having the same issue

but mine was fixed when I uninstalled anaconda with EVERYTHING including its python bit granted I saved the settings and profile and stuff

and reinstalled

Hope that helps, if its an option at all

like image 109
AdilZ Avatar answered Nov 08 '22 06:11

AdilZ