call TOUGH in jupyter notebook and PyTOUGH
Hi All,
I am using PyTOUGH to automate TOUGH simulation. However, when I try to call TOUGH in Jupyter notebook with this command
subprocess.call(["path_to_my_tough3_executable(tough3-eos1)", "horiz1D.dat"])
I got the error below
WindowsError: [Error 193] %1 is not a valid Win32 application
If I run the model from the Ubuntu terminal, it will run successfully. Does any one have any idea what is causing this error?
Thanks,
Haiyan
15 replies
-
The system clearly indicated that the executable you used is not a Window application. You mentioned that you can run it under Ubuntu terminal which means the executable is compiled under Linux system. You need recompiled it under Windows system.
-
Thanks for your reply Kenny. You are right that my TOUGH3 is compiled through Ubuntu which is installed in Windows system. I thought this would allow me to call it through Python.
-
In order to compile TOUGH under Windows system. Do I follow the instruction "readme_cygwin.pdf"?
Thanks,
Haiyan
-
You need to compile the code with Visual Studio or "make" command under DOS command line. you can find introduction in the readme file in V1.1.
-
Thanks Kenny.
I have one more question. There are "PC_executables' in the installation files. I am wondering what is the difference between these existing executables and the recompiles ones? I tried one of them and it ran well.
-
Should be the same. You can use them.
-
I tried the eos1 executable (tough3_v1.1/PC_executables/tough3_eos1_pc.exe) and it worked. However, 'tough3_eos7c_pc.exe' seems not working. The simulation stopped after reading the input file (please see attached OUTPUT). I tested the input file by running it with the Ubuntu compiled executable and it ran well. Any idea what is going wrong?
Thanks,
Haiyan
-
I did not look at your output file.
But I have a quick guess: you probably either used a wrong input file, or did not delete the MESHA, MESHB in your directory so you are using the wrong MESH. Check what files are in the directory and see if they are what you expect.
-
Hi Yingqi,
Thanks for your reply. I did remove all other files and only GENER, INFILE and INCON are included in the folder. The end of the OUTPUT file looks like below
------------------------------------------------------------------------------------------------
PER(1) = *** scale factor (optional) for internally generated permeability modifiers.
= 0: (defaults to PER(1) = 1): permeability modifiers are generated as random numbers in the interval (0, 1).
> 0: permeability modifiers are generated as random numbers in the interval (0, PER(1)).PER(2) = *** shift (optional) for internal or external permeability modifiers.
= 0: (default) no shift is applied to permeability modifiers.
> 0: permeability modifiers are shifted according to m' = m - PER(2). All m' < 0 are set equal to zero.
-
If you want to run TOUGH from Ubuntu Terminal within a Windows shell (e.g., cmd.exe), you can prepend "bash -c" to your Linux command, for instance:
bash -c '/path/to/tough3-install/bin/tough3-eos1 INFILE OUTPUT'
That command works with subprocess as well.
Note that the next update of toughio will include such function.
-
I replaced subprocess.run with subprocess.call (I am using Anaconda2). But still it doesn't work. I got output of '1' without detailed error message. Do I need Anaconda3 to run this?
Thanks,