In general, numpy
works when imported from Quarto, I use it frequently. This problem is likely caused by some environment configuration on your machine.
If VSCode finds a virtual environment on the directory it's running from, it will automatically load it. Therefore, my suggestion to you is:
- Change to your directory with
cd <mydir>
- Create a new virtual environment in that directory with
python3 -m venv .venv
- Activate the environment
- Install numpy with
python3 -m pip install numpy
- Run VSCode
code .
from that directory
- Run preview again