I'm trying to update numpy from version 1.6.2 to 1.8.1. My first attempt was to do
sudo pip uninstall numpy
and then install it again with pip. But when I check the version I get the old one:
import numpy as np
np.__version__
'1.6.2'
Then, I tried to
sudo easy_install -U numpy
but I get an error:
RuntimeError: Broken toolchain: cannot link a simple C program
The path to the numpy version I use is: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
So, is the solution to manually install (from source) the desired version of Numpy or is there a way to use pip or easy_install?
Related
I think have a whole mess of conflicts. I was attempting to run some code in a notebook and got the following message:
ImportError: this version of pandas is incompatible with numpy < 1.16.5
your numpy version is 1.16.2.
Please upgrade numpy to >= 1.16.5 to use this pandas version
I have version 1.2.2 of pandas installed.
I ran conda update numpy and still got the same error when I tried to run the notebook. I ran conda list and it says my version is 1.20.0 but if I run:
import numpy
print(numpy.version.version)
It says my version is 1.16.2. Running pip list it says my version is 1.16.2. I tried to force an upgrade by using pip install -Iv numpy==1.20.0 --force-reinstall and it returned the following error at the end of the install:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
target-encoding 0.5.0 requires numpy==1.16.2, but you have numpy 1.20.0 which is incompatible.
Successfully installed numpy-1.20.1
Yet it still says that my version is 1.16.2 and that pandas is still incompatible with numpy.
Thank you in advance for any help you can give me to resolve this quagmire.
Same issue here. Solved by reinstalling numpy a few times subsequently, until there is not any version of it installed. And then install again the version I needed.
Hi everyone im currently facing problems with importing NumPy in jupyter notebook.
My first line of code was import numpy as np it resulted into giving me:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-8b972f5c2406> in <module>
----> 1 import numpy as np
After that my second option was to install NumPy which I did using !pip3 install numpy and that gave me Requirement already satisfied: NumPy in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.19.0)
Can someone let me know if I should re-download pip or something is wrong in my files? Thank you.
Check what version of python is your jupyter running.
Its highly likely that its running python 2.x.
If so, try using !pip install numpy instead of !pip3 install numpy.
You need to go to your Terminal, and execute !pip install numpy or pip3 install numpy depending on which version of Python you are using.
In the terminal, check for your python version using below command:
python --version
if you are using version 2 or 3:
python -m pip install numpy
if you are using version 3 or higher:
python3 -m pip install numpy
This way you know about where the package will be installed
I'm installing caffe2 in a remote server, and I used pip to install a module called Numpy.
The python(2.7.6) is in :
/usr/bin/python
The pip is in :
/usr/local/bin/pip
when I use 'pip show numpy':
Name: numpy
Version: 1.13.0
Location: /usr/local/lib/python2.7/dist-packages
but when I try to import it in python:
>>> import numpy as np
>>> n.__version__
'1.8.2'
>>>>>> n.get_include()
'/usr/lib/python2.7/dist-packages/numpy/core/include'
so I tried export PYTHONPATH in relative rc files:
export PYTHONPATH="/usr/local/lib/python2.7/dist-packages":$PYTHONPATH
but this doesn't help.
What's the next step should I take?
The way to avoid all this confusion is to always use a virtualenv, and install the correct version of numpy there.
Trying to install OpenCV and running into an issue where attempting to import cv2 results in this output -
RuntimeError: module compiled against API version 9 but this version of numpy is 7
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import cv2
ImportError: numpy.core.multiarray failed to import
I'm running on Windows 7 x64, Python v 2.7.9
Thanks!
The error is telling you that you have an out of date version of numpy. If you used pip to install things you can simply run pip install numpy -U, or download the appropriate version from their website.
In case
pip install -U numpy
doesn't work (even with sudo), you may want to make sure you're using the right version of numpy. I had the same "numpy.core.multiarray failed to import" issue, but it was because I had 1.6 installed for the version of Python I was using, even though I kept installing 1.8 and assumed it was installing in the right directory.
I found the bad numpy version by using the following command in my Mac terminal:
python -c "import numpy;print numpy.version;print numpy.file";
This command gave me the version and location of numpy that I was using (turned out it was 1.6.2). I went to this location and manually replaced it with the numpy folder for 1.8, which resolved my "numpy.core.multiarray failed to import" issue. Hopefully someone finds this useful!
I had a similar problem and I solved it by downgrading my numpy version.
What I did was:
pip install opencv-python
pip uninstall numpy
pip install numpy=1.18
This has worked for me using
Python 3.7
opencv-python 4.4.0.46
numpy 1.18.0
linux: sudo apt-get install python-numpy
if you are using ubuntu bionic beaver then try running: sudo apt-get install python-numpy
had the same issue, resolve by running the above command.
Hope it helps
In your environment you can try this command:
conda uninstall numpy
conda install -c conda-forge numpy
I use Python 3.7 # RPI 4.
For opencv to install properly I had to install the listed libraries below.
(Not every package was actually installed, after request)
Regarding Numpy, I think one should stick to the latest version.
For me what worked is to uninstall the existing version 1.16.2 and stick with the current stable 1.21.2.
Stackoverflow topic at missing libraries here: ImportError: libcblas.so.3: cannot open shared object file: No such file or directory.
Trying to update NumPY by running pip install -U numpy, which yields "Requirement already up-to-date: numpy in /Library/Python/2.7/site-packages". Then checking the version with import numpy and numpy.version.version yields '1.6.2' (old version). Python is importing numpy via the path '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy'. Please help me out here.
You can remove the old version of numpy from
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
.
Just delete the numpy package from there and then try to import numpy from the python shell.
The new NumPY version would install (via pip) into the System path, where it wasn't being recognized by Python. To solve this I ran pip install --user numpy==1.7.1 to specify I want NumPY version 1.7.1 on my Python (user) path.
:)