问题描述:
问题是在terminal中运行:python -c "import mindspore;mindspore.set_device('Ascend');mindspore.run_check()" 就没问题,正常输出
但是在jupyter notebook中就报错,如下:
RuntimeError: Unsupported device target Ascend. This process only supports one of the ['CPU']. Please check whether the Ascend environment is installed and configured correctly, and check whether current mindspore wheel package was built with "-e Ascend". For details, please refer to "Device load error message".
Load dynamic library: libmindspore_ascend.so.2 failed. libge_runner.so: cannot open shared object file: No such file or directory
解决方法:
应该是jupyter 中缺少昇腾cann的那些环境变啦你给,这和jupyter的安装启动方式有关;
如果你在可以加载昇腾的终端里用pip方式安装了jupyter lab,然后用命令jupyter lab --no-browser --ip=0.0.0.0 --port=8080 --notebook-dir=/ --allow-root 这样启动,应该是没问题的;
但如果不是在你能加载昇腾的终端环境里直接安装的,或者其它方式启动了,或者额外单独配置了jupyter的环境变量,就可能加载不了昇腾,主要原因是,由于启动或者配置的不同,jupyter环境没有加载到昇腾cann那些环境变量,就无法搜索到cann的一些so文件,然后就会这样。