Working in the Conda environment¶
Everything runs inside the rlbootcamp environment. This page is the
muscle-memory you need — it is short on purpose.
Activate / deactivate¶
Your prompt shows (rlbootcamp) when it is active.
If you remember one thing
"It says the module isn't installed, but I installed it" is almost always a deactivated environment. Check the prompt first.
Run a single command without activating¶
Handy in scripts, IDEs, cron jobs, or when you simply forget:
conda run -n rlbootcamp python scripts/smoke_test.py
conda run -n rlbootcamp tensorboard --logdir runs/
Confirm which Python you're using
The path must containenvs/rlbootcamp. If it does not, you are running a
different interpreter and that explains your import errors.
Keep the environment up to date¶
When environment.yml changes, refresh rather than recreate:
--prune removes packages that were dropped from the file.
Add a package for an experiment¶
Mixing pip and conda inside one environment is fine as long as you install
conda packages first and pip packages second — which is what environment.yml
already does. Avoid conda install after heavy pip installs; the solver can
downgrade things underneath pip's feet.
Use it in Jupyter¶
JupyterLab and ipykernel ship with the environment. Register it as a kernel
once, so notebooks can find it:
conda activate rlbootcamp
python -m ipykernel install --user --name rlbootcamp --display-name "Python (rlbootcamp)"
jupyter lab
Then pick the Python (rlbootcamp) kernel in the notebook's kernel menu.
The notebook kernel is a separate choice
Activating the environment in your terminal does not change which kernel an already-open notebook uses. If imports fail inside a notebook but work in the terminal, you are on the wrong kernel. Check the top-right of the notebook.
Use it in VS Code / PyCharm¶
The interpreter and the notebook kernel are separate settings in both IDEs, which is where most of the confusion comes from:
Start over (last resort)¶
Recreating is cheap and fixes a surprising number of problems:
Next: Troubleshooting →