PySDF error in Modulus 22.03


I am trying a bare metal installation of Modulus 22.03. The operating system used is Ubuntu 20.04 LTS.

The Modulus and the PySDF library installations completed without error and “examples/ldc/” was successfully executed. However, the following error occurred when executing “examples/aneurysm/”.

junichi@GLM:~/Modulus/examples/v22.03/examples/aneurysm$ python3
Error importing pysdf. Make sure ‘’ is in LD_LIBRARY_PATH and pysdf is installed
Traceback (most recent call last):
File “”, line 25, in
from modulus.geometry.tessellation.tessellation import Tessellation
File “/home/junichi/.local/lib/python3.8/site-packages/modulus-22.3-py3.8.egg/modulus/geometry/tessellation/”, line 11, in
import pysdf.sdf as pysdf
ImportError: cannot open shared object file: No such file or directory

The above error was avoided by modifying line 11 in “Modulus/modulus/geometry/tessellation/” as follows.

  • Before modification

import pysdf.sdf as pysdf

  • After modification

import pysdf as pysdf

However, when “” was run again, the following error occurred

junichi@GLM:~/Modulus/examples/v22.03/examples/aneurysm$ python3
max_steps: 1500000
grad_agg_freq: 1
rec_results_freq: 10000
rec_validation_freq: ${training.rec_results_freq}
rec_inference_freq: ${training.rec_results_freq}
rec_monitor_freq: ${training.rec_results_freq}
rec_constraint_freq: 50000
save_network_freq: 1000
print_stats_freq: 100
summary_freq: 1000
amp: false
amp_dtype: float16
use_ntk: false
save_name: null
run_freq: 1000
profile: false
start_step: 0
end_step: 100
name: nvtx
network_dir: .
initialization_network_dir: ‘’
save_filetypes: vtk
summary_histograms: false
jit: false
device: ‘’
debug: false
run_mode: train
target: modulus.architecture.fully_connected.FullyConnectedArch
layer_size: 512
nr_layers: 6
skip_connections: false
adaptive_activations: false
weight_norm: true
target: modulus.aggregator.Sum
weights: null
compute_gradients: adam_compute_gradients
apply_gradients: adam_apply_gradients
target: torch.optim.Adam
lr: 0.001
- 0.9
- 0.999
eps: 1.0e-08
weight_decay: 0.0
amsgrad: false
target: custom
name: tf.ExponentialLR
decay_rate: 0.95
decay_steps: 15000
inlet: 1100
outlet: 650
no_slip: 5200
interior: 6000
integral_continuity: 310
custom: ???

Error executing job with overrides: [ ]
Traceback (most recent call last):
File “”, line 153, in run
interior = PointwiseInteriorConstraint(
File “/home/junichi/.local/lib/python3.8/site-packages/modulus-22.3-py3.8.egg/modulus/continuous/constraints/”, line 399, in __init__
invar = geometry.sample_interior(
File “/home/junichi/.local/lib/python3.8/site-packages/modulus-22.3-py3.8.egg/modulus/geometry/tessellation/”, line 375, in sample_interior
sdf_field, sdf_derivative = self.sdf(sampled_points)
File “/home/junichi/.local/lib/python3.8/site-packages/modulus-22.3-py3.8.egg/modulus/geometry/tessellation/”, line 64, in _sdf
sdf_field, sdf_derivative = pysdf.signed_distance_field(
AttributeError: module ‘pysdf’ has no attribute ‘signed_distance_field’

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

I would appreciate it if you could advise me how to resolve this error.

Best regards,
Junichi Fukui

I faced the same issue. I used the pysdf from the older version with the older steps. It works fine.

Thank you for your advice! I will try to run the tutorial with the older version of pysdf library.

Hello, unfortunately we decided to pull the pysdf support for the bare metal installation because it became too cumbersome to maintain. This is reflected in the installation instructions. If the tessellated geometry module is required then we suggest using the Docker image. We are pushing now to have pysdf released as a separate library but don’t have any release date for this. In the mean time we are looking into a slower fallback option when pysdf is not installed.

Hi I managed to install pysdf in the bare metal installation using the provided egg file via easy_install. Here are the steps

  1. downgrade setuptools (pip3 install setuptools==42.0.0) since easy_install command is not exposed in the latest setuptools versions. see ref.

  2. install the provided egg file

cd path_to_modulus_source_code/modulus/external/eggs
python3 -m easy_install pysdf-0.1-py3.8-linux-x86_64.egg

  1. you can make sure the installation is successful by checking pip3 list. You can also upgrade setuptools back to the latest version.

  2. add to your LD_LIBRARY_PATH

then you can successfully run without changing the source code.

1 Like

Hi, I’m now using 22.09 and using bare metal installation. I tried the mtd by zhongyf111.

Step 1 is ok but step 2 is not cos the egg file is not found. I went to take the 22.03 version and run the command.

The lib file is @ /opt/conda/lib/python3.8/site-packages/pysdf-0.1-py3.8-linux-x86_64.egg/pysdf/

I also copied from 22.03 and put it in the same dir and the dir to the LD_LIBRARY_PATH. However, it’s still not working:

root@eb8245cc19b8:/examples_2209/aneurysm# python
Error importing pysdf. Make sure '' is in LD_LIBRARY_PATH and pysdf is installed
Traceback (most recent call last):
  File "", line 20, in <module>
    from modulus.geometry.tessellation import Tessellation
  File "/opt/conda/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/", line 11, in <module>
    import pysdf.sdf as pysdf
ImportError: /opt/conda/lib/python3.8/site-packages/pysdf-0.1-py3.8-linux-x86_64.egg/pysdf/ undefined symbol: testPrint

Hope someone can help.


Hi zhongyf111,

I realised that there’s some errors with my mtd. Now I did it this way:
As I do not have root, I have to install using:

python3 -m easy_install --prefix=/home/svu/tsltaywb/.local pysdf-0.1-py3.8-linux-x86_64.egg

I copied the into a dir and add it to LD_LIBRARY_PATH.

Now the error msg I got is:

tsltaywb@volta01:~/hpctmp_tsltaywb/modulus/examples_2209/aneurysm$ python
[21:08:15] - JitManager: {‘_enabled’: False, ‘_arch_mode’: <JitArchMode.ONLY_ACTIVATION: 1>, ‘_use_nvfuser’: True, ‘_autograd_nodes’: False}
[21:08:15] - GraphManager: {‘_func_arch’: False, ‘_debug’: False, ‘_func_arch_allow_partial_hessian’: True}
/home/svu/tsltaywb/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/ RuntimeWarning: divide by zero encountered in divide
np.full(x.shape, triangle_areas[index] / x.shape[0])
terminate called after throwing an instance of ‘std::runtime_error’
what(): the provided PTX was compiled with an unsupported toolchain.
Aborted (core dumped)

Anyone can help? Btw, I’m running in a cluster.

what does “pysdf from the older version” means? can you give an link to this old version? thank you so much