seanshpark / macOS

problems and solutions
MIT License
0 stars 0 forks source link

Jupyter-lab, jupyter notebook #5

Open seanshpark opened 2 years ago

seanshpark commented 2 years ago

Install, run Jupiter with brew

https://formulae.brew.sh/formula/jupyterlab#default


Jupyter start folder:

cd ~/hdd/Learning/python

jupyter-lab
seanshpark commented 2 years ago

already installed: node, python3, six

brew install pandoc
brew install zeromq
brew install jupyterlab
seanshpark commented 2 years ago

Run!

cd ~/hdd/Learning/python
jupyter-lab

or old notebook

jupyter notebook
seanshpark commented 2 years ago

Q) how to install packages for particular kernel; Python 3 (ipykernel) ?

inside Jupyter

import sys
print({sys.executable})

this will print which python is running for Jupyter.

!{sys.executable} -m pip install numpy

-->

Collecting numpy
  Downloading numpy-1.21.4-cp39-cp39-macosx_11_0_arm64.whl (12.4 MB)
     |████████████████████████████████| 12.4 MB 10.5 MB/s            
Installing collected packages: numpy
Successfully installed numpy-1.21.4
seanshpark commented 2 years ago
brew upgrade
...
==> python@3.9
Python has been installed as
  /Volumes/SSD/homebrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /Volumes/SSD/homebrew/opt/python@3.9/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /Volumes/SSD/homebrew/lib/python3.9/site-packages

tkinter is no longer included with this formula, but it is available separately:
  brew install python-tk@3.9

See: https://docs.brew.sh/Homebrew-and-Python
seanshpark commented 2 years ago

Add custom kernels ?

Run inside virtualenv.

pip3 install ipykernel
python3 -m ipykernel install --user --name one_tf3 --display-name "Py3TF"

Installed kernelspec one_tf3 in ~/Library/Jupyter/kernels/one_tf3

vi ~/Library/Jupyter/kernels/one_tf3/kernel.json

check python3 path is correct.

seanshpark commented 2 years ago
import tensorflow as tf
import onnx
import onnxruntime as onnxrt
import onnx_tf as onnxtf

print("TF =", tf.__version__)
print("ONNX =", onnx.__version__)
print("ONNX-runtime =", onnxrt.__version__)
print("ONNX-TF =", onnxtf.__version__)

TF = 2.7.0 ONNX = 1.10.1 ONNX-runtime = 1.11.0 ONNX-TF = 1.9.0