IPython 4 shell does not work with Sublime REPL

眉间皱痕 提交于 2019-12-18 16:46:16

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/32719352/ipython-4-shell-does-not-work-with-sublime-repl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!