Python
Use Python in CoCalc
Use real Python through notebooks, scripts, terminals, virtual environments, and papers.
What Python in CoCalc is for
Python runs in the project's computing environment. Hosted CoCalc AI projects use Linux; local CoCalc Plus uses your computer's operating system and installed software. You can work with notebooks, scripts, terminals, virtual environments, and the tools available in that environment.
Common ways to use Python
- Create a Jupyter notebook for exploratory work.
- Edit
.pyfiles for scripts, modules, and packages. - Use the available Python interpreter and package manager in a terminal,
such as
python3,uv,pip, orconda. - Use Python from LaTeX workflows such as PythonTeX when the document needs code.
- Install alternate Python versions or virtual environments when needed.
Keep environment setup commands in a script or README when other people or agents need to reproduce the project. For an isolated notebook environment, see Custom Jupyter kernels with uv and check the recipe's operating-system requirements.
On CoCalc AI, to connect an existing C numerical routine to Python, follow Compile and verify a C numerical component from Python. The example checks a compiled result against an independent Python reference and records the source and build information. It requires an existing compiler.
Why this matters in CoCalc
CoCalc lets Python move naturally from notebook to script to paper in one durable workspace. The same project can contain experiments, production scripts, package installs, plots, papers, terminals, and Codex-driven automation.