I need to use numpy for python 3.2 (i'm using 3.2.5).
I've installed numpy 1.8.2 via the .msi for python 3.2, and i tried running some basic things :
import numpy as np
x = np.array([[1,2],[3,4]])
print(x)
There's the console output :
Traceback (most recent call last):
File "C:/Users/Askerad/PycharmProjects/untitled/main.py", line 3, in <module>
from numpy import *
File "C:\Python32\lib\site-packages\numpy\__init__.py", line 153, in <module>
from . import add_newdocs
File "C:\Python32\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python32\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Python32\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Python32\lib\site-packages\numpy\core\__init__.py", line 6, in <module>
from . import multiarray
ImportError: DLL load failed: %1 n’est pas une application Win32 valide.
(the french part says : '%1 isn't a valid Win32 application')
i don't know what to do to make numpy work.
Edit : Changed the code just as Sarens said
You have an architecture mismatch, you need to install a 32bit binary from that link as you are using a 32 bit version of python, I would upgrade python to the latest version 3.4 and use a 64 bit version of python then you can install 64bit binaries. The latest version of numpy is also 1.9.2.
Related
I can import numpy with no issues. However, when trying to import easyocr I'm getting the following error:
>>> %Run numpytst.py
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
File "/home/pi/numpytst.py", line 2, in <module>
import easyocr
File "/home/pi/.local/lib/python3.7/site-packages/easyocr/__init__.py", line 1, in <module>
from .easyocr import Reader
File "/home/pi/.local/lib/python3.7/site-packages/easyocr/easyocr.py", line 3, in <module>
from .detection import get_detector, get_textbox
File "/home/pi/.local/lib/python3.7/site-packages/easyocr/detection.py", line 9, in <module>
from .craft_utils import getDetBoxes, adjustResultCoordinates
File "/home/pi/.local/lib/python3.7/site-packages/easyocr/craft_utils.py", line 10, in <module>
from scipy.ndimage import label
File "/home/pi/.local/lib/python3.7/site-packages/scipy/ndimage/__init__.py", line 151, in <module>
from .filters import *
File "/home/pi/.local/lib/python3.7/site-packages/scipy/ndimage/filters.py", line 37, in <module>
from . import _nd_image
ImportError: numpy.core.multiarray failed to import
Environment:
Raspberry Pi 3B
Python 3.7.3
numpy 1.16.6
Have you tried to upgrade to a more recent version? like 1.20.x. I solved a similar Error by simply upgrading my NumPy to ver 1.20.3.
The reason could be the mismatch between dependencies. This worked for me:
pip install numpy --upgrade
I am trying to run some C++ code with embedded Python. Code was working completely fine a couple of weeks ago. The code still compiles, but I am now getting the error
Traceback (most recent call last):
File "./main.py", line 1, in <module>
import numpy as np
File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py", line 74, in <module>
from numpy.testing.nosetester import _numpy_tester
File "/usr/local/lib/python2.7/site-packages/numpy/testing/__init__.py", line 10, in <module>
from unittest import TestCase
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/__init__.py", line 64, in <module>
from .main import TestProgram, main
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 7, in <module>
from . import loader, runner
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py", line 7, in <module>
from .signals import registerResult
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/signals.py", line 2, in <module>
import weakref
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Since then the only change I have made is to install the macOS Supplemental Update and to upgrade Python from 2.7.13_1 to 2.7.14_2 (using Homebrew). I have changed the relevant linker flags in the makefile, i.e. those that appear when I type python-config --ldflags. I have also made sure that the Python I am using is definitely the Homebrew one by inserting export PATH="/usr/local/opt/python/libexec/bin:$PATH" into my .bash_profile as directed by Homebrew.
I am not sure whether this error is because of the Python update, the recent macOS Supplemental Update, or something else. Any idea what the problem could be?
Thanks
I had the same problem;
In python 2.7 the NumPy 1.8.0 was available,
Then I installed NumPy (again) using brew, and it wasn't available in my python (2.7) anymore. (Got the same error you got here)
So I did "brew unlink python && brew link python" to use python 3 (instead of 2) which NumPy 1.14 is available in it.
I guess the python 2.7 was not compatible with this recent version of NumPy.
Can anyone help me with this error? I don't have any older versions of numpy, and i installed it using pip, i get 1.13.0 version of numpy and I'm working on Windows 10 OS. Any suggestions?
Traceback (most recent call last):
File "C:/Users/Asus/PycharmProjects/g/num.py", line 1, in <module>
import numpy
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
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: DLL load failed: The specified procedure could not be found.
You are, apparently, a victim of issue 9272. numpy is built against Python 3.6.1 but you're using Python 3.6.0.
Based on the discussion there, you should just upgrade to Python 3.6.1 to get it to work. It does seem like they will build on 3.6.0 too, though, follow that issue to keep track of that.
I presently have Python 2.7 installed, and have been attempting to get my pygeoprocessing module to work correctly (which appears to have been installed correctly). This is the version of Idle Python I am running:
"Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32"
When I type in "import pygeoprocessing" from the Idle command line, this is the error message . . .
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pygeoprocessing
File "C:\Python27\ArcGISx6410.4\lib\site-packages\pygeoprocessing\__init__.py", line 10, in <module>
from geoprocessing import *
File "C:\Python27\ArcGISx6410.4\lib\site-packages\pygeoprocessing\geoprocessing.py", line 25, in <module>
import scipy.interpolate
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\interpolate\__init__.py", line 160, in <module>
from .interpolate import *
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\interpolate\interpolate.py", line 15, in <module>
import scipy.linalg
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\linalg\__init__.py", line 161, in <module>
from .misc import *
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from . import blas
***File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\linalg\blas.py", line 155, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
When I navigated to the folder mentioned ( . . . scipy\linalg\blas.py) I found that both blas.py and _fblas were present. Therefore I don't know why I got that last import error.
Is there something I can check?
Thanks!
Since you are on a windows box you may want to verify whether you have the 64-bit or the 32-bit version of python installed. That has caused problems for me in the past.
If the above listed methods do not work, try installing the module with pip.
And then try importing it.
C.f. How do I install pip on Windows?
Using the 64 bit version of python 2.6, I installed the unofficial 64 bit scipy module from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy. I tried running a script that specifically uses the scipy.ndimage module, which leads to this error:
Traceback (most recent call last):
File "PhantomAnalysis.py", line 79, in <module>
import scipy.ndimage
File "C:\Python26\lib\site-packages\scipy\ndimage\__init__.py", line 175, in <
module>
from .measurements import *
File "C:\Python26\lib\site-packages\scipy\ndimage\measurements.py", line 36, i
n <module>
from . import _ni_label
ImportError: DLL load failed: The specified procedure could not be found.
I'm just not able to import scipy.ndimage at all using those packages. Is this an issue with the package or with my installation/configuration?
I can provide any other relevant information.