View Full Version : Using numpy or scipy within abaqus python
hi,
Anyone know if it's possible to use the numpy or scipy modules when running abaqus python scripts?
Thanks,
Cormac
Hi Cormac,
Good to hear from you again!
I don't think they are included with with the default Abaqus installation, and I have not heard anyone use those libraries with Abaqus python.
However, I don't see any particular reason why you could not dump the whole set of library files into the Abaqus python source tree (or perhaps set some env variable).
I would enjoy a solution to this problem as well, so let us know if you figure it out !
-Jorgen
Success. My procedure was as follows:
1. Install Python 2.4.3 (or the same version as your Abaqus runs)
2. Install the appropriate versions of numpy and scipy compatible with Python 2.4.3
3. Create a Custom\Python24\Lib\site-packages directory in your root Abaqus directory. e.g c:\abaqus\custom\Python24\Lib\site-packages
4. Copy the numpy and scipy directories in c:\Python24\Lib\site-packages to c:\abaqus\custom\Python24\Lib\site-packages
As a side note, make sure your import numpy, scipy, scipy.io line appears before the "from odbAccess import *" line in your script file.
An alternative procedure is to do Steps 1 and 2 above and then add a line "PYTHONPATH=c:\Python24\Lib\site-packages" to the abaqus environment file. however, this didn't work for me.
Regards,
Cormac
maheshiaf
2010-03-16, 13:22
Hi Cormac,
I'm using apython script to read data from a MATLAB data file to generate the part in ABAQUS CAE. I'm using the numpy module to sort the MATLAB output so that ABAQUS CAE can interpret it. Since I'm using numpy module I cannot use the Abaqus Python. I have therefore downloaded the Python 2.4 version from python.org as mentioned in your thread. However I cannot find the numpy module compatible with Python version 2.4. The latest version available from sourceforge.net is numpy 1.3.0 which is compatible with Python 2.6. Can you kindly advise me on downloading the numpy module compatible with Python 2.4?
And did u copy the entire numpy folder from c:\Python24\Lib\site-packages to c:\abaqus\custom\Python24\Lib\site-packages? In that case when you run a python script written in version 2.4 how does ABAQUS link to numpy? did you use a path.append command like
from sys import path
path.append('c:\abaqus\custom\Python24\Lib\site-packages')
Thanks in advance.
Mahesh Bailakanavar
Hi Mahesh,
You can download numPy 1.2.0 at http://sourceforge.net/projects/numpy/files/. Just look under All files/NumPy/1.2.0.
Yes, I copied the entire numpy folder as you said. I didn't use any path.append command. I don't know off-hand how abaqus links to numpy.
Hope that helps.
Cormac
maheshiaf
2010-03-30, 11:10
Hi Cormac,
Thanks for your response. I have resolved the problem. I downloaded numpy version 1.0.1 compatible with Python 2.4 on my Windows machine. The numpy by default got installed in C:\Python24\Lib\site-packages\ directory. Then I added the follwing path in my Python script.
from sys import path
path.append('C:\Python24\Lib\site-packages')
Then I executed my Python script from ABAQUS CAE and it worked.
The reason it was not woring before was that I had installed Python 2.6 and numpy 1.3.0. The Python and numpy need to be compatible with ABAQUS Python. I'm using ABAQUS 6.8-3 version that has Pyhton 2.4. So I installed Python 2.4 and numpy 1.0.1.
Regards
Mahesh
I don't think your step 1 and 2 are necessary, you only need those files. you can get them by unzipping the installation package (.exe file).
Success. My procedure was as follows:
1. Install Python 2.4.3 (or the same version as your Abaqus runs)
2. Install the appropriate versions of numpy and scipy compatible with Python 2.4.3
3. Create a Custom\Python24\Lib\site-packages directory in your root Abaqus directory. e.g c:\abaqus\custom\Python24\Lib\site-packages
4. Copy the numpy and scipy directories in c:\Python24\Lib\site-packages to c:\abaqus\custom\Python24\Lib\site-packages
As a side note, make sure your import numpy, scipy, scipy.io line appears before the "from odbAccess import *" line in your script file.
An alternative procedure is to do Steps 1 and 2 above and then add a line "PYTHONPATH=c:\Python24\Lib\site-packages" to the abaqus environment file. however, this didn't work for me.
Regards,
Cormac
Hi,
I have exactly the same problem, but it still doesn't work :-(
I am using Abaqus 6.9-2 on Windows 7(64 bits), and I have tried to install Numpy 1.2.0 (with Python 2.4). I have the error message :
"....
ImportError: DLL load failed with error code 193"
I installed the numpy module, and I copied it on C:\SIMULIA\Abaqus\6.9-2\Python\Lib, but it doesn't work. I tried also with this directory (that I have created) C:\SIMULIA\Abaqus\custom\Python24\Lib\site-packages but it doesn't work again!
Thank you for your help,
Clo
Powered by vBulletin® Version 4.1.11 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.