How to revise plot_dispwarp.py to plot in ParaView installed in Windows system?

Hi, for some reason, I have to use VirtualBox to run Pylith in my computer. However, there is not too much storage for my VirtualBox, so I installed Paraview in my Windows system. But as a new programmer, I don’t know how to revise the plot_dispwarp.py file to let my Paraview read all of the files that it needs to compile the program into a virtual plot. Below is the error info when I run python shell in Paraview.

Traceback (most recent call last):
File “”, line 152, in
File “”, line 56, in visualize
OSError: File ‘output\step01_axialdisp-domain.xmf’ does not exist.

By the way, I have tried to copy output folder and plot_dispwarp.py to Windows system and revise the path lines in the plot_dispwarp.py to plot but I failed.

I guess I need to revise somewhere of plot_dispwarp.py file to make it plot but I don’t know how. Thanks for help!

For Windows, we recommend using the Windows Subsystem for Linux rather than a virtual box. This makes it easier to access files generated within Linux from Windows and vice versa.

Regardless of your operating system, if you launch ParaView from a directory other than where you ran PyLith (for example, examples/box-2d), then you need to set OUTPUT_DIR in the ParaView Python shell to the absolute path to where the .h5 and .xmf files are located before running the Python script. For example, if the output files are in (using Linux directory structure) $HOME/src/cig/pylith/examples/box-2d/output, then in the ParaView Python Shell:

import os
OUTPUT_DIR = os.path.join(os.environ["HOME"], "src", "cig", "pylith", "examples", "box-2d", "output")

This is documented at the top of the Python script, but I will add it to the manual.

Thanks for your answer. That’s the exactly the part where i think I should change the code. But could you please show me how to use Windows directory structure to change the command lines of absolute path. My output folder is saved in this path:
C:\Users\HeLingChao\Downloads\output

import os
OUTPUT_DIR = os.path.abspath(os.path.join("Users","HeLingChao","Downloads", "output"))

Using os.path.abspath() should add the drive letter on Windows.

Thanks for help. I tried this code but ParaView still shows:
Traceback (most recent call last):
File “”, line 151, in
File “”, line 55, in visualize
OSError: File ‘output\step01_axialdisp-domain.xmf’ does not exist.

There is no need to edit the plot_dispwarp.py script. In this case, you edited the comment, so it has no effect. You need to set OUTPUT_DIR in the ParaView Python Shell (see screenshot below) before clicking on the Run Script button.

It is fixed! Thanks for your patience!

Hi, I already set the absolute path in the paraview shell in term of above, but when run the file(.py) occur the below prolem, why?

Please provide more information about what commands you are running.

I am confused by your explanation, because mesh_tri.exo is never used in plot_dispwarp.py. What script are you running? What are you trying to visualize?

I followed the pylith4.0.0‘s video tutorial and after entering the above code, when I run the script plot_dispwarp.py in paraview, it prompts the above error, while there is no error inside the video tutorial, why?

I am assuming you started ParaView from a shortcut or application icon, then you need to set the OUTPUT_DIR variable. Assuming the absolute path the PyLith installation directory is is “\programfile\pylith”, you would do the following:

import os
OUTPUT_DIR = os.path.join("programfile", "pylith", "examples", "reverse-2d", "output")
SIM = "step08_onefault"
FIELD_COMPONENT = "X"

Then click on the Run Script button, and navigate to the plot_dispwarp.py script in examples/reverse-2d/viz.

If you installed PyLith to a different directory, then you will need to update the OUTPUT_DIR line. Note that it points to the output directory where the simulation output was written.

Thank you. The Problem has been solved through your guide.

Hello, I encounter the problem when I run the step01_gravity.cfg file, the problem is “nemesis: error while loading shared libraries: libmpi.so.12: cannot open shared object file: No such file or directory

. I find the answer

These errors indicate something is incorrect with your environment or how you are running PyLith. These are difficult issues to debug without knowing much more information about how your computer is setup, how you installed PyLith, and what commands you are running. Here are some things you can do to help us debug the problem. Please show what you entered into the terminal and all of the output.

  1. What operating system are you using? If Windows, are you using the Windows Subsystem for Linux?
  2. What shell are you using? Usually, you can run echo $SHELL to display the shell.
  3. How did you install PyLith? If using a binary, which one did you download and where did you unpack it?
  4. What is the output of echo $PATH?
  5. What is the output of echo $LD_LIBRARY_PATH?
  6. What is the output of which nemesis?
  7. What is the output of ldd $(which nemesis)?
  8. What is the output of ldd $(which mpinemesis)?
  9. What is the output of pylith --version?
  1. What operating system are you using? If Windows, are you using the Windows Subsystem for Linux?
    Answer: my operating system is Windows. Yes, it’s the Windows Subsystem for Linux
  2. What shell are you using? Usually, you can run echo $SHELL to display the shell.
    1
  3. How did you install PyLith? If using a binary, which one did you download and where did you unpack it?
    Answer: I installed the ‘pylith-4.0.0’, and unpack in the D:\pylith\
  4. What is the output of echo $PATH?
  5. What is the output of echo $LD_LIBRARY_PATH?
  6. What is the output of which nemesis?
    /mnt/d/pylith/pylith-4.0.0-linux-x86_64/bin/nemesis
  7. What is the output of ldd $(which nemesis)?
  8. What is the output of ldd $(which mpinemesis)?
  9. What is the output of pylith --version?

Thank you very much. I reunpacked and reinstalled, it’s fixed, thank you for your patience.