Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stardist leads to kernel dies on MacOS Jupyter Notebook and aborted Python console #231

Open
azhu513 opened this issue May 22, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@azhu513
Copy link

azhu513 commented May 22, 2023

Describe the bug
Running StarDist2D.from_pretrained('2D_versatile_fluo') on my laptop caused kernel dies on Jupyter Notebook and aborted Python console

To reproduce

  from stardist.models import StarDist2D
  from csbdeep.utils import normalize
  from io import StringIO
  from filelock import FileLock

  assert dapi.ndim == 2

  with redirect_stdout(StringIO()): 
      with FileLock("stardist.lock"):
          _model = StarDist2D.from_pretrained('2D_versatile_fluo')
          
  labels, _=_model.predict_instances(normalize(dapi))

Error Message

In Jupyter Notebook

14:54:52.031 [error] Raw kernel process exited code: undefined
14:54:52.033 [error] Error in waiting for cell to complete Error: Canceled future for execute_request message before replies were done
    at t.KernelShellFutureHandler.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:2:32419)
    at ~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:2:51471
    at Map.forEach (<anonymous>)
    at v._clearKernelState (~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:2:51456)
    at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:2:44938)
    at ~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:24:105531
    at te (~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:2:1587099)
    at Zg.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:24:105507)
    at nv.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-darwin-x64/out/extension.node.js:24:112790)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
14:54:52.033 [warn] Cell completed with errors {
  message: 'Canceled future for execute_request message before replies were done'
}
14:54:52.034 [warn] Cancel all remaining cells due to cancellation or failure in execution

In Python console:

2023-05-22 14:38:34.379718: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
1/1 [==============================] - 1s 928ms/step
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/
[1]    51296 abort      python

Environment:

  • StarDist 0.8.3
  • CSBDeep 0.7.3
  • TensorFlow 2.12.0
  • OS: MacOS Monterey 12.6.3
  • GPU memory (if applicable): N/A

Attempted solutions that didn't work for me

  1. Set 'KMP_DUPLICATE_LIB_OK' to 'True' by
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
  1. Install nomkl
@azhu513 azhu513 added the bug Something isn't working label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant