Setting up a Jupyter Notebook Environment with PythonSCAD on Linux
This guide explains how to set up a clean Jupyter Notebook environment for PythonSCAD on Linux, starting from a fresh Conda installation.
1. Install Miniconda
Download the latest Miniconda installer:
Run the installer:
Accept the defaults and allow Conda to initialize your shell.
Restart your terminal and verify installation:
2. Create a Dedicated Environment
Create a clean environment for PythonSCAD:
Activate it:
3. Install Required Packages
Install core dependencies:
If using classic Jupyter Notebook (v6), enable widgets:
For Notebook 7 or JupyterLab, widgets work automatically.
4. Install PythonSCAD
Navigate to your PythonSCAD project directory:
Install in editable (development) mode:
Verify installation:
5. Register the Kernel with Jupyter
Make the Conda environment available in Jupyter:
Start Jupyter:
Select the PythonSCAD kernel in the Notebook interface.
6. Test 3D Rendering
In a notebook cell:
If correctly configured:
- The object renders as a 3D widget
- ipywidgets display properly
- No comm protocol errors appear
7. Development Workflow
If you modify C++ sources:
Restart the Jupyter kernel after rebuilding.
Because PythonSCAD is installed in editable mode, no reinstall is necessary.
8. Troubleshooting
Widgets appear as text (e.g. IntSlider(value=0))
Check:
If disabled:
Wrong Python environment
Verify:
Both must point inside:
miniconda3/envs/pythonscad/
Inside a notebook:
Recommended Project Layout
pythonscad/
├── pyproject.toml
├── CMakeLists.txt
└── src/
└── pythonscad/
├── __init__.py
├── jupyterdisplay.py
└── _core.so
This ensures clean imports like:
Done
You now have:
- An isolated Conda environment
- Jupyter Notebook
- ipywidgets and pythreejs
- PythonSCAD installed in development mode
- Working 3D rendering support