k-wave-python icon indicating copy to clipboard operation
k-wave-python copied to clipboard

[BUG] Missing required dependencies on fresh install

Open arhowe00 opened this issue 1 year ago • 0 comments

Describe the bug Linker errors sometimes appear after a fresh install of k-wave-python

To Reproduce Steps to reproduce the behavior:

  1. Run pip install k-wave-python
  2. Call kspaceFirstOrder3D
  3. Encounter the following Traceback
dyld[54011]: Library not loaded: /opt/homebrew/opt/fftw/lib/libfftw3f.3.dylib
  Referenced from: <5B82F0C4-5B35-3AFA-A687-C07AC713836E> /Users/admin/projects/OpenLIFU-python/env/lib/python3.13/site-packages/kwave/bin/darwin/kspaceFirstOrder-OMP
  Reason: tried: '/opt/homebrew/opt/fftw/lib/libfftw3f.3.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/fftw/lib/libfftw3f.3.dylib' (no such file), '/opt/homebrew/opt/fftw/lib/libfftw3f.3.dylib' (no such file)

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
Cell In[5], line 1
----> 1 (ds, output) = openlifu.sim.run_simulation(arr=arr,
      2         params=params,
      3         delays=delays,
      4         apod= apod,
      5         freq = pulse.frequency,
      6         cycles = np.max([np.round(pulse.duration * pulse.frequency), 20]),
      7         dt=protocol.sim_setup.dt,
      8         t_end=protocol.sim_setup.t_end,
      9         amplitude = 1,
     10         gpu = False)

File ~/projects/OpenLIFU-python/src/openlifu/sim/kwave_if.py:105, in run_simulation(arr, params, delays, apod, freq, cycles, amplitude, dt, t_end, bli_tolerance, upsampling_rate, gpu)
     98 simulation_options = SimulationOptions(
     99                         pml_auto=True,
    100                         pml_inside=False,
    101                         save_to_disk=True,
    102                         data_cast='single'
    103                     )
    104 execution_options = SimulationExecutionOptions(is_gpu_simulation=gpu)
--> 105 output = kspaceFirstOrder3D(kgrid=kgrid,
    106                             source=source,
    107                             sensor=sensor,
    108                             medium=medium,
    109                             simulation_options=simulation_options,
    110                             execution_options=execution_options)
    111 logging.info('Simulation Complete')
    112 sz = list(params.coords.sizes.values())

File ~/projects/OpenLIFU-python/env/lib/python3.13/site-packages/kwave/kspaceFirstOrder3D.py:465, in kspaceFirstOrder3D(kgrid, source, sensor, medium, simulation_options, execution_options)
    463 executor = Executor(simulation_options=simulation_options, execution_options=execution_options)
    464 executor_options = execution_options.as_list(sensor=k_sim.sensor)
--> 465 sensor_data = executor.run_simulation(k_sim.options.input_filename, k_sim.options.output_filename, options=executor_options)
    466 return sensor_data

File ~/projects/OpenLIFU-python/env/lib/python3.13/site-packages/kwave/executor.py:52, in Executor.run_simulation(self, input_filename, output_filename, options)
     50         proc.wait()  # wait for process to finish before checking return code
     51         if proc.returncode != 0:
---> 52             raise subprocess.CalledProcessError(proc.returncode, command, stdout, stderr)
     54 except subprocess.CalledProcessError as e:
     55     # This ensures stdout is printed regardless of show_sim_logs value if an error occurs
     56     print(e.stdout)

CalledProcessError: Command '['/Users/admin/projects/OpenLIFU-python/env/lib/python3.13/site-packages/kwave/bin/darwin/kspaceFirstOrder-OMP', '-i', '/var/folders/rp/h6l6kz0s0klgvc1722vtkl7d2t0tct/T/04-Feb-2025-08-59-56_kwave_input.h5', '-o', '/var/folders/rp/h6l6kz0s0klgvc1722vtkl7d2t0tct/T/04-Feb-2025-08-59-56_kwave_output.h5', '-t', '14', '--p_max', '--p_min', '-s', '1']' died with <Signals.SIGABRT: 6>.

Expected behavior Following the k-wave-python install instructions should be sufficient to use the package.

Desktop (please complete the following information):

  • macOS Sequoia 15.1.1
/Users/admin % uname -a
Darwin mycomputer 24.1.0 Darwin Kernel Version 24.1.0: Thu Nov 14 18:15:21 PST 2024; root:xnu-11215.41.3~13/RELEASE_ARM64_T6041 arm64

Additional context We also encountered this issue in our CI for macOS in OpenLIFU-python#163. It appears that installing the four libraries via Homebrew allowed for the simulation to run (as installing fftw led to another linker error):

brew install hdf5 fftw zlib libomp

arhowe00 avatar Feb 04 '25 14:02 arhowe00