astr400
Environments

Using a Python environment

This page is daily use after install. For Miniconda itself see Conda setup. For a project-local manager see uv. Pick one manager and stay with it in a given project.

1. Activate the environment

Conda

conda activate astro-python

The active environment appears in your shell prompt, for example (astro-python). List environments with conda env list; the current one is marked with *.

To leave it:

conda deactivate

uv

Prefer uv run over activating by hand. From the project directory:

uv sync
uv run python -c "import astropy; print('ok')"

If you do need a shell inside the project environment:

uv run bash

2. Launch Jupyter

Conda

With the environment active:

jupyter lab

uv

uv run jupyter lab

In VS Code, choose Python: Select Interpreter and pick the Conda env or the project .venv. For a named Jupyter kernel with uv:

uv run python -m ipykernel install --user --name astrolab

Then select that kernel in the notebook.

3. Install another package

Conda

conda install -c conda-forge package-name

Export the environment so someone else can recreate it:

conda env export > environment.yml

uv

uv add package-name
uv sync

4. Editor and notebooks

Install VS Code and the Jupyter extension on the Editor page. Use notebooks for exploration, then move reusable code into scripts as described in project workflow.