Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipython using 2.6 version instead of 2.7

Tags:

python

ipython

I am trying to set up iPython to use 2.6 version instead of 2.7. Is there a way to do it?

More information. I am trying to set up a iPython notebook to develop Spark application, however, the python version across the whole cluster is 2.6 where only the name node has the latest Anaconda python version installed 2.7. In that case, when I started a python notebook, it will use 2.7 as the interpreter and I am running into errors when I tried to distribute the work.

Instead of upgrading the wholecluster to use 2.7, I prefer downgrade the iPython version on the name node to be 2.6, is there a way to do it?

Update:

Thanks for the suggestion from Jivan, it is actually fairly easy to use python virtualenv to install the older version of iPython inside the virtual environment, whenever you want to use it, you can have a bash script looks like this and there will be a proper iPython notebook environment that has the python version consistent across the cluster.

#!/bin/bash
which python
source /root/user/python-ev/bin/activate
which python
ipython notebook --profile=pyspark
like image 937
B.Mr.W. Avatar asked Dec 29 '14 00:12

B.Mr.W.


1 Answers

iPython 1.0 is the last main version of iPython to support Python < 2.7 interpreter.

So you need to install iPython 1.2.1 at most, if that's not done already.

Now to associate it to Python2.6:

$ sudo python2.6 setup.py install

More information on this link. The author skipped the part about which version of iPython to use because at this time all versions of iPython supported Python < 2.7.

It could work, but it's not certain because it depends on your existing config, etc.

If it doesn't, a different way (a bit hacky however) could be found here.

like image 182
Jivan Avatar answered Sep 29 '22 01:09

Jivan