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

Encounter ImportError When Runing Code in Jupyter: libmindspore_backend.so: undefined symbol: dnnl_threadpool_interop_stream_create #325

Open
641217688tly opened this issue Jan 8, 2025 · 0 comments

Comments

@641217688tly
Copy link

Environment

Hardware Environment(Ascend/GPU/CPU): CPU

Software Environment:

  • MindSpore version (source or binary): 2.4.0
  • Python version (e.g., Python 3.7.5): 3.9.19
  • OS platform and distribution (e.g., Linux Ubuntu 16.04): Linux(WSL2) x86_64 Ubuntu 22.04.5
  • GCC/Compiler version (if compiled from source): gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Describe the current behavior

import mindspore as ms
import numpy as np
output = ms.Tensor(np.array([[1.5, 2.3, 0.7], [1.8, 0.5, 2.2]]), ms.float32)
target = ms.Tensor(np.array([1, 2]), ms.int32)
loss_var = ms.ops.cross_entropy(output, target)
print(loss_var)

When i write the above code in a .ipynb file and run it with jupyter, it throws a ImportError:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[6], line 1
----> 1 import mindspore as ms
      2 import numpy as np
      3 output = ms.Tensor(np.array([[1.5, 2.3, 0.7], [1.8, 0.5, 2.2]]), ms.float32)

File ~/Applications/Programming/Python/Anaconda3/envs/DlibFuzz/lib/python3.9/site-packages/mindspore/__init__.py:18
     15 """.. MindSpore package."""
     16 from __future__ import absolute_import
---> 18 from mindspore.run_check import run_check
     19 from mindspore import common, dataset, mindrecord, train, log, amp
     20 from mindspore import profiler, communication, numpy, parallel, hal

File ~/Applications/Programming/Python/Anaconda3/envs/DlibFuzz/lib/python3.9/site-packages/mindspore/run_check/__init__.py:17
      1 # Copyright 2021 Huawei Technologies Co., Ltd
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     13 # limitations under the License.
     14 # ============================================================================
     15 """.. run_check package."""
---> 17 from ._check_version import check_version_and_env_config
     18 from .run_check import run_check
     20 __all__ = ['run_check']

File ~/Applications/Programming/Python/Anaconda3/envs/DlibFuzz/lib/python3.9/site-packages/mindspore/run_check/_check_version.py:28
     26 import numpy as np
     27 from mindspore import log as logger
---> 28 from mindspore._c_expression import MSContext, ms_ctx_param
     29 from ..version import __version__
     32 class EnvChecker(metaclass=ABCMeta):

ImportError: /home/tly/Applications/Programming/Python/Anaconda3/envs/DlibFuzz/lib/python3.9/site-packages/mindspore/lib/libmindspore_backend.so: undefined symbol: dnnl_threadpool_interop_stream_create

However, When i write the code in a python file and run it with interpreter, it work correctly:

/home/user/Applications/Programming/Python/Anaconda3/bin/conda run -n DlibFuzz --no-capture-output python /mnt/e/1University/Research/DlibFuzz/Code/DlibFuzz/test.py 
0.5591624

进程已结束,退出代码为 0

Describe the expected behavior

/home/user/Applications/Programming/Python/Anaconda3/bin/conda run -n DlibFuzz --no-capture-output python /mnt/e/1University/Research/DlibFuzz/Code/DlibFuzz/test.py 
0.5591624

进程已结束,退出代码为 0

Steps to reproduce the issue

  1. Write the code in a .ipynb file
  2. Run jupyter server and code cell
  3. Encounter error

Related log / screenshot

Running .ipynb File:
image
Running .py File:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant