New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to install Python 2.7 as an additional kernel next to the default Python 3.X one? #71

Closed
aragnon opened this Issue Nov 26, 2015 · 5 comments

Comments

Projects
None yet
5 participants
@aragnon

aragnon commented Nov 26, 2015

I am using Jupyterhub, but the amount of inconsistent documentation is not helping. All I want is a fully featured (numpy, scikit*, etc.) Jupyter server up and running, which I expect it what most people want.

The fact that there are three different projects: jupyterhub, jupyter, and ipython doesn't really help when every project sometimes refers to the documentation of the project they depend on.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Nov 26, 2015

Member

Yup, the docs fragmentation is a serious problem. Since there are so many entrypoints, I think we are going to have to be okay with some amount of information duplication, since people are going to arrive from so many different directions.

Assuming you are using pip, you can install the ipykernel package with Python 2, and then install the kernelspec, so Jupyter knows how to start the kernel (no real difference if you use conda):

python2 -m pip install --upgrade ipykernel # install the kernel package for Python 2
python2 -m ipykernel install # register the Python 2 kernelspec

Installation of packages such as numpy, etc. is unaffected by Jupyter. The only additional step is installing the kernelspec after installing the kernel package itself, so that Jupyter can find the kernel. JupyterHub itself also has no effect on installation, other than the fact that you presumably want to do system-wide installs of packages and kernelspecs (generally the default already) so that all Hub users have access to what you install.

A totally complete installation of JupyterHub, notebook servers, and kernels for both Python 2 and 3 (sudo may be required, depending on the system):

python3 -m pip install jupyterhub notebook ipykernel
python3 -m ipykernel install # register Python 3 kernel (not technically necessary at this point, but a good idea)
python2 -m pip install ipykernel
python2 -m ipykernel install # register Python 2 kernel

And you can install whatever packages you want for Python 3 and/or Python 2 in the usual ways.

If you do the same with Anaconda, it's a bit easier to get all the way to a full scientific Python stack with multiple versions of Python:

# install everything (except JupyterHub itself) with Python 2 and 3. Jupyter is included in Anaconda.
conda create -n py3 python=3 anaconda
conda create -n py2 python=2 anaconda
# register py2 kernel
source activate py2
ipython kernel install
# same for py3, and install juptyerhub in the py3 env
source activate py3
ipython kernel install
pip install jupyterhub

I'll add something like this to the JuptyerHub docs.

Member

minrk commented Nov 26, 2015

Yup, the docs fragmentation is a serious problem. Since there are so many entrypoints, I think we are going to have to be okay with some amount of information duplication, since people are going to arrive from so many different directions.

Assuming you are using pip, you can install the ipykernel package with Python 2, and then install the kernelspec, so Jupyter knows how to start the kernel (no real difference if you use conda):

python2 -m pip install --upgrade ipykernel # install the kernel package for Python 2
python2 -m ipykernel install # register the Python 2 kernelspec

Installation of packages such as numpy, etc. is unaffected by Jupyter. The only additional step is installing the kernelspec after installing the kernel package itself, so that Jupyter can find the kernel. JupyterHub itself also has no effect on installation, other than the fact that you presumably want to do system-wide installs of packages and kernelspecs (generally the default already) so that all Hub users have access to what you install.

A totally complete installation of JupyterHub, notebook servers, and kernels for both Python 2 and 3 (sudo may be required, depending on the system):

python3 -m pip install jupyterhub notebook ipykernel
python3 -m ipykernel install # register Python 3 kernel (not technically necessary at this point, but a good idea)
python2 -m pip install ipykernel
python2 -m ipykernel install # register Python 2 kernel

And you can install whatever packages you want for Python 3 and/or Python 2 in the usual ways.

If you do the same with Anaconda, it's a bit easier to get all the way to a full scientific Python stack with multiple versions of Python:

# install everything (except JupyterHub itself) with Python 2 and 3. Jupyter is included in Anaconda.
conda create -n py3 python=3 anaconda
conda create -n py2 python=2 anaconda
# register py2 kernel
source activate py2
ipython kernel install
# same for py3, and install juptyerhub in the py3 env
source activate py3
ipython kernel install
pip install jupyterhub

I'll add something like this to the JuptyerHub docs.

@yaochx

This comment has been minimized.

Show comment
Hide comment
@yaochx

yaochx Aug 25, 2016

the same question, but I use pip3 install jupyter, so the following help me

python3 -m pip install jupyterhub notebook ipykernel python3 -m ipykernel install # register Python 3 kernel (not technically necessary at this point, but a good idea) python2 -m pip install ipykernel python2 -m ipykernel install # register Python 2 kernel

if using pip2, may be this will work for you, referrence

python2 -m pip install ipykernel python2 -m ipykernel install # register Python 2 kernel python3 -m pip install jupyterhub notebook ipykernel python3 -m ipykernel install # register Python 3 kernel (not technically necessary at this point, but a good idea)

yaochx commented Aug 25, 2016

the same question, but I use pip3 install jupyter, so the following help me

python3 -m pip install jupyterhub notebook ipykernel python3 -m ipykernel install # register Python 3 kernel (not technically necessary at this point, but a good idea) python2 -m pip install ipykernel python2 -m ipykernel install # register Python 2 kernel

if using pip2, may be this will work for you, referrence

python2 -m pip install ipykernel python2 -m ipykernel install # register Python 2 kernel python3 -m pip install jupyterhub notebook ipykernel python3 -m ipykernel install # register Python 3 kernel (not technically necessary at this point, but a good idea)

@jacob-roth

This comment has been minimized.

Show comment
Hide comment
@jacob-roth

jacob-roth Sep 11, 2018

I'm trying to install on linux and after running:

pip install --upgrade setuptools --user python2
python2 -m pip install --upgrade ipykernel --user
python2 -m ipykernel install --user

am getting the following error: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-0la809/tornado/

Can you please advise? Thanks!

jacob-roth commented Sep 11, 2018

I'm trying to install on linux and after running:

pip install --upgrade setuptools --user python2
python2 -m pip install --upgrade ipykernel --user
python2 -m ipykernel install --user

am getting the following error: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-0la809/tornado/

Can you please advise? Thanks!

@MingGuan

This comment has been minimized.

Show comment
Hide comment
@MingGuan

MingGuan Sep 11, 2018

MingGuan commented Sep 11, 2018

@jacob-roth

This comment has been minimized.

Show comment
Hide comment
@jacob-roth

jacob-roth Sep 11, 2018

Thanks! I ended up finding that the issue was with tornado and SSL, and the following worked for me

pip install --upgrade "Tornado>=4.0.0,<5.0.0" --user
python2 -m pip install --upgrade ipykernel --user
python2 -m ipykernel install --user

jacob-roth commented Sep 11, 2018

Thanks! I ended up finding that the issue was with tornado and SSL, and the following worked for me

pip install --upgrade "Tornado>=4.0.0,<5.0.0" --user
python2 -m pip install --upgrade ipykernel --user
python2 -m ipykernel install --user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment