1

I just started using Sublime+SublimeREPL recently to code in python. I also use the IPython console within sublimeREPL to send the code, but the truth is that I am not using it adequately.

When I launch the IPython console with SublimeREPL I don't see the standard IPython message with details of the installation, I just see:

IPython Console 3.2.0

In [1]:

when I do pwd, I obtain the following directory independently of the directory I start sublime from:

In [1]: pwd
Out[1]: u'/Users/javier/Library/Application Support/Sublime Text 3/Packages'

In general, it seems that IPython works (I have not fully tested most of my code) but I am sure the fact that sublime does not "see" the default IPython will be problematic in the future.

This question relates to this, but I have tried some of the options described in there, such as adding to SublimeREPL > Settings > User:

{
    "default_extend_env": {"PATH": "{PATH};/anaconda/bin/"}
}

and I can't make it work.

In case is of any help, sys.path returns

In [3]: sys.path
Out[3]: 
['',
 '/anaconda/lib/python27.zip',
 '/anaconda/lib/python2.7',
 '/anaconda/lib/python2.7/plat-darwin',
 '/anaconda/lib/python2.7/plat-mac',
 '/anaconda/lib/python2.7/plat-mac/lib-scriptpackages',
 '/anaconda/lib/python2.7/lib-tk',
 '/anaconda/lib/python2.7/lib-old',
 '/anaconda/lib/python2.7/lib-dynload',
 '/anaconda/lib/python2.7/site-packages',
 '/anaconda/lib/python2.7/site-packages/PIL',
 '/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3-py2.7.egg',
 '/anaconda/lib/python2.7/site-packages/progressbar-2.3-py2.7.egg',
 '/anaconda/lib/python2.7/site-packages/runipy-0.1.1-py2.7.egg',
 '/anaconda/lib/python2.7/site-packages/setuptools-18.0.1-py2.7.egg',
 '/anaconda/lib/python2.7/site-packages/IPython/extensions',
 '/Users/javier/.ipython']

And following this link when I do:

import os
try:
    user_paths = os.environ['PYTHONPATH'].split(os.pathsep)
except KeyError:
    user_paths = []

In [2]: user_paths
Out[2]: []

which I guess it means that I have not defined a PYTHONPATH variable.

Finally, in the first of the links I mentioned they write: "SublimeREPL doesn't run ipython executable directly - it uses its API to start the console, therefore IPython needs to be importable, what means it needs to be on PYTHONPATH. So, extend default_extend_env config with PYTHONPATH pointing it to IPython source folder."

I am not entirely sure what it means. My default IPython is at Anaconda/bin but as I mentioned before, when I set "default_extend_env": {"PATH": "{PATH};/anaconda/bin/"} (and some other variants) it does not work either.

Anyway, I am sure the solution is fairly simple, but I am new to Sublime, and at this stage I do not know what or where I have to add PATH or ENV variables.

Community
  • 1
  • 1
Javier
  • 1,440
  • 1
  • 19
  • 43
  • IPython looks like it's working just fine. `/anaconda/lib/python2.7/site-packages` is in your `sys.path`, and is where the `ipython` directory should be if the command-line executable is in `/anaconda/bin`. You're able to run code successfully, so I don't think there's an issue. The `Python 2.7.9 (default, ...` header does not print with IPython 3 in SublimeREPL. – MattDMo Aug 07 '15 at 01:45
  • @MattDMo: thanks for your answer. Is just that in my old Mac (10.6) and with Sublime 2 I actually see all the intallation message when initiating the IPython console. In addition, when I start the IPython console, I am in the directory where sublime is launched. Anyway, you reply to most of sublime question :), so if it is fine to you is enough for me. Thanks for your reply. – Javier Aug 07 '15 at 05:05
  • Were you using IPython 2.x or earlier under 10.6? I'm still using IPython 2.4.1 (due to some issues I've experienced with 3.x), and it displays the banner for Python and IPython, but when I use 3.x it just displays what you're seeing. So, I don't think there's an issue. If you *do* start having issues, just post another question here and I'll probably see it sooner or later (plus a bunch of other people that generally know what they're talking about :) – MattDMo Aug 07 '15 at 13:41
  • @MattDMo: yes, in my laptop at home I use Ipython 2.4.1, while at work I am on the most updated version 3.2.1. Overall, thanks for your comments Matt :) – Javier Aug 07 '15 at 17:15
  • No problem, glad to help. – MattDMo Aug 07 '15 at 18:31
  • @MattDMo: I do experience problems. For example: `In [3]: %paste` and I obtain `ERROR: Line magic function `%paste` not found.` and as soon as I type a terminal command (e.g. `ls` or `cd`), it will work, but from there in advance, autocompletion stops working. This might be normal sublime behavior (?) but then the sublime IPython console is less useful. – Javier Aug 13 '15 at 09:25
  • This is probably the same issue (or similar) being discussed [here](https://github.com/wuub/SublimeREPL/issues/417). Unfortunately SublimeREPL's author is pretty swamped with real (meaning *paying*) work, so I don't know when he'll have time to work on it. My only solution so far was to downgrade IPython to 2.4.1. Run `pip uninstall ipython`, then `pip install ipython==2.4.1`. – MattDMo Aug 13 '15 at 16:29
  • Hi Matt, I also commented there and I was advice not to downgrade, but yes, downgrade seems the only possibility for Sublime and Ipython to work. – Javier Aug 16 '15 at 16:16
  • I don't agree with that advice not to downgrade. If you want to use IPython in SublimeREPL, you *need* to downgrade. If you want to use IPython 3.x, you can't use SublimeREPL, in which case you should be using the web-based notebook or `qtconsole`. Perhaps I'll make my own comment clarifying this. – MattDMo Aug 18 '15 at 17:43
  • @MattDMo: I just run `conda remove ipython` and then `conda install ipython=2.4.1` and everyrthing works better than ever. I am thinking that maybe you could add your comment as the answer to the question so it is more visible (and useful) to people (?) – Javier Aug 21 '15 at 10:58

0 Answers0