6

I have IPython 3 installed for Python 3 in order to work with Jupyterhub.

Now I'm able to use notebooks with a Python2 kernel, because I created /usr/local/share/jupyter/kernels/python2/kernel.json

with:

{
 "argv": ["python2", "-m", "IPython.kernel",
          "-f", "{connection_file}"],
 "display_name": "Python 2",
 "language": "python2"
}

Now I would also like to use IPython.parallel, but when I start a cluster it will automatically start engines in Python 3, how can I change this to Python 2?

1 Answer 1

2

I solved the issue by

sudo mkdir /etc/ipython/

sudo nano /etc/ipython/ipython_config.py

add these lines:

    c = get_config()

    c.LocalControllerLauncher.controller_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.controller']
    c.LocalEngineLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.engine']
    c.LocalEngineSetLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'IPython.parallel.engine']

And now the engines should start with python2

EDIT for Jupyter 1.0 or IPython 4.0: Change to

c = get_config()

c.LocalControllerLauncher.controller_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.controller']
c.LocalEngineLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.engine']
c.LocalEngineSetLauncher.engine_cmd = ['/usr/bin/python2', '-m', 'ipyparallel.engine']

and to get the cluster tab back: sudo mkdir /etc/jupyter/

sudo nano /etc/jupyter/jupyter_notebook_config.py

Add this:

c.NotebookApp.server_extensions.append('ipyparallel.nbextension')
Sign up to request clarification or add additional context in comments.

1 Comment

awesome :) faced the same issue, now solved it, thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.