Install Anaconda Python environment with Jupyter Notebook

This post was updated on September 29, 2022

Check if you have Conda installed

% conda update --all -y
>> command not found: conda

Install Anaconda Python

I prefer an installer on my laptop: 


After installation, make sure you restart the Terminal (control N).

Note, Anaconda includes the following and much more:
  • curl

  • numpy

  • matplotlib

  • jupyter_core

  • protobuf

  • sqlite

  • ipython

  • jupyterlab

  • jupyter

  • notebook

  • matplotlib

  • pip

  • pandas

  • pillow

  • scikit-learn

  • python-3.9



Update Conda


$ conda activate base
$ conda update -n base -c defaults conda
$ conda update --all -y



How to start Jupyter Notebook



cd $REPO // the directory you want as a base of your project (e.g. in GitHub directory)  
jupyter-lab

This will start in the browser: http://localhost:8888/lab


That is all you need to start working.
Alternatively, you may want to create ENVIRONMENT specific installation. This is useful if you work on multiple projects, especially over a long time when LIBRARIES change and code becomes outdated.


Check Python Version that came with Conda

% python --version
Python 3.9.13

 

Create a Conda TensorFlow environment

$ conda create -n py_39_tf python=3.9 tensorflow -y

This installs tensorflow         pkgs/main/osx-64::tensorflow-2.9.1

List conda environments you already created



$ conda info --envs

 

% conda info --envs

# conda environments:

#

base                  *  /Users/uki/opt/anaconda3

py_39_tf                 /Users/uki/opt/anaconda3/envs/py_39_tf





Activate the Conda Environment you want Jupyter in.


% conda activate py_39_tf

(py_39_tf) uki ~ %






Install new Jupyther kernel


$ python -m ipykernel install --user --name py_36_tf --display-name "Python 3.6 (tensorflow)"



 



List currently installed Jupyther kernels 



$ ls -alt ~/Library/Jupyter/kernels/


total 0
drwx------ 7 uki staff 224 Nov 22 11:50 ..
drwxr-xr-x 9 uki staff 288 Nov 22 11:43 .
drwxr-xr-x 5 uki staff 160 Nov 4 06:35 julia-1.4
drwxr-xr-x 5 uki staff 160 Apr 1 2020 python361064bitpy36condaa60168e76a7b4349b469299762ee4c30
drwxr-xr-x 5 uki staff 160 Apr 1 2020 python38264bitpytorchcondaaf5a833263b448b8b2738bb5a7355c8a
drwxr-xr-x 5 uki staff 160 Apr 1 2020 python361064bitturiconda565ecc262d0845fbb235ae21ac24296f












Installed kernelspec py_36_tf in /Users/uki/Library/Jupyter/kernels/py_36_tf

Refresh a page with Jupyther Lab notebook and change to the new kernel.




Delete kernels that you want to replace


$ rm -r ~/Library/Jupyter/kernels/my_old_kernel_name

 



As an Amazon Associate I earn from qualifying purchases.

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Popular Recent Articles