numpy behaves differently on a normal Jupiter notebook and one from a visual studio venv

53 views Asked by At

I am running a web version of a Jupyter notebook from a course material, and this code cell runs through successfully:

enter image description here

But when I ran it from a VS CODE virtual environment, I get the below error. Please help with the error.

enter image description here

1

There are 1 answers

0
epursiai On

You are not stating what you mean by "web version". But in any case, you very likely have different versions of numpy. You can run

import numpy as np
np.__version__

in both of your environments to check the version you are using. Then, if you want to have the same version in your local VSCode, simply open the terminal and run

pip install numpy==x.y.z

Where x.y.z is the version you had in the web version.