[PYTHON] How to make multiple kernels selectable on Jupyter

I struggled hard, so instead of taking notes.

Overview

I want to use multiple kernels on Jupyter. For example --python 2.7 and 3.6 --Anaconda Virtual Environment 1 and Virtual Environment 2 I assume the situation like.

output.gif

You will be able to change the kernel like this.

procedure

--Build a virtual environment with Anaconda --Added to IPython kernel

The problem is solved by the method.

Here, we will explain in order using an example of adding kernels of python2.7 and 3.6. It is assumed that Jupyter has already been installed when Anaconda is installed.

Create a virtual environment

First, create each virtual environment, and install ipykernel at that time.

--Virtual environment 1

python2.7


conda create -n py2 python=2.7 ipykernel 

--Virtual environment 2

python3.6


conda create -n py3 python=3.6 ipykernel 

After completion, check if the virtual environment is created with `` `conda info -e```, and if so, proceed to the next step.

Add kernel

First, ** enter each environment **

conda activate virtual environment name

And do the following

python -m ipykernel install --user --name Virtual environment name--display-name="Display name"

Where `--name` is the virtual environment name and `--display_name``` is the display name of the kernel on Jupyter. Here, the virtual environment names are py2``` and `` py3, and the display names are `` `Python2.7 and Python3.6.

When you start Jupyter lab after execution, you can see that the kernel is added as follows (where Python 3 is the default environment) Screen Shot 2020-04-16 at 21.56.29.png

Also, when you open each Console Screen Shot 2020-04-16 at 21.56.43.png Screen Shot 2020-04-16 at 21.56.57.png You can confirm that you can use each kernel in this way.

If you start Jupyter Notebook in this state, the kernel can be selected like the GIF at the beginning.

Reference material

Recommended Posts

How to make multiple kernels selectable on Jupyter
How to view progress bar on Jupyter Notebook to see progress
How to change Jupyter layout
How to register on pypi
How to use Jupyter Notebook
How to make a multiplayer online action game on Slack
How to make a Japanese-English translation
How to install mysql-connector-python on mac
How to use Dataiku on Windows
Notes on how to use pywinauto
How to make a slack bot
How to install graph-tool on macOS
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to make a crawler --Advanced
How to deploy django-compressor on Windows
Notes on how to use featuretools
How to make a recursive function
How to install OpenCV on Mac
How to run matplotlib on heroku
How to install PyPy on CentOS
How to use homebrew on Debian
Misunderstanding on how to connect cnn
How to install TensorFlow on CentOS 7
How to make a deadman's switch
[Blender] How to make a Blender plugin
[Blender] How to make Blender scripts multilingual
How to make a crawler --Basic
Notes on how to use doctest
How to install Maven on CentOS
Notes on how to write requirements.txt
How to install Go on Ubuntu
How to install music 21 on windows
How to run Jupyter and Spark on Mac with minimal settings
How to make a .dylib library from a .a library on OSX (El Capitan)
How to use Jupyter on the front end of supercomputer ITO
How to make Word Cloud characters monochromatic
How to make Selenium as light as possible
How to title multiple figures with matplotlib
How to install aws-session-manager-plugin on Manajro Linux
How to read pydoc on python interpreter
How to install drobertadams / toggl-cli on Mac
[Python] How to make a class iterable
How to easily switch the virtual environment created by Conda on Jupyter
[Kivy] How to install Kivy on Windows [Python]
How to use mecab, neologd-ipadic on colab
Try to make a kernel of Jupyter
How to make a process thread run only on a specific CPU core
How to build Hello, World on #Nix
Make Jupyter Notebook a service on CentOS
How to utilize multi-core from multiple languages
Understand how to display images on Jupyter (utilization of imshow / matplotlib of OpenCV)
How to update php on Amazon linux 2
How to use Google Assistant on Windows 10
How to execute commands in jupyter notebook
How to erase Python 2.x on Mac.
How to display emoji on Manjaro Linux
Memorandum on how to use gremlin python
How to set up a jupyter notebook on ssh destination (AWS EC2)
How to install packages on Alpine Linux
[Cocos2d-x] How to make Script Binding (Part 2)