Doubt about installing package

If you are doing this locally, you’d ideally want to be doing this in a virtual environment.

Did you try running in your active Jupyter .ipynb file?:

%pip install --force-reinstall numpy==1.26.4

Why that?

First, you’d want to see the answer here to ‘Installing specific package version with pip’ because in general this type of specifying version number when installing isn’t particular to Jupyter.

But since you are running it in Jupyter so you should be using the magic symbol in front of pip.
Why the magic symbol?..
You should read my comments here under ‘Context’. Using the exclamation point with pip is not current best practice inside Jupyter and could cause you to introduce issues that you would have avoided if you had used %pip.


More details may help you follow what was going on here:

In modern Jupyter, tpyically auto-magic is on and so running pip install numpy without any symbol is therefore equivalent to %pip install numpy. In other words, without a symbol in front of pip or conda, generally Jupyter will try the magic symbol behind the scenes. It is though best to be explicit so you and others reading what you did are clear.
And because you weren’t specifying a version it was installing the current version.