Python Forum

Full Version: Unsure why module is not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to run a piece of code acquired from someone online (trusted source). I run the program and I get the following error...

Error:
C:\Users\garyn\Downloads\######\######>py Analysis.py Traceback (most recent call last): File "C:\Users\garyn\Downloads\######\######\Analysis.py", line 18, in <module> from sklearn.preprocessing import StandardScaler File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\__init__.py", line 82, in <module> from .base import clone File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\base.py", line 17, in <module> from .utils import _IS_32BIT File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\utils\__init__.py", line 17, in <module> from scipy.sparse import issparse File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\__init__.py", line 283, in <module> from . import csgraph File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\csgraph\__init__.py", line 185, in <module> from ._laplacian import laplacian File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\csgraph\_laplacian.py", line 7, in <module> from scipy.sparse.linalg import LinearOperator File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\linalg\__init__.py", line 120, in <module> from ._isolve import * File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\linalg\_isolve\__init__.py", line 4, in <module> from .iterative import * File "C:\Users\garyn\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\sparse\linalg\_isolve\iterative.py", line 9, in <module> from . import _iterative ImportError: DLL load failed while importing _iterative: %1 is not a valid Win32 application.
All relevant modules are installed. This requries sklearn, which requires scipy, which calls iterative.py, which fails?

Obviously, scipy is a major package that appears to be used by lots of people, with no errors being reported (that I can find) and I have just installed the latest versions of everything (downgrading numpy, as the system requires <1.24 and I had 1.24.2).

Any ideas why this is being generated?

Everything is in the path and this is not a virtual environment. I am running Python 3.11.0 with 23.0