跳到主要內容

發表文章

目前顯示的是 10月, 2021的文章

Run Notebook from another Notebook

Step 1. Install this package on your environment pip install papermill Step 2. Prepare a kernel that runs your notebook conda create --name=runenv python=3.8 source /opt/conda/etc/profile.d/conda.sh conda activate runenv conda install ipykernel python -m ipykernel install --user --name=runenv Step 3. Run notebook papermill -k runenv \ gs://andy-notebook/in/template.ipynb \ gs://andy-notebook/out/template.ipynb \ -p project_id stage-env \ -p dataset_path gs://andy-data In this example, we use runenv to run notebook gs://andy-notebook/in/template.ipynb and pass parameters "project_id" and "dataset_path" to the notebook. The execution result will be put on GCS (gs://andy-notebook/out/template.ipynb). That's it.

在 Jupyter Notebook 使用 conda 建立的環境

  Step 1. 在  base environment 安裝 nb_conda_kernels (base)$ conda install nb_conda_kernels 如果不行的話就接著做下一步 Step 2. 在新建立的環境下安裝 ipykernel (new-env)$ conda install ipykernel python -m ipykernel install --user --name="My_Project_Name" 其他有用指令 List kernels $ jupyter kernelspec list Remove kernel $ jupyter kernelspec remove [KERNAL_NAME]