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

KeyError: 'execution_count' in IPython console #3759

Closed
Shaunakde opened this issue Nov 28, 2016 · 5 comments
Closed

KeyError: 'execution_count' in IPython console #3759

Shaunakde opened this issue Nov 28, 2016 · 5 comments

Comments

@Shaunakde
Copy link

Description of your problem

Mayavi doesn't work / stopped working out of the blue.
When I try to use mayavi from within Spyder I get the following error message in response to the code from mayavi import mlab:

File "<ipython-input-1-c11ad98c1cb2>", line 1, in <module>
    runfile('/home/shaunak/Work/ChangeDet_2016/mayavi.py', wdir='/home/shaunak/Work/ChangeDet_2016')

  File "/home/shaunak/anaconda2/envs/mayavi/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)

  File "/home/shaunak/anaconda2/envs/mayavi/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
    builtins.execfile(filename, *where)

  File "/home/shaunak/Work/ChangeDet_2016/mayavi.py", line 97, in <module>
    from mayavi import mlab

  File "mayavi.py", line 97, in <module>
    from mayavi import mlab

ImportError: cannot import name mlab

What steps will reproduce the problem?

  1. Install a new environment in Spyder (conda install --name mayavi python=2 anaconda)
  2. Install mayavi (conda install --name mayavi mayavi)
  3. Run this simple code:
from mayavi import mlab
mlab.points3d(1,1,1)

What is the expected output? What do you see instead?
I would expect to see a point plotted as requested. Instead I get the error message described above.

Please provide any additional information below
Additional details: http://stackoverflow.com/questions/40847261/spyder-and-issues-with-mayavi
I have tried downgrading Sypder. But the problem remains.

Versions and main components

  • Spyder Version: Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:42:40)
  • Python Version: 2.7
  • Operating system: Ubuntu 14.04

Dependencies

jedi >=0.8.1 : 0.8.1 (OK)
matplotlib >=1.0 : 1.4.3 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.9.2 (OK)
pandas >=0.13.1 : 0.16.2 (OK)
pep8 >=0.6 : 1.6.2 (OK)
psutil >=0.3 : 2.2.1 (OK)
pyflakes >=0.5.0 : 0.9.2 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.6.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.10.3 (OK)
sphinx >=0.6.6 : 1.3.1 (OK)
sympy >=0.7.3 : 0.7.6 (OK)

@Shaunakde
Copy link
Author

Closing the issue. Multiple re-installations seemed to have caused the problem to go away.

@Shaunakde
Copy link
Author

Update: This error seems to occur if the script has previously imported Matplotlib 3d tools:
from mpl_toolkits.mplot3d import Axes3D

@Shaunakde Shaunakde reopened this Nov 28, 2016
@Shaunakde
Copy link
Author

Update: It seems independent of if the Matplotlib3d lib was called, the same code that worked before crashes randomly.

[WARNING:traitlets:kernel restarted
Traceback (most recent call last):
  File "/home/shaunak/anaconda2/envs/mayavi/lib/python2.7/site-packages/qtconsole/base_frontend_mixin.py", line 163, in _dispatch
    handler(msg)
  File "/home/shaunak/anaconda2/envs/mayavi/lib/python2.7/site-packages/spyder/widgets/ipythonconsole/namespacebrowser.py", line 180, in _handle_execute_reply
    exec_count = msg['content']['execution_count']
KeyError: 'execution_count'](`url`)

@ccordoba12
Copy link
Member

Could you update to Spyder 3.0.2 and try again?

@Shaunakde
Copy link
Author

I tested this on both Spyder 3.0.2 Python 2.7.10 64bits, Qt 4.8.6, PyQt4 (API v2) 4.11.3 on Linux and an older one. The same script will not run when run all at once. But if I use cells to stop the execution and manually proceed, weirdly it runs fine.

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

3 participants