0

There seems to be something wrong with my Anaconda Python installation.

When I run Python through cmd it works and I can also run Python programs directly through cmd, and even import scipy, numpy, matplotlib etc.

However, when I try to run IPython with cmd command 'ipython', I get the error:

Traceback (most recent call last):
  File "C:\Users\User\Anaconda\Scripts\ipython-script.py", line 5, in <module>
    sys.exit(start_ipython())
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\__init__.py", line 120, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\config\application.py", line 563, in launch_instance
    app.initialize(argv)
  File "<string>", line 2, in initialize
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\config\application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 332, in initialize
    self.init_shell()
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 348, in init_shell
    ipython_dir=self.ipython_dir, user_ns=self.user_ns)
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\config\configurable.py", line 354, in instance
    inst = cls(*args, **kwargs)
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\terminal\interactiveshell.py", line 328, in __init__
    **kwargs
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 465, in __init__
    self.init_history()
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 1521, in init_history
    self.history_manager = HistoryManager(shell=self, parent=self)
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\core\history.py", line 498, in __init__
    self.new_session()
  File "<string>", line 2, in new_session
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\core\history.py", line 68, in needs_sqlite
    return f(self, *a, **kw)
  File "C:\Users\User\Anaconda\lib\site-packages\IPython\core\history.py", line 516, in new_session
    NULL, "") """, (datetime.datetime.now(),))
DatabaseError: database disk image is malformed

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    c.Application.verbose_crash=True

I think the error is due to the DatabaseError: database disk image is malformed error, but am unsure of what this means.

Any advice?

  • Please have a look in your profile folder (or the path you have set in the configuration) if you can find a history.sqlite file. If you can find it, make a backup first and then create a new, empty file with the same name. Now try to run IPython again. – Mario Neubauer Nov 26 '14 at 18:17
  • It worked! How in the world did you know this? If you make it the answer to the Q I will accept it as the answer, if you want. – Jonny Nov 26 '14 at 18:24
  • You are welcome again. In most of this cases creating a new and empty file helps and IPython will take care to create the database structure. Had to fix a similar issue some time ago. – Mario Neubauer Nov 26 '14 at 18:42
3
+50

The problem is a corrupted sqlite database. In this case the history.sqlite database.

Please have a look in your profile folder (or the path you have set in the configuration) if you can find a history.sqlite file.

If you can find it, make a backup first (just in case you might need it) and then create a new, empty file with the same name (history.sqlite).

Now try to run IPython again and you should be able to start it.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.