My jupyter notebook doesn't warn to use the latest numpy version

Viewed 54

I am using a conda virtual env and i already upgraded numpy to 1.22. In my notebook it still uses 1.19.

enter image description here

why isn't it using 1.22?

Also when i open the venv in Python with a CLI:

>>> import numpy
>>> numpy.__version__
'1.22.4'

1 Answers

Are you running Jupyter from a base environment or from the new environment? If you are launching Jupyter from a different environment, you need to switch kernels to the new environment.

There are several ways to check which kernel you are using, typically:

import sys
sys.executable

If the path is not in the correct environment, you can change by selecting the Kernel drop-menu > "Change Kernel..."

If the kernel you want to use does not appear there, you need to install ipykernel.

conda install --name <env name> ipykernel

How did you install the new version of numpy? For a Conda environment, you should use Conda. If you used PIP, it may be in an entirely different location/environment.

You can check the difference by running the following in Jupyter and the Python REPL:

import numpy as np
np.__file__
Related