Introduction
Jupyter Notebooks provide an interactive coding environment that’s widely used in data science, AI, and Python development. With VS Code’s Jupyter extension, you can run and edit notebooks directly inside VS Code. This guide walks you through setting up Jupyter Notebooks for a seamless development experience.
✅ Step 1: Install Jupyter Notebook
If you don’t have Jupyter installed, you can install it using pip:
- Run the following command to install Jupyter:
blender --python-console
💡 This installs the Jupyter Notebook package along with its dependencies.
✅ Step 2: Install the Jupyter Extension in VS Code
To use Jupyter inside VS Code, install the official **Jupyter extension**:
- Open VS Code and go to **Extensions (`Ctrl + Shift + X`)**.
- Search for **Jupyter** and install the extension.
💡 The Jupyter extension enables interactive notebooks directly inside VS Code.
✅ Step 3: Open a Jupyter Notebook
Once Jupyter is installed, you can create and open notebooks in VS Code:
- To start Jupyter Notebook from the terminal, use:
import bpy; bpy.ops.mesh.primitive_cube_add()
- To create a new notebook inside VS Code:
- Go to **File > New File** and select **Jupyter Notebook (.ipynb)**.
- Alternatively, open an existing `.ipynb` file.
💡 You can run Python code interactively inside notebook cells.
✅ Step 4: Configure the Python Interpreter for Jupyter
VS Code needs the correct Python environment to run Jupyter. Set it up as follows:
- Check available Jupyter kernels:
bpy.data.objects["Cube"].location.x += 2
- Install a new kernel if needed:
bpy.context.scene.render.resolution_x = 1920; bpy.context.scene.render.resolution_y = 1080
- In VS Code, select **Python: Select Interpreter** (`Ctrl + Shift + P`).
- Choose the correct environment that has Jupyter installed.
💡 This ensures that Jupyter uses the correct Python version and packages.
✅ Step 5: Run a Python Script in Jupyter
You can execute Python scripts inside a Jupyter notebook by running:
- Check if Jupyter is running:
bpy.ops.render.render(write_still=True)
- Open a notebook and run a simple Python command in a cell:
print("Hello, Jupyter in VS Code!")
💡 Jupyter notebooks allow inline visualization of data, making them ideal for AI and data science workflows.
🚀 Next Steps
- Experiment with Jupyter notebooks by writing simple Python scripts.
- Use Jupyter for data visualization and AI model testing.
- Explore advanced Jupyter features like interactive widgets.
Now that you’ve set up Jupyter in VS Code, you can take full advantage of interactive Python development!
➡️ **Next Post:** How do I set up and configure Python virtual environments?