Numpy is installed, but astropy says numpy is not installed - python

An ImportError is thrown when my program searches for Numpy. Yet, numpy is installed as seen by the import numpy working properly.
I've tried
uninstalling python and numpy and reinstalling with choco
with pip
and with conda.
None seem to work. Any suggestions?

Any suggestions?
Does import numpy; print(numpy.__version__) work when you execute c:\agent03_work\s\turo.venv\bin\python.exe ? If not, you need to c:\agent03\_work\s\turo\.venv\bin\pip install numpy and you should be sorted.

Related

cannot import name 'inv' from 'numpy.linalg' (unknown location)

import matplotlib.animation as animation
The error show up when I import matplotlib.animation
I tried to reinstall numpy scipy and matplotlib, but it didn't work
environment list
-torch=1.12.1
--numpy=1.23.4
--scipy=1.9.2
--networkx=2.8.7
--matplotlib=3.6.1
--dgl=0.5.1
I had the same problem yesterday, and I found out that the error didn't only occur in matplotlib, but actually in other packages (at least for me). So I figured out that the error was from numpy. I just uninstalled numpy and installed it again:
pip uninstall -y numpy
pip install numpy
Hope it works for you!

AttributeError while running Scipy.ndimages.imread

when running:
import scipy
scipy.ndimage.imread('path/to/image',mode='RGB')
I got
AttributeError: module 'scipy.ndimage' has no attribute 'imread'
I already tried to uninstall and reinstall scipy and also to reinstall Pillow and numpy as said there
Is there some missing module?
I came across this issue today as well. This happens because scipy.ndimage.imread is deprecated, see doc here.
To do the same, you can to use the imageio package
conda install -c conda-forge imageio
After this, you can do
import imageio
imageio.imread('path/to/image',mode='RGB')
A library that provides imread which most people already have is matplotlib. Just use it like this:
import matplotlib
matplotlib.pyplot.imread('path')
Using pytorch below method worked for me.
import matplotlib.pyplot as plt
plt.imread('Image_path')

Can't import numpy in python 2.7

When running the following code in python 2.7:
import numpy
I get the result:
ImportError: No module named numpy
I have however got numpy installed for python 2.7, which is seen when running the following in terminal:
pip install numpy
I get the following:
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Working on macOS10.13.1
What am I missing?
Any help will be greatly appreciated!
have you tried uninstalling the numpy package and re-installing it? As mentioned you may be running python 3 instead of python 2 which could cause this issue.alternatively you could install an api like anaconda which comes with numpy pre-installed this may resolve the missing module. anaconda website: https://www.anaconda.com/download/

Python 2.7 ImportError: No module named numpy

I trying to run a program in python 2.7 that uses numpy but it gives me the error ImportError: No module named numpy. I am using Windows 10. I tried running pip install numpy and it says it was installed but I still can't run the program.
I think Pip installed your package for Python3.
That's why your python can't find Numpy
If you want to use NumPy for Python2 you must install directly 1.13.3 cp27 version, or you must install Python3.
You can check NumPy and Python versions here.
https://pypi.python.org/pypi/numpy
My personal advice is to use Python3. It's not a good time to use Python2 I think.
You can check some resources
https://wiki.python.org/moin/Python2orPython3
http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
https://www.activestate.com/blog/2017/01/python-3-vs-python-2-its-different-time

How to find and uninstall the numpy duplicate versions

I am trying to install the library GPy. Although the installation is successful, I have a question on my numpy version.
GPy library can be found here https://github.com/SheffieldML/GPy
The current version of my numpy is 1.9.3
>>> import numpy
>>> numpy.version.version
'1.9.3'
But when I perform python setup.py install for GPy, it refers to numpy 1.10.0. I checked in python 2.7/site-packages there only one version of numpy exist that too 1.9.3
Using /home/vinod/anaconda/lib/python2.7/site-packages
Searching for scipy==0.16.0
Best match: scipy 0.16.0
Adding scipy 0.16.0 to easy-install.pth file
Using /home/vinod/anaconda/lib/python2.7/site-packages
Searching for numpy==1.10.0
Best match: numpy 1.10.0
Adding numpy 1.10.0 to easy-install.pth file
Using /home/vinod/anaconda/lib/python2.7/site-packages
Finished processing dependencies for GPy==0.8.8
vinod#vinod-Lenovo-G580:~/GPy$
Since it's referring to another version am getting error like
File"__init__.pxd", line 155, in init GPy.util.linalg_cython (GPy/util/linalg_cython.c:4238)
ValueError: numpy.dtype has the wrong size, try recompiling
Could anyone tell me how to find and remove the numpy 1.10.0 ?
From the conda FAQ:
conda update numpy --no-pin
I tried the following steps and it works but still I don't know how.
I opened the setup.py and changed the numpy condition from numpy >= 1.7 to numpy <=1.9.3
Then I performed the python setup.py install
Then I uninstalled GPy using pip uninstall GPy
Again I installed GPy but using pip install GPy. Note: in previous steps I used git and installed separately.
This time it upgraded my numpy to 1.10.0 during installation and got installed successfully
Finally now it works well.
python Packeges
installed
select the library you want to unistall
"delate" by selecting tenter image description herehe menu on the right

Categories