I am using a module called investpy, and numpy is a dependency of it. I tried running pip install investpy, which installed all of the dependencies (or so it says). However, when I try running
import numpy
or
import investpy
, I am faced with this error:
Traceback (most recent call last):
File "C:\Users\kakor\OneDrive\Desktop\ML\numpy\__init__.py", line 124, in <module>
from numpy.__config__ import show as show_config
ModuleNotFoundError: No module named 'numpy.__config__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\kakor\OneDrive\Desktop\ML\stockscreener.py", line 1, in <module>
import numpy
File "C:\Users\kakor\OneDrive\Desktop\ML\numpy\__init__.py", line 129, in <module>
raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
I'm really confused as to why this is happening, because as far as I know, I correctly installed numpy. Furthermore, this is really weird because, if I go to the python directory in cmd and run import numpy, it works perfectly.
Any help would be greatly appreciated. Thank you!
Essentially numpy seems to complain that it isn't being imported from a standard path.
It looks like you installed numpy directly into your project directory under C:\Users\kakor\OneDrive\Desktop\ML\numpy You should remove that directory and try running
pip install numpy
Related
I have python 3.10 installed on disk C: and Anaconda with Python 3.9 on disk D:. When I try importing numpy in jupyter, I get the following error.
>>> import numpy
Traceback (most recent call last):
File "C:\Python310\Lib\site-packages\numpy\core\__init__.py", line 23, in <module>
from . import multiarray
File "C:\Python310\Lib\site-packages\numpy\core\multiarray.py", line 10, in <module>
from . import overrides
File "C:\Python310\Lib\site-packages\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 "<stdin>", line 1, in <module>
File "C:\Python310\Lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import core
File "C:\Python310\Lib\site-packages\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.9 from "D:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.23.3"
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'
Looks like Python interpreter from disk D: is looking for libraries in disk C:, and I suppose that the numpy file installed there is not compatible with python 3.9. I think it's because my PYTHONPATH is
>>> print("PYTHONPATH:", os.environ.get('PYTHONPATH'))
PYTHONPATH: C:\Python310\Lib\site-packages
But how do I change it so that Jupyter only looks for what's in Anaconda folder libraries and not break whatever I have on disk C:? I guess what I'm asking is, is it possible to have 2 PYTHONPATHs, one for Jupyter and one for whatever else? Would it be sufficient to just add Anaconda libraries folder to PYTHONPATH, or it would cause conflicts? Because how would Jupyter choose one path over the other?
I was reading This, when it said I was supposed to use the command python -m ursina.build to compile my project. When I launched the .bat file I got this error
package_folder: C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\build\python\lib\site-packages\ursina
asset_folder: src
screen resolution: (1920, 1080)
Traceback (most recent call last):
File "C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\main.py", line 3, in <module>
from mesh import ChunkManager
File "C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\mesh.py", line 19, in <module>
from noise import generateSaveNoise
File "C:\Users\sbahr\OneDrive\Documents\programming\Python\MeshGame\noise.py", line 3, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
I ran pip install numpy and it said numpy was already installed.
This used to be automatic, but broke in a newer version of Python. Therefore you'll have to provide a list of extra modules to copy, if you're using any.
From ursina's documentation (https://www.ursinaengine.org/building.html):
Make sure to include any extra modules with --include_modules PIL,numpy for example.
When I try to import numpy I get some long error which gives me instructions to try and fix the problem.
I read it through and tried the solutions but none worked. I just want to import numpy.
import numpy
The error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/numpy/core/__init__.py", line 40, in <module>
File "/usr/local/lib/python3.7/site-packages/numpy/core/multiarray.py", line 12, in <module>
File "/usr/local/lib/python3.7/site-packages/numpy/core/overrides.py", line , in <module>
ImportError: PyCapsule_Import could not import module "datetime"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Solution.py", line 1, in <module>
import numpy
File "/usr/local/lib/python3.7/site-packages/numpy/__init__.py", line 142, in <module>
File "/usr/local/lib/python3.7/site-packages/numpy/core/__init__.py", line 71, in <module>
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
22(removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
1. Check that you are using the Python you expect (you're using /usr/local/bin/python3),
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy versions you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
how you installed Python
how you installed numpy
your operating system
whether or not you have multiple versions of Python installed
if you built from source, your compiler versions and ideally a build log
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: PyCapsule_Import could not import module "datetime"
Also when I run any numpy function I get a segmentation error what does that mean and are there any fixes?
I'm trying to simply import numpy into a python script (called "MatPlotLib.py using PyCharm) and I'm receiving this odd error. It worked fine, but then I started messing around with Jupyter. I tried uninstalling and reinstalling Python, then a system restore, but nothing seems to be working. I think reinstalling numpy will do the trick, though I'm not sure how to do that.
I'm not sure what the error means by "a numpy git repo, so any help would be greatly appreciated. If you need any additional information please let me know. Find the full error below! :)
Thank you so much in advanced.
C:\ProgramData\Anaconda3\python.exe
C:/Users/Alex/PycharmProjects/2017_Research/Automation/MatPlotLib.py
Traceback (most recent call last): File
"C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\core__init__.py",
line 16, in
from . import multiarray ImportError: cannot import name 'multiarray'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:/Users/Alex/PycharmProjects/2017_Research/Automation/MatPlotLib.py",
line 1, in
import numpy File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy__init__.py",
line 142, in
from . import add_newdocs File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\add_newdocs.py",
line 13, in
from numpy.lib import add_newdoc File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\lib__init__.py",
line 8, in
from .type_check import * File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\lib\type_check.py",
line 11, in
import numpy.core.numeric as _nx File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\core__init__.py",
line 26, in
raise ImportError(msg) ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a
failed build of numpy. If you're working with a numpy git repo, try
git clean -xdf (removes all files not under version control).
Otherwise reinstall numpy.
Original error was: cannot import name 'multiarray'
Process finished with exit code 1
I'm using sublime text 2 to run python 2.7. I have downloaded and installed mathplotlib. When I type the code:
import matplotlib.pyplot
I'm getting this error.
Traceback (most recent call last):
File "/Volumes/HP v190b/Python - Squash Coursework/squashFINAL.py", line 212, in <module>
import matplot.pyplot as plt
ImportError: No module named matplot.pyplot
Any ideas why? I'm using a Mac!
You may check the dependencies, sometimes you need to install some dependencies so that you can import certain module, take a look at this link http://matplotlib.org/users/installing.html