0

I am getting the above mentioned error importing scikit-learn, matplotlib and scipy (numpy works fine).

I have python 2.7 64 installed (C:\Python27).

I have recently installed win10 64 bit on a new cloned drive. I went over the suggestions of similar posts:

ImportError: DLL load failed: %1 is not a valid Win32 application

ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

ImportError: DLL load failed: %1 is not a valid Win32 application for Python Matplotlib

I reinstalled the packages from a wheels version.

http://www.lfd.uci.edu/~gohlke/pythonlibs/

I added the directories to path, added PythonPath to System.

Still getting error.

I appreciate suggestions, I am stuck.

Thanks

Diego
  • 637
  • 3
  • 10
  • 24
  • Where does the %1 comes from ? Probably from your script.... It looks like a formatting function call failed, or rather that formatting was not dome at all.. – Michaël Roy May 07 '20 at 00:50
  • @MichaëlRoy, the "%1" is an insert in the error message for the system error [`ERROR_BAD_EXE_FORMAT`](https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-#ERROR_BAD_EXE_FORMAT). Python's generic handling for OS errors calls `FormatMessage` with the flag `FORMAT_MESSAGE_IGNORE_INSERTS`, which the follows the guideline that "it is unsafe to take an arbitrary system error code returned from an API and use FORMAT_MESSAGE_FROM_SYSTEM without FORMAT_MESSAGE_IGNORE_INSERTS". – Eryk Sun May 07 '20 at 03:57
  • In Python 3 the error message before the colon has been improved to include the extension module that failed: "DLL load failed while importing ". But still, knowing "" doesn't generally help. Often the problem is a DLL that the extension module depends on. To discover the mismatched file, you need to monitor file access via Sysinternals Process Monitor, or attach a debugger and enable loader snaps to find the DLL that failed to load. – Eryk Sun May 07 '20 at 04:06
  • @ErykSun, thanks for taking the time to answer. I ran Sysinternals Process Monitor. I am figuring out how to find the DLL that failed to load. Any other suggestions are welcome. – Diego May 07 '20 at 10:52

1 Answers1

1

I was able to fix it.

The way to go was 'force-reinstall'.

This was enough to get scikit-learn up and running.

pip install --upgrade --force-reinstall scipy
Diego
  • 637
  • 3
  • 10
  • 24