FEMax
FEMax

Reputation: 31

Scipy Optimization in Abaqus: ImportError: DLL load failed: %1 is not a valid Win32 application

I am using python for scripting in Abaqus 6.14-3 and would like to use an optimization function from the scipy package. This version of abaqus runs with python 2.7.3 (64bit) and has numpy 1.6.2 installed. So I installed scipy 0.9.0 (32bit), which I think is the compatible version.

Trying to import optimize I get the following error:

from scipy import optimize
File "C:\SIMULIA\Abaqus\6.14-3\tools\SMApy\python2.7\lib\site-packages\scipy\optimize\__init__.py", line 7, in <module>
from optimize import *
File "C:\SIMULIA\Abaqus\6.14-3\tools\SMApy\python2.7\lib\site-packages\scipy\optimize\optimize.py", line 28, in <module>
from linesearch import \
File "C:\SIMULIA\Abaqus\6.14-3\tools\SMApy\python2.7\lib\site-packages\scipy\optimize\linesearch.py", line 1, in <module>
from scipy.optimize import minpack2
ImportError: DLL load failed: %1 is not a valid Win32 application.

From other question on this error code I assume the different bit versions might be the problem. I am not sure though if it is possible to change pyhton to the 32bit version. Also, I am not sure what bit version numpy is.

I would appreciate any suggestions to find out the bit version of numpy and possibly how to install compatible versions.

Upvotes: 3

Views: 1360

Answers (1)

max9111
max9111

Reputation: 6492

"Normal" CPython 2.7 is compiled with MSVC 15 (Visual Studio 2008), which can be seen when you open the Interpreter in a command window. Abaqus Python is compiled with MSVC 16 (Visual Studio 2010). All Python Modules, which needs compilation are not binary compatible.

So you have at least three possibilities:

  1. Find a SciPy Module, which is compiled for Python 2.7 with MSVC 16. Python 2.7 modules build with MSVC 16 are hard to find. Maybe you can't find a proper precompiled SciPy Version.Some Modules can be found for example here: http://p-nand-q.com/python/building-python-27-with-visual_studio.html

  2. Build SciPy (and some dependencies) from Source with MSVC 16. https://www.scipy.org/scipylib/building/windows.html

  3. Use Abaqus Python only to extract your data. Save the data to *.npy or *.npz Files and load the data in a standard Python Interpreter where you have easy access to precompiled Modules.

Upvotes: 2

Related Questions