CADET does not run with a specific version with CADET-Python on Linux

Expected behavior.

Simulation runs with no errors.

Actual behavior

Simulation failed and returned message:

CompletedProcess(args=[‘/home/zhangwx37/.conda/pkgs/cadet-5.0.0-hbe33008_0/bin/cadet-cli’, ‘8f7380c7-4926-4668-aa1e-59be173593e3.h5’], returncode=127, stdout=b’‘, stderr=b’/home/zhangwx37/.conda/pkgs/cadet-5.0.0-hbe33008_0/bin/cadet-cli: error while loading shared libraries: libhdf5.so.310: cannot open shared object file: No such file or directory\n’)

How to produce bug (including a minimal reproducible example)

System: Linux (Red Hat)
CADET: 5.0.0
CADET-Python: 0.14.1
Python: 3.12.8

Example code:

from cadet import Cadet
import numpy as np

Cadet.cadet_path = r"/home/zhangwx37/.conda/pkgs/cadet-5.0.0-hbe33008_0/bin/cadet-cli" 

 
## fixed params
n_sites = 2
n_x = 1
    
model = Cadet()
# number of unit operations
model.root.input.model.nunits = 3

#inlet model
model.root.input.model.unit_000.unit_type = 'INLET'
model.root.input.model.unit_000.ncomp = n_x
model.root.input.model.unit_000.inlet_type = 'PIECEWISE_CUBIC_POLY'

#time sections
model.root.input.solver.sections.nsec = 1
model.root.input.solver.sections.section_times = [0.0, 7500.0,]   # s
model.root.input.solver.sections.section_continuity = []

model.root.input.model.unit_000.sec_000.const_coeff = n_x*[0.0,] 
model.root.input.model.unit_000.sec_000.lin_coeff =   n_x*[0.0,]
model.root.input.model.unit_000.sec_000.quad_coeff =  n_x*[0.0,]
model.root.input.model.unit_000.sec_000.cube_coeff =  n_x*[0.0,]

model.root.input.model.unit_001.unit_type = 'GENERAL_RATE_MODEL'
model.root.input.model.unit_001.ncomp = 1

## Geometry
model.root.input.model.unit_001.col_length = 1.0                   # m              
model.root.input.model.unit_001.cross_section_area = 36/1e6         # m^2, length x area should be the reactor volume
model.root.input.model.unit_001.col_porosity = 0.33                  # 1      
model.root.input.model.unit_001.par_porosity = 0.97                  # 1      
model.root.input.model.unit_001.par_radius = 0.045/1e3             # m     

## Transport
model.root.input.model.unit_001.col_dispersion = 0.0               # m^2/s       
model.root.input.model.unit_001.film_diffusion = [1.48e-5, ]       # m/s,     1.35e-5, no film diffusion resistances
model.root.input.model.unit_001.par_diffusion =  [1e-12, ]          # m^2/s  
model.root.input.model.unit_001.par_surfdiffusion = n_sites * [0.0, ]      

model.root.input.model.unit_001.adsorption_model = 'MULTI_COMPONENT_BILANGMUIR'

model.root.input.model.unit_001.adsorption.is_kinetic = 1                                              
model.root.input.model.unit_001.adsorption.mcbl_ka = [2.0, 2.0]            ##  m^3 mobile phase / mol protein / s   ml/mg=m^3/kg    1 kda = 1 kg/mol
model.root.input.model.unit_001.adsorption.mcbl_kd = n_sites * [1.0, ]                                            ##  1/s
model.root.input.model.unit_001.adsorption.mcbl_qmax = [5.0, 5.0]                                        ##  mol protein / m^3 solid phase (not resin)

model.root.input.model.unit_001.init_c = [5/150, ]                                             ##  mg/ml=kg/m^3, kg/mol, mol/m^3
model.root.input.model.unit_001.init_q = n_sites * [0.0, ]

### Grid cells
model.root.input.model.unit_001.discretization.ncol = 1             ## make sure this is 1
model.root.input.model.unit_001.discretization.npar = 100

### Bound states
model.root.input.model.unit_001.discretization.nbound = [n_sites, ]

