In an AWS EC2 instance, with Amazon Linux AMI 2016.09 distribution, I have installed numpy, inside my virtualenv where python 3.4 is the default version, with:
pip install numpy
It installs package numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl without errors.
After that, in python I try to import it:
>>> import numpy
And I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
Moreover, if I run pip freeze, numpy does not appear in the list.
Why is numpy not being found? and How to fix it?
Did you do this:
#:source .venv/bin/activate
.....
#:python
....
>>>pip3 install numpy
....
This works!
Related
I installed RasPiOS Bullseye OS in my Raspberry Pi zero, with Python 3.9.2.
I installed opencv with
sudo apt install python3-opencv -y
I test import cv2 and it works. Then I installed vidgear with pip3 install vidgear .
I test import cv2 and not works:
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd
Traceback (most recent call last):
File "", line 1, in
ImportError: numpy.core.multiarray failed to import
Numpy version is 1.19.5. The same version that was there before installing vidgear.
I tried pip3 uninstall numpy and pip3 install numpy==1.19.5 , but don't work, same error.
Can you help me, please?
thank you,
I am unable to import simpy in Python 3. It gives me this error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-076c1059698e> in <module>
----> 1 import simpy
ModuleNotFoundError: No module named 'simpy'
Please tell me a way to do so?
Make sure the package is installed and available in your environment, as that is a common error when the package is not present.
Run:
pip install simpy
or if you have separate Python versions on your system:
pip3 install simpy
Or, if installing from the source code:
python setup.py install
or,
python3 setup.py install
I installed Anaconda on my machine and created a separate environment for tensorflow. Installed tensorflow and keras ok but both packages cannot be imported. The error is:
In [1]: import tensorflow
Traceback (most recent call last):
File "<ipython-input-1-88d96843a926>", line 1, in <module>
import tensorflow
ModuleNotFoundError: No module named 'tensorflow'
Dependencies that were installed during the install like scipy and yaml can be imported.
When I run python3 from the command line I can import keras and tensorflow correctly. This fails when I try to import tensorflow in Spyder.
I rebooted, uninstalled and installed again. I am sure that I am in the correct environment. Does somebody know what I do wrong?
I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error:
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 980, in _find_and_load SystemError:
<class '_frozen_importlib._ModuleLockManager'> returned a result with
an error set ImportError: numpy.core._multiarray_umath failed to
import ImportError: numpy.core.umath failed to import
I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python.
I am using Windows10.
I also had the same issue.
It got resloved once I upgraded the numpy from 1.15.4 to 1.16.1.
If you're using pip:
pip install numpy --upgrade
Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked.
Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me.
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there.
Please use the below mentioned statement for this purpose
conda install -c anaconda numpy
Also make sure that the numpy version supports the Python version you are using.
You can use two options in python 3.6
Install
py pip -m install numpy==1.14.5
Upgrade
py pip install numpy --upgrade
Note: the version most recently is 1.14.5
I also had this issue with python 3.8.9 and Numpy 1.24.1.
Downgrading to Numpy 1.21.0 fixed the issue.
I am beginner in python and want to use database.I have followed following link for database access.
steps
The output of steps which i has used as following :
Command
pip3 -V
Result
pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
Second Command
pip3 install PyMySQL
Result
Requirement already satisfied: PyMySQL in /usr/local/lib/python3.5/dist-packages/PyMySQL-0.9.2-py3.5.egg (0.9.2)
While i was using script to access database i got following error.
Traceback (most recent call last):
File "pymysql.py", line 2, in <module>
import pymysql.cursors
File "/var/www/cgi-bin/pymysql.py", line 2, in <module>
import pymysql.cursors
ImportError: No module named 'pymysql.cursors';
`enter code here`'pymysql' is not a package
Environment :
OS - Ubuntu 16.04
Python version - Python 3.5
Try the below command,
python3 -m pip install PyMySQL