-
Notifications
You must be signed in to change notification settings - Fork 14
chore: add ipykernel docs AI-22776 #98
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
Open
EdisonSu768
wants to merge
1
commit into
main
Choose a base branch
from
chore/ipykernel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ | |
| node_modules | ||
| dist | ||
| .DS_Store | ||
| .idea | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| --- | ||
| products: | ||
| - Alauda AI | ||
| kind: | ||
| - Solution | ||
| ProductsVersion: | ||
| - 1.5 | ||
| --- | ||
| # Add a New ipykernel in JupyterLab | ||
|
|
||
| This section describes how to create a new Python virtual environment, register it as a Jupyter ipykernel, and verify that it is available in JupyterLab. | ||
|
|
||
| All commands in this section should be executed inside the JupyterLab environment. You can either exec into the JupyterLab Pod using Kubernetes commands, or run the commands directly in the **Terminal** available from the JupyterLab Launcher page. | ||
|
|
||
| ## Create and Register a New ipykernel | ||
|
|
||
| Create a new Python virtual environment: | ||
|
|
||
| ```bash | ||
| python -m venv ~/.venv-testing | ||
| ``` | ||
|
|
||
| Activate the virtual environment: | ||
|
|
||
| ```bash | ||
| source ~/.venv-testing/bin/activate | ||
| ``` | ||
|
|
||
| Install the required ipykernel package in the virtual environment: | ||
|
|
||
| ```bash | ||
| pip install ipykernel | ||
| ``` | ||
|
|
||
| Install and register the ipykernel for this environment: | ||
|
|
||
| ```bash | ||
| python -m ipykernel install \ | ||
| --user \ | ||
| --name python-testing \ | ||
| --display-name "Python (testing)" | ||
| ``` | ||
|
|
||
| Verify that the new kernel has been registered: | ||
|
|
||
| ```bash | ||
| jupyter kernelspec list | ||
| ``` | ||
|
|
||
| ```text | ||
| Available kernels: | ||
| python3 /.venv/share/jupyter/kernels/python | ||
| python-testing /home/jovyan/.local/share/jupyter/kernels/python-testing | ||
| ``` | ||
|
|
||
| ## Verify the Kernel in JupyterLab | ||
|
|
||
| After the kernel is registered, refresh the JupyterLab page in your browser. On the **Launcher** page, a new card named **Python (testing)** will appear under both the **Notebook** and **Console** sections. | ||
|
|
||
| Click the **Python (testing)** card under **Console** to open a new console tab. In the opened tab, run the following Python code to verify the environment: | ||
|
|
||
| ```python | ||
| import sys | ||
|
|
||
| print("Python version:", sys.version) | ||
| print("Python executable:", sys.executable) | ||
| ``` | ||
|
|
||
| If the output shows the Python executable path pointing to the newly created virtual environment, the ipykernel has been configured correctly: | ||
|
|
||
| ```text | ||
| Python version: 3.11.13 (main, ...) | ||
| Python executable: /home/jovyan/.venv-testing/bin/python | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以在不同的 ipykernel 用不同的 Python 版本么?