courses
courses copied to clipboard
Use %pip install instead of !pip install in the notebooks
trafficstars
I was following this notebook: https://github.com/anthropics/courses/blob/cf2979dc88626f15c760ce83bc9e9e21015fcac5/prompt_engineering_interactive_tutorial/Anthropic%201P/00_Tutorial_How-To.ipynb
I cloned the repo and started the notebook like this, which was delightfully fast:
uv run jupyter-notebook .
But I got an error trying to import anthropic. It turns out this was because I was running Jupyter from a different environment, so this line:
!pip install anthropic
Installed the package into my default system environment, not the one for the notebook.
The fix is to use this instead:
%pip install anthropic
https://github.com/anthropics/courses/blob/cf2979dc88626f15c760ce83bc9e9e21015fcac5/prompt_engineering_interactive_tutorial/Anthropic%201P/00_Tutorial_How-To.ipynb#L29-L31