How i can ues ogs.exe. How can i supply the path to a project file as an argument to the OGS executable

how i can ues ogs.exe. How can i supply the path to a project file as an argument to the OGS executable

Hi and welcome to this community!

Check-out the documentation at: https://www.opengeosys.org/docs/userguide/basics/introduction/#running

I hope that helps.
Lars

Hi Bilke,
Running your master tests as shown in the basics introduction #running, produces a Fatal Python error initfsencoding: unable to load the file system codec. Do you have examples of putting the executable on path? I have done so without effect in command line.

Dear Nicholas,

either you download the OGS version without the Python bindings or install Python on your system.

Hi Bilke,

I have the same error. I have Python 3.9.7 on my Windows. I follow the video tutorial: Solving. When I try “ogs -l debug OGSinput_basin.prj”, it shows:

info: This is OpenGeoSys-6 version 6.4.1-7-g91e80ece2a0.
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = ‘python’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘O:\OGS\artifacts_CLI\build\release\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\bin\ogs.exe’
sys.base_prefix = ‘’
sys.base_exec_prefix = ‘’
sys.executable = ‘O:\OGS\artifacts_CLI\build\release\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\bin\ogs.exe’
sys.prefix = ‘’
sys.exec_prefix = ‘’
sys.path = [
‘O:\OGS\artifacts_CLI\build\release\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\bin\python38.zip’,
‘.\DLLs’,
‘.\lib’,
‘O:\OGS\artifacts_CLI\build\release\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\ogs-6.4.1-7-g91e80ece2a0-Windows-10.0.19043-python-3.8.2-utils\bin’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’

Current thread 0x000027b0 (most recent call first):

You need to install Python 3.7.2 when using the prebuilt binaries downloaded from the website.

Hi Bike,

Thanks very much for help.

I uninstall 3.9 and install 3.7.2, but it still shows the same error.

BTY, are there any tutorials for C or C++?

Thanks

Hi NicholasFry,

Did you solve the problem of Fatal Python Error by simply downloading OGS without Python bindings or installing Python?

Thanks

Sorry Wen,

I made a mistake: for your particular OGS download you need Python 3.8.2. You can see the required version in the download file name. I will try to unify the required Python version for future downloads.

I gave up and downloaded without bindings. I was not sure what to do. With @bilke’s new information, I will revisit OGS6 soon.

It works! Thanks Bilke.

You should try, it works.

When I ran the ogs without bindings, it still showed the same error. This is why I download the version with bindings.

Yeah, I also have OGS6 running for the first time. It is pretty straightforward but the instructions could use a little clarity, in my opinion. Which build needs Python 3.8? I downloaded the current release and the read me still calls for 3.7.2

can you upload the text in your command prompt here?

I am not sure what you mean. I did not report an error here. I am asking, which build of ogs requires Python 3.8?

Sorry for the confusion. We have two Windows build machines, one has an older Python (3.7) than the other (3.8). I will try to update the older Python. The latest release should use 3.7. If you download newer (continous builds) you can see on the zip-file name which Python is required.

Hello Bilke,

I use the WSL on my Windows system. Then I downloaded the source code of OGS-6.4.1 version at https://gitlab.opengeosys.org/ogs/ogs/-/jobs/125821/artifacts/browse/build/release

Using the WSL, I go to the location of the source code:
cd /ogs6/bin
Then input:
ogs

However, I got this warning:
Command 'ogs' not found, did you mean:
command 'vgs' from deb lvm2 (2.03.07-1ubuntu1)
command 'ots' from deb libots0 (0.5.0-3)
command 'ols' from deb speech-tools (1:2.5.0-8build1)
command 'gs' from deb ghostscript (9.50~dfsg-5ubuntu4.4)
command 'obs' from deb obs-studio (25.0.3+dfsg1-2)
command 'ocs' from deb cscope (15.9-1)
Try: sudo apt install <deb name>

Can you please give me some hints?

Best regards,
Luyu

Hello Luyu,
As for as I know there is no prebuilt version of OGS-6.4.1 for Linux (you said you are using WSL and I assume you know it is essentially a Linux operating system running on top of Window).
So, you first need to build it from the source code, which is really easy. Just follow these steps (from Set Up Prerequisites to Build ). Then go to the bin folder of the OGS build directory and execute the OGS command.

./ogs /path/to/input/file/file.prj

If you are not familiar with Linux then try downloading prebuilt OGS code in the window and run the command in the window command prompt.

ogs /path/to/input/file/file.prj

I hope that helps,
Laxman Kafle

Hello,
Thanks for the information.
I have questions after I tested two cases.

(1) The first case is downloaded from https://gitlab.opengeosys.org/ogs/ogs/-/tree/master/Tests/Data/Elliptic. Let’s say the test name is ‘circle_radius_1’. I input ogs /the/path/to/circle_radius_1.prj, it works successfully.

(2) However, the second test, I followed the video tutorial on https://www.opengeosys.org/docs/tools/getting-started/video-tutorial/. I prepared all the required files, such as mesh_basin.py, msh2vtu.py, OGSinput_basin, etc… I input the command ogs /the/path/to/OGSinput_basin.prj. It was an error. I tried python 3.7, 3.8. 3.9, it was failed to work.
The error information is shown as follows:

info: This is OpenGeoSys-6 version 6.4.1.
info: OGS started on 2021-12-12 11:56:39+0100.
critical: E:/gitlab/builds/XBgsxgtH/0/ogs/ogs/Applications/ApplicationsLib/ProjectData.cpp:313 ProjectData::ProjectData()
error: OpenGeoSys has not been built with Python support.
info: OGS terminated on 2021-12-12 11:56:39+0100.
error: OGS terminated with error.

(3) Alternatively I also tried the python binding version, it had an error for both the above mentioned first and second tests:

info: This is OpenGeoSys-6 version 6.4.1-0-g80f50c45bf3.
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = ‘python’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘C:\Disk_D\Simluator\OpenGeoSys\ogs-6.4.1-python-3.8.2-utils\bin\ogs.exe’
sys.base_prefix = ‘’
sys.base_exec_prefix = ‘’
sys.executable = ‘C:\Disk_D\Simluator\OpenGeoSys\ogs-6.4.1-python-3.8.2-utils\bin\ogs.exe’
sys.prefix = ‘’
sys.exec_prefix = ‘’
sys.path = [
‘C:\Disk_D\Simluator\OpenGeoSys\ogs-6.4.1-python-3.8.2-utils\bin\python38.zip’,
‘C:\Disk_D\software_academic\Anaconda Navigator\Lib’,
‘C:\Disk_D\software_academic\Anaconda Navigator\DLLs’,
‘C:\Disk_D\Simluator\OpenGeoSys\ogs-6.4.1-python-3.8.2-utils\bin’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’

In conclusion, the questions are:
(1) Using the same way to launch OGS-6, the first test was success, while the second test was failed. I do not know why.
(2) Why the first test works successfully using the “without python binding version”, while it was failed using the “python binding version”?

Can you please give me some hints?
Thanks.
Luyu

Hello Luyu,
This error is related to python installation on your computer. Try installing python and try again. The first case was successful because it does not require python but the second with python binding needs python installation.

Best,
Laxman Kafle