IPython 4 shell does not work with Sublime REPL
Asked Answered
B

1

7

I am having problems with running the IPython shell from the Sublime REPL package.

Here is what I get:

C:\Anaconda\lib\site-packages\IPython\config.py:13: ShimWarning: 
The`IPython.config` package has been deprecated. You should import from 
traitlets.config instead.
"You should import from traitlets.config instead.", ShimWarning)

C:\Anaconda\lib\site-packages\IPython\terminal\console.py:13: ShimWarning:  
The `IPython.terminal.console` package has been deprecated. You should 
import from jupyter_console instead.
"You should import from jupyter_console instead.", ShimWarning)

C:\Anaconda\lib\site-packages\IPython\frontend.py:21: ShimWarning: The top-
level `frontend` package has been deprecated. All its subpackages have been 
moved to the top `IPython` level.
"All its subpackages have been moved to the top `IPython` level.", 
ShimWarning)

Traceback (most recent call last):
File "C:\Users\Vladimir\AppData\Roaming\Sublime Text 
3\Packages/SublimeREPL/config/Python/ipy_repl.py", line 45, in <module>
from IPython.frontend.terminal.console.app import ZMQTerminalIPythonApp
ImportError: No module named app

Does anyone has a solution how this might be fixed? I have the latest version of pyzmq installed and run under Python 2.7.10-0

Bozeman answered 22/9, 2015 at 14:16 Comment(0)
S
14

With the release of IPython 4.0, the structure has completely changed, and is now implemented as a kernel for the Jupyter core, which is capable of running IPython-like sessions using many different languages other than Python. IPython is still the "reference implementation", however.

With these changes, the internal API has also changed quite a bit, and some parts have been moved/renamed or just aren't there at all. I've put together complete instructions on updating SublimeREPL for IPython 4 as a gist on Github, but I'll go over the key parts here.

The first thing you need to do is make sure you have all the components of IPython and Jupyter, as it's been split up from one monolithic packages to quite a number of smaller ones. Run

[sudo] pip install -U ipython jupyter

from the command line to get all the pieces - no compiler should be necessary. sudo is in case you're on a Unix/Linux system and need admin access, and the -U flag means the same thing as --upgrade.

Once that's done, open Sublime and select Preferences → Browse Packages… to open your Packages folder in your operating system's file browser application (Finder, Windows Explorer, Nautilus, etc.). Open the SublimeREPL folder, then config, then Python, then open ipy_repl.py in Sublime. Delete its entire contents, and replace it with the file included in the gist link above (click here for the raw copy-and-paste version).

Save ipy_repl.py with the new contents, and that should be it! You can now open the IPython REPL in the usual way, and you should see:

Jupyter Console 4.0.2

[ZMQTerminalIPythonApp] Loading IPython extension: storemagic

In [1]: 

If you'd like to get rid of the [ZMQTerminalIPythonApp] message, read through the instructions in the gist. However, the message is harmless, so you can safely ignore it if you want.

Good luck!

NOTE: These changes have been submitted to the main SublimeREPL project as pull requests, but seeing as the author hasn't been working on the plugin for some time, it may be a while before it's part of the main branch.

Stouthearted answered 24/9, 2015 at 20:56 Comment(5)
Thanks for the detailed instructions. Now I get the following:Bozeman
[ZMQTerminalIPythonApp] Loading IPython extension: storemagic Jupyter Console 4.0.2 C:\Anaconda\python.EXE: Module use of python26.dll conflicts with this version of Python.; 'ipykernel' is a package and cannot be directly executedBozeman
@VolodymyrKruglov what version of Python are you using, and which version did pip use to install IPython and Jupyter?Stouthearted
@VolodymyrKruglov sorry, I just saw you were using 2.7.10. Do you have an installation of 2.6 someplace?Stouthearted
I may install one but would prefer not to, if possibleBozeman

© 2022 - 2024 — McMap. All rights reserved.