Nishant
Nishant

Reputation: 633

Numpy is installed but still getting error

I am trying to run jupyter notebook and getting following error. I am using Win 7 with anaconda python 3.7.

ImportError: Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['c:\users\paperspace\anaconda3\envs\tensorflow10\lib\site-packages\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.

I have followed the steps mentioned in the error but still not working.

Upvotes: 39

Views: 101962

Answers (12)

Sameera Peiris
Sameera Peiris

Reputation: 189

1. Install Microsoft C++ Build Tools (Required) Since NumPy and other dependencies require C++ compilers, install the latest Microsoft C++ Build Tools:

Download and install Microsoft Build Tools for Visual Studio: 👉 Download Link

During installation, select these components:

  • ✅ Desktop development with C++
  • ✅ MSVC v143 - VS 2022 C++ x64/x86 build tools
  • ✅ Windows 10 SDK
  • ✅ C++ CMake tools for Windows

Restart your system after installation.

2. Install Dependencies Before Langflow

pip install --upgrade pip setuptools wheel meson
pip install numpy==1.24.3
pip install scipy

3. Install Langflow Properly

pip install langflow

If you still get errors, try specifying an older version

pip install langflow==1.1.1

Upvotes: 0

Spark
Spark

Reputation: 2487

Run:

pip3 uninstall numpy

Until you receive a message stating no files available with numpy to uninstall and then you can freshly install numpy using

pip install numpy

And that will fix the issue.

Upvotes: 23

Carlos Ferreira
Carlos Ferreira

Reputation: 2078

Your issue maybe similar to mine below.

How to reproduce it

  1. Started a virtual environment named "jupyter_ve" with numpy=1.21.0 where I launched jupyter.
  2. Opened a notebook using a virtual environment named "project_ve" with numpy=1.20.0 where I launched my notebook kernel using "project_ve"
  3. In Notebook import fails on from numba import njit giving errors install numpy 1.20.0 or lower

Solution

Make sure you install numpy version in the virtual environment you used to start the jupyter.

In my case above I had to install / downgrade numpy in the virtual envrionment where I launched jupyter from. It doesn't matter that I had installed notebook virtual environment kernel.

Upvotes: 0

Shalini Maiti
Shalini Maiti

Reputation: 404

From what I understand, you have possibly used multiple package download managers, possibly to install something other than numpy but that has a dependency on numpy. Since you are using anaconda environment, it is a good practice to try to not to use other package managers such as pip in the same environment. When that happens, the problem is that pip adds the lib file as the path for the library and so, the system points to that numpy installation.(or in our case, does not know which one to choose)

So, use the equivalent of :

pip show <name of the package, i.e numpy> 
conda list <name of the package, i.e numpy> 

etc. Use the above to check which versions of these libraries you have on your system. Then, use the equivalent commands to remove all these versions. Be careful about the dependencies!

pip uninstall <name of the package, i.e numpy> 
conda uninstall <name of the package, i.e numpy> 

etc.

Next, use the anaconda environment to download the version of numpy that you require. The dependencies are probably going to get jumbled up.

In the future, try to create a new anaconda environment if you see dependency version conflicts instead of using some other package managers to download.

Cheers! I hope that helps.

Upvotes: 2

JasonWayne
JasonWayne

Reputation: 1854

Besides all the other answers, you may try something like

yum erase numpy

if you intalled some python library using yum install or apt-get install

Upvotes: 0

Trect
Trect

Reputation: 2965

Apparently, multiple versions of numpy is installed on the computer in the same python virtual environment. This is strange and never happened with any other packages. Uninstall all the packages and install numpy again. This should solve the problem.

Use pip to uninstall.

pip3 uninstall numpy 
# or
python3 -m pip uninstall numpy

Then install again. Preferably with the exact version number.

pip3 install numpy==1.18.4

I had to uninstall numpy thrice. Until I got the message WARNING: Skipping numpy as it is not installed.

Upvotes: 0

anthony .bm
anthony .bm

Reputation: 201

Remove the folder numpy and reinstall numpy. work for me. Code below

rm -rf ~/.local/lib/python3.6/site-packages/numpy
pip install numpy

Upvotes: 20

Brian Schneider
Brian Schneider

Reputation: 1

For me it was about the consoles used.

My cygwin terminal - NOPE, dos - NOPE, but console opened from Anaconda or Spyder etc... all commands (pip install etc) worked.

Upvotes: -2

钟智强
钟智强

Reputation: 480

This Means a Duplicated. Try pip uninstall numpy or pip3 uninstall numpy then sudo apt-get install python3-numpy

FOR (DEBIAN DIST)

Upvotes: 4

Hertzel Guinness
Hertzel Guinness

Reputation: 5950

per https://github.com/numpy/numpy/issues/12976, tried conda update -c defaults numpy and it worked. YMMV...

Upvotes: 1

Siddharth Shrivastava
Siddharth Shrivastava

Reputation: 59

Use conda update --all

This works.

Upvotes: 3

KK2491
KK2491

Reputation: 508

I was getting the error when I was trying to use Keras. This can be fixed by removing the numpy package continuously by running pip3 uninstall numpy. And checking the successful un-installation by opening a python terminal and importing numpy package.

Upvotes: 10

Related Questions