ModuleNotFoundError even after the module is installed - python

when i tried to install numpy from window cmd by using following command
pip install numpy
then it said
"Requirement already satisfied: numpy in
c:\users\ranjit\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
(1.21.3)"
but when i typed the following code in idle
import numpy
arr = numpy.array([1, 2, 3, 4, 5])
print(arr)
and run the code the following error occured
Traceback (most recent call last):
File "C:\Users\Ranjit\AppData\Local\Programs\Python\Python310\w3.py", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
why is it showing that no module named numpy even if it is installed?

Related

Problems with importing some modules (here numpy) (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath')

i would like to use opencv and tried to install the needed modules.
i need to install everything manually per donwload and then pip or install.
I am using Python 3.10.1 and Pip 21.2.4.
My project is an an venv.
The Following Modules are installed:
altgraph==0.17.2
cmake # file:///C:/Users/User/Python/modules/cmake-3.22.1-py2.py3-none-win_amd64.whl
cycler # file:///C:/Users/User/Python/modules/cycler-0.11.0-py3-none-any.whl
Cython # file:///C:/Users/User/Python/modules/Cython-3.0.0a9-cp310-cp310-win_amd64.whl
fonttools # file:///C:/Users/User/Python/modules/fonttools-4.29.0-py3-none-any.whl
future==0.18.2
kiwisolver # file:///C:/Users/User/Python/modules/kiwisolver-1.3.2-cp310-cp310-win_amd64.whl
matplotlib # file:///C:/Users/User/Python/modules/matplotlib-3.5.1-cp310-cp310-win_amd64.whl
numpy # file:///C:/Users/User/Python/modules/numpy-1.22.1-cp310-cp310-win_amd64.whl
opencv-python # file:///C:/Users/User/Python/modules/opencv_python-4.5.5-cp310-cp310-win_amd64.whl
packaging==21.3
paho-mqtt==1.6.1
pefile==2021.9.3
Pillow # file:///C:/Users/User/Python/modules/Pillow-9.0.0-cp310-cp310-win_amd64.whl
pyinstaller==5.0.dev0
pyinstaller-hooks-contrib==2021.5
pyparsing==3.0.7
python-dateutil # file:///C:/Users/User/Python/modules/python_dateutil-2.8.2-py2.py3-none-any.whl
pywin32-ctypes==0.2.0
scikit-build==0.12.0
six # file:///C:/Users/User/Python/modules/six-1.16.0-py2.py3-none-any.whl
i use a minimal script to check the import :
import sys
sys.path.append('C:\\Users\\User\\Python\\modules\\numpy-1.22.1-cp310-cp310-win_amd64.whl')
sys.path.append('c:\\users\\User\\python\\pyproj\\project1\\lib\\site-packages')
#import matplotlib
import numpy as np
that is the error:
Traceback (most recent call last):
File "C:\Users\User\Python\modules\numpy-1.22.1-cp310-cp310-win_amd64.whl\numpy\core\__init__.py", line 23, in <module>
from . import multiarray
File "C:\Users\User\Python\modules\numpy-1.22.1-cp310-cp310-win_amd64.whl\numpy\core\multiarray.py", line 10, in <module>
from . import overrides
File "C:\Users\User\Python\modules\numpy-1.22.1-cp310-cp310-win_amd64.whl\numpy\core\overrides.py", line 6, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\Python\pyproj\project1\import.py", line 6, in <module>
import numpy as np
File "C:\Users\User\Python\modules\numpy-1.22.1-cp310-cp310-win_amd64.whl\numpy\__init__.py", line 144, in <module>
from . import core
File "C:\Users\User\Python\modules\numpy-1.22.1-cp310-cp310-win_amd64.whl\numpy\core\__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.10 from "C:\Users\User\Python\pyver\python3101\python.exe"
* The NumPy version is: "1.22.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
i am new in python and i cant find the problem.
Greetings
Chorum
Addition:
with
import os
print("PYTHONPATH:", os.environ.get('PYTHONPATH'))
print("PATH:", os.environ.get('PATH'))
i get:
PYTHONPATH: None
PATH: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\imc\Shared;C:\Program Files (x86)\imc\shared;C:\Program Files\dotnet\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\SYSTEM\TNG
python is working fine. i used following modules before:
sys
tkinter
ctypes
time

No module named 'numpy'?

import numpy as np
Traceback (most recent call last):
File "C:\Users\xil15102\Documents\example.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
I used command prompt to install numpy already!
c:\>pip install numpy
Requirement already satisfied: numpy in c:\python27\arcgis10.6\lib\site-packages (1.9.3)
I also added a path to my scripts folder for python27 as well.

no module named numpy despite numpy being already installed

i get this error when running a python script
Traceback (most recent call last):
File "C:\Users\BruceWayne\Desktop\TF\train.py", line 2, in <module>
import numpy
ImportError: No module named numpy
So i tried
pip install numpy
and the answer was that the requirement is already satisfied

Quandl import error in Python 3

I'm using Python 3.6.3 on Windows 10 and Quandl module in my pip list, but I get the following error:
import quandl
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import quandl
File "C:\Users\Kamal\AppData\Local\Programs\Python\Python36-32\lib\quandl\__init__.py", line 3, in <module>
from .api_config import ApiConfig
ModuleNotFoundError: No module named 'quandl.api_config'
Try pip3 install quandl. If you have python2 installed, there may be a mismatch in symlinks related to pip.

setup.py missing in matplotlib

I have installed matplotlib from
http://matplotlib.org/downloads.html
I tried to get to the first step
c:\Python34\Scripts>py Example_01.py
Traceback (most recent call last):
File "Example_01.py", line 2, in <module>
import matplotlib.pyplot as plt
File "C:\Python34\lib\site-packages\matplotlib\__init__.py", line 105, in <mod
ule>
import six
ImportError: No module named 'six'
Using this site, I found advice that I should run setup.py. I found versions of setup.py in C:\Python34\Lib\site-packages\numpy but not in C:\Python34\Lib\site-packages\matplotlib.
So, my question would be:
Should I have a setup.py in the site-packages\matplotlib
Should there be a separate setup.py for each site package?
How would Python know which to run...both numpy and matplotlib can be imports.

Categories