### Other options
model.root.input.model.unit_001.discretization.par_disc_type = 'EQUIDISTANT_PAR'    
model.root.input.model.unit_001.discretization.use_analytic_jacobian = 1
model.root.input.model.unit_001.discretization.reconstruction = 'WENO'
model.root.input.model.unit_001.discretization.gs_type = 1
model.root.input.model.unit_001.discretization.max_krylov = 0
model.root.input.model.unit_001.discretization.max_restarts = 10
model.root.input.model.unit_001.discretization.schur_safety = 1.0e-8

model.root.input.model.unit_001.discretization.weno.boundary_model = 0
model.root.input.model.unit_001.discretization.weno.weno_eps = 1e-10
model.root.input.model.unit_001.discretization.weno.weno_order = 2

## Outlet
model.root.input.model.unit_002.unit_type = 'OUTLET'
model.root.input.model.unit_002.ncomp = n_x

# Connections
Q = 0 # volumetric flow rate

model.root.input.model.connections.nswitches = 1
model.root.input.model.connections.switch_000.section = 0
model.root.input.model.connections.switch_000.connections = [
    0, 1, -1, -1, Q,
    1, 2, -1, -1, Q,
]  # Q, volumetric flow rate 

# numerical solver configuration
model.root.input.model.solver.gs_type = 1
model.root.input.model.solver.max_krylov = 0
model.root.input.model.solver.max_restarts = 10
model.root.input.model.solver.schur_safety = 1e-8

# Number of cores for parallel simulation
model.root.input.solver.nthreads = 1

# Tolerances for the time integrator
model.root.input.solver.time_integrator.abstol = 1e-5
model.root.input.solver.time_integrator.algtol = 1e-8
model.root.input.solver.time_integrator.reltol = 1e-5
model.root.input.solver.time_integrator.init_step_size = 1e-18
model.root.input.solver.time_integrator.max_steps = 1000000

# Return data
model.root.input['return'].split_components_data = 0
model.root.input['return'].split_ports_data = 0
model.root.input['return'].unit_000.write_solution_bulk = 0
model.root.input['return'].unit_000.write_solution_inlet = 0
model.root.input['return'].unit_000.write_solution_outlet = 1
model.root.input['return'].unit_000.write_sens_outlet=0
model.root.input['return'].unit_000.write_sens_bulk=0

# Copy settings to the other unit operations
model.root.input['return'].unit_001 = model.root.input['return'].unit_000
model.root.input['return'].unit_002 = model.root.input['return'].unit_000

# Solution times
model.root.input.solver.user_solution_times = np.linspace(0, 7250.0, 100)

model.filename = 'test.h5'
model.save()
data = model.run()
model.load() 
print(data)

tl = model.root.input.solver.user_solution_times
cl = model.root.output.solution.unit_001.solution_outlet*150

File produced by conda env export > environment.yml

environment.yml (7.93 KB)

Hi Flynn,

thanks for reporting the issue. Unfortunately, I cannot reproduce the issue, but I have a couple of questions / ideas:

  • Is the cadet_path in the same conda environment as you’re running the code from?
  • If so, it’s actually no longer required to set the install path if you use the “standard” installation; it should be autodetected.
  • Update CADET-Core to v5.0.3
  • Setup a new (clean) environment and try again.

Let us know if this helped.

3 Likes

Hi Johannes, thanks for your reply! Is there a method we can call in CADET for older versions like above to find the cadet_path from standard installation?

You can specify the path to a separate version just the way you did it. However, if this is in another conda environment, there might be issues with dependencies. Maybe in your case, the cadet-cli was dynamically linked against a specific version of HDF5 which is then not used in the environment you’re currently on.

Just out of curiosity, why don’t you update to the latest CADET-Core version?

Hello Jo, I think this is not about CADET but rather CADET-Python.

  1. I updated CADET to 5.0.3. If I don’t specify the path to cadet_cli, it gives an error:
    image

  2. If I specify the following path: "/home/zhangwx37/.conda/pkgs/cadet-5.0.3-hbe33008_0/bin/cadet-cli" , it gives the same error:
    image

However, I did realize I was specifying the wrong path… Inside the .conda/ folder there are two folders, one is pkgs and the other is env. I can find cadet_cli in both of them. However, only the one in env works. Anyway, problem solved.

Another quick question, for newer versions, I still define cadet_path to specify customized cadet_cli? Would this cause any problems regarding dynamic links?