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?
Related
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.
I have a problem with importing NumPy and pandas, already installed all the packages but trying to import them but getting the below error,
I also tried to uninstall and reinstall the packages again but didn't work.
here is the pip lists:
I also tried conda but couldn't solve the problem.
Btw: I am using Mac pro and atom.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/init.py", line 23, in
from . import multiarray
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in
from . import overrides
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/overrides.py", line 6, in
from numpy.core._multiarray_umath import (
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/_multiarray_umath.cpython-310-darwin.so' (no such file)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Desktop/test.py", line 2, in <module>
import numpy as np
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/__init__.py", line 144, in <module>
from . import core
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/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.10 from "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"
* The NumPy version is: "1.22.0"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/_multiarray_umath.cpython-310-darwin.so' (no such file)
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
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 wanted to installed logilab-common 0.61.0 on to my computer I am a windows user and my python version i 27. Whenever I import the module it throws me the error
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import logilab
File "logilab\__init__.py", line 28, in <module>
from logilab.common.__pkginfo__ import version as __version__
ImportError: No module named common.__pkginfo__
However I checked this file exists. Also when I try to call Pylint (the reason I installed logilab) from command line it throws import error
Loaded Module logilab not not found in sys.modules
I also tried to reinstall logilab and logilab astng. I do not If its a compatibility issue perhaps?
You probably have two distinct installation of the logilab package, one for logilab-common and the other for logilab-astng. Take a look at:
import logilab
print logilab.__path__
You should fix things (adjust PYTHONPATH?) so that you get the directory containing the common subdirectory there.
Also notice that for recent version of pylint (>= 1.0), logilab-astng has been replaced by astroid.