FAQs About MindSpore Installation (2)
FAQs About MindSpore Installation (2)
4. Docker Installation
Q1: Does MindSpore support PCs with NVIDIA discrete GPU + Windows OS?
A1: Currently, MindSpore supports the combination of GPU+Linux and CPU+Windows. The support for Windows+GPU is still under development. If you want to run in the GPU+Windows environment, you can use the WSL+docker method as follows:
1. Install Ubuntu 18.04 in WSL. For details, see Install Linux on Windows with WSL.
2. Install the NVIDIA driver that supports WSL and deploy the environment where runs the container. For details, see CUDA on WSL User Guide.
Note: CUDA on WSL is for preview only. If the Windows version is incorrect, upgrade it.
3. Pull the MindSpore-GPU image by referring to Docker Image. For example, if the MindSpore 1.0.0 container is to be pulled, run the docker pull mindspore/mindspore-gpu:1.0.0 command in Ubuntu 18.04 to run the container:
docker run -it --runtime=nvidia mindspore/mindspore-gpu:1.0.0 /bin/bash
5. Uninstallation
Q1: How do I uninstall MindSpore?
A1: Check the full name of the installed MindSpore. For example, to uninstall MindSpore GPU, you can run the pip uninstall mindspore-gpu command.
6. Environment Variables
Q1: Some common environment variables need to be reset in the newly started terminal window. What do I do if I forget them?
A1: Write common environment variable settings to ~/.bash_profile or ~/.bashrc so that the settings take effect immediately in the new terminal window.
Q2: How do I set the DEVICE_ID environment variable when using MindSpore GPU?
A2: In MindSpore GPU, you do not need to set the DEVICE_ID environment variable. MindSpore GPU automatically selects a visible GPU device based on the environment variable CUDA_VISIBLE_DEVICES. After the CUDA_VISIBLE_DEVICES environment variable is set, DEVICE_ID indicates the index of the visible GPU device.
After export CUDA_VISIBLE_DEVICES=1,3,5 is executed, DEVICE_ID must be set to 0, 1, or 2. If DEVICE_ID is set to 3 or a larger value, MindSpore fails to run due to invalid device ID.
Q3: What do I do if error "/usr/bin/ld: warning: libxxx.so, needed by libmindspore.so, not found" is reported during application compilation?
A3: Search for the directory where the dynamic library file is missing and add the path to the environment variable LD_LIBRARY_PATH.
Q4: What do I do if "ModuleNotFoundError: No module named 'te'" is reported when running an application?
A4: Check whether the environment and the relevant .whl packages such as TE and Topi are correctly installed. If there are multiple Python versions in the user environment like the Conda virtual environment, use ldd name_of_your_executable_app to check whether libpython3.so that is linked to the application is consistent with the current Python path. If no, modify the sequence of LD_LIBRARY_PATH. Example:
export LD_LIBRARY_PATH=`python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))"`:$LD_LIBRARY_PATH
Locate the runtime library path of the program corresponding to the current Python command. Add the path to the beginning of LD_LIBRARY_PATH.
Q5: What do I do if "error while loading shared libraries: libpython3.so: cannot open shared object file: No such file or directory" is reported when running an application?
A5: This error usually occurs in an environment where multiple Python versions are installed. Run the following command to check whether the lib directory of Python is in the environment variable LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=`python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))"`:$LD_LIBRARY_PATH
In the Conda virtual environment, Python earlier than version 3.7.6 does not contain the dynamic library. You can run the conda install python=3.7.11 command to upgrade the Python version in Conda.
Q6: The Ascend AI processor software package and other dependencies are installed. What do I do if "Cannot open shared objectfile: No such file or directory" is reported when running MindSpore?
A6: There are 2 common causes: (1) The version of the software package, firmware package, or driver package of the Ascend AI processor is incorrect. (2) The packages are not installed in the default location and the corresponding environment variables are not configured.
How to solve Problem 1: Open the installation directory, /usr/local/Ascend by default, of the Ascend AI processor software package. Open the version.info file in each subdirectory and check whether the versions match the current MindSpore version. For details, see this link. If the versions do not match, update the software package or MindSpore.
How to solve Problem 2: Check whether the software package of the Ascend AI processor and other dependencies are installed in the default directory. MindSpore automatically loads the software package from the default installation directory /usr/local/Ascend. If you want to customize an installation directory, see Installation Guide to set environment variables. If you want to customize an installation directory of the dependencies, set the LD_LIBRARY_PATH environment variable.
7. Installation Verification
Q1: Does MindSpore GPU have specific requirements on the computing capability of the device?
A1: Currently, MindSpore GPU supports only devices with the computing capability higher than 5.3.
Q2: After MindSpore is installed on a PC, an error message "the pointer[session] is null" is reported during code verification. The code is as follows. How do I verify whether the installation is successful?
import numpy as npimport mindspore as msimport mindspore.ops as ops
ms.set_context(device_target="Ascend")x = ms.Tensor(np.ones([1,3,3,4]).astype(np.float32))y = ms.Tensor(np.ones([1,3,3,4]).astype(np.float32))print(ops.add(x,y))
A2: You can refer to the installation guide of the corresponding version and check whether the installation is successful.
python -c "import mindspore;mindspore.run_check()"
MindSpore is installed successfully if the following information is displayed:
MindSpore version: version_number
The result of multiplication calculation is correct, MindSpore has been installed successfully!
Q3: When a test case is executed on the Linux, the error message "sh:1:python:not found" is reported, or the error message "No module named mindspore._extends.remote" is reported because Python 2.7 is linked. What do I do?
A3: It is probably a Python environment problem. You can perform the following steps to check whether the Python environment is compatible with MindSpore:
Enter Python in the terminal window and check the version information in the Python interaction environment. If an error is reported, there is no Python soft link. If the Python version is not 3.7, the current Python environment is not compatible with MindSpore.
Run the sudo ln -sf /usr/bin/python3.7.x /usr/bin/python command to create a Python soft link, and then check again.
Q4: What do I do if the error message "/{your_path}/libgomp.so.1: cannot allocate memory in static TLS block" is reported when I import a third-party library before importing MindSpore in the script?
A4: You can choose either of the following solutions:
1. Import MindSpore before importing other third-party libraries.
2. Add the environment variable by configuring export LD_PRELOAD=/{your_path}/libgomp.so.1, where {your_path} is the path displayed in the preceding error message.
Q5: After MindSpore and GMP are compiled from source code and installed, the error message "ImportError: libgmpxx.so: cannot open shared object file: No such file or directory" is reported when I import mindspore in the script. What do I do?
A5: --enable-cxx is not configured when the gmp library is compiled and installed. The correct GMP compilation and installation operations are as follows (take GMP 6.1.2 for example):
$cd gmp-6.1.2
$./configure --enable-cxx$make$make check$sudo make install
Q6: What dol I do if alarm "UserWarning: The value of the smallest subnormal for type is zero." is generated when running MindSpore?
A6: It is because NumPy (1.22.0 or later) is installed in Arm Python 3.9 environment. The alarm is from NumPy, not from MindSpore. If the alarm affects code commissioning, you can manually install NumPy of an earlier version (1.21.2 or earlier).
Q7: What do I do if error "AttributeError: module 'six' has no attribute 'ensure_text'" is reported when running MindSpore?
A7: It is because the asttokens (2.0.6 or later) is installed in the environment, and the asttokens version does not match the version of six on which asttokens depends. Update the version of six to 1.12.0 or later.
Link to the previous FAQs:
https://www.hiascend.com/developer/blog/details/0254121507140653021