ebecht / infinityFlow

26 stars 8 forks source link

Running NN: Error #15: Initializing libomp.dylib, but found libomp.dylib already initialized. #21

Closed denvercal1234GitHub closed 1 year ago

denvercal1234GitHub commented 1 year ago

Hi there,

Thanks for the tool.

Every thing was okay, but today, when I ran the code again, it threw me the errors below.

Have you encountered these before?

Thank you for your help!

Fitting regression models
    Randomly selecting 50% of the subsetted input files to fit models
    Fitting...
        XGBoost

  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=23s  
    23.47539 seconds
        NN

  |                                                  | 0 % ~calculating  OMP: Error #15: Initializing libomp.dylib, but found libomp.dylib already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://openmp.llvm.org/

I tried to delete the /Users/clusteredatom/miniforge3/envs/tensorflowc/lib/libomp.dylib as suggested here (https://github.com/dmlc/xgboost/issues/1715), but then, it caused another error Error in checkForRemoteErrors(val) : 7 nodes produced errors; first error: The h5py Python package is required to save and load models

At the beginning, I activate a conda environment first, then in RStudio, I ran:

library(reticulate)
library(keras)
library(tensorflow)

reticulate::use_python("/Users/clusteredatom/miniforge3/envs/tensorflowc/bin/python3.10")
reticulate::use_condaenv("/Users/clusteredatom/miniforge3/envs/tensorflowc")

#reticulate::use_virtualenv("/Users/clusteredatom/miniforge3/envs/tensorflowc")

reticulate::py_config()

The output is below, so I am not sure why it cannot find the h5py module. Is it because h5py is not installed for every node? But I am running it on my local macbook m1.

python:         /Users/clusteredatom/miniforge3/envs/tensorflowc/bin/python3.10
libpython:      /Users/clusteredatom/miniforge3/envs/tensorflowc/lib/libpython3.10.dylib
pythonhome:     /Users/clusteredatom/miniforge3/envs/tensorflowc:/Users/clusteredatom/miniforge3/envs/tensorflowc
version:        3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:12:31) [Clang 14.0.6 ]
numpy:          /Users/clusteredatom/miniforge3/envs/tensorflowc/lib/python3.10/site-packages/numpy
numpy_version:  1.23.2
tensorflow:     /Users/clusteredatom/miniforge3/envs/tensorflowc/lib/python3.10/site-packages/tensorflow

NOTE: Python version was forced by RETICULATE_PYTHON
denvercal1234GitHub commented 1 year ago

Solved by resetting the laptop -- Not ideal but it worked.