[{"data":1,"prerenderedAt":611},["ShallowReactive",2],{"content-query-CJ3DDZJZgj":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"category":13,"body":14,"_type":605,"_id":606,"_source":607,"_file":608,"_stem":609,"_extension":610},"/technology-blogs/en/2660","en",false,"","FAQs About MindSpore Installation (2)","This blog shares FAQs about Docker installation, uninstallation, environment variables, and installation verification.","2023-06-09","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/07/31/3df28c3026d14cc78cf4d5222fca5247.png","technology-blogs","Practices",{"type":15,"children":16,"toc":602},"root",[17,25,35,40,45,61,74,79,91,96,104,109,121,129,134,153,165,195,247,252,263,268,293,298,308,313,324,328,340,345,350,378,403,411,416,421,426,431,436,441,446,451,462,467,472,477,482,494,499,504,509,541,546,558,563,568,573,578,583,588,593],{"type":18,"tag":19,"props":20,"children":22},"element","h1",{"id":21},"faqs-about-mindspore-installation-2",[23],{"type":24,"value":8},"text",{"type":18,"tag":26,"props":27,"children":28},"p",{},[29],{"type":18,"tag":30,"props":31,"children":32},"strong",{},[33],{"type":24,"value":34},"4. Docker Installation",{"type":18,"tag":26,"props":36,"children":37},{},[38],{"type":24,"value":39},"Q1: Does MindSpore support PCs with NVIDIA discrete GPU + Windows OS?",{"type":18,"tag":26,"props":41,"children":42},{},[43],{"type":24,"value":44},"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:",{"type":18,"tag":26,"props":46,"children":47},{},[48,50,59],{"type":24,"value":49},"1. Install Ubuntu 18.04 in WSL. For details, see ",{"type":18,"tag":51,"props":52,"children":56},"a",{"href":53,"rel":54},"https://learn.microsoft.com/en-us/windows/wsl/install",[55],"nofollow",[57],{"type":24,"value":58},"Install Linux on Windows with WSL",{"type":24,"value":60},".",{"type":18,"tag":26,"props":62,"children":63},{},[64,66,73],{"type":24,"value":65},"2. Install the NVIDIA driver that supports WSL and deploy the environment where runs the container. For details, see ",{"type":18,"tag":51,"props":67,"children":70},{"href":68,"rel":69},"https://docs.nvidia.com/cuda/wsl-user-guide/index.html",[55],[71],{"type":24,"value":72},"CUDA on WSL User Guide",{"type":24,"value":60},{"type":18,"tag":26,"props":75,"children":76},{},[77],{"type":24,"value":78},"Note: CUDA on WSL is for preview only. If the Windows version is incorrect, upgrade it.",{"type":18,"tag":26,"props":80,"children":81},{},[82,84,89],{"type":24,"value":83},"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 ",{"type":18,"tag":30,"props":85,"children":86},{},[87],{"type":24,"value":88},"docker pull mindspore/mindspore-gpu:1.0.0",{"type":24,"value":90}," command in Ubuntu 18.04 to run the container:",{"type":18,"tag":26,"props":92,"children":93},{},[94],{"type":24,"value":95},"docker run -it --runtime=nvidia mindspore/mindspore-gpu:1.0.0 /bin/bash",{"type":18,"tag":26,"props":97,"children":98},{},[99],{"type":18,"tag":30,"props":100,"children":101},{},[102],{"type":24,"value":103},"5. Uninstallation",{"type":18,"tag":26,"props":105,"children":106},{},[107],{"type":24,"value":108},"Q1: How do I uninstall MindSpore?",{"type":18,"tag":26,"props":110,"children":111},{},[112,114,119],{"type":24,"value":113},"A1: Check the full name of the installed MindSpore. For example, to uninstall MindSpore GPU, you can run the ",{"type":18,"tag":30,"props":115,"children":116},{},[117],{"type":24,"value":118},"pip uninstall mindspore-gpu",{"type":24,"value":120}," command.",{"type":18,"tag":26,"props":122,"children":123},{},[124],{"type":18,"tag":30,"props":125,"children":126},{},[127],{"type":24,"value":128},"6. Environment Variables",{"type":18,"tag":26,"props":130,"children":131},{},[132],{"type":24,"value":133},"Q1: Some common environment variables need to be reset in the newly started terminal window. What do I do if I forget them?",{"type":18,"tag":26,"props":135,"children":136},{},[137,139,144,146,151],{"type":24,"value":138},"A1: Write common environment variable settings to ",{"type":18,"tag":30,"props":140,"children":141},{},[142],{"type":24,"value":143},"~/.bash_profile",{"type":24,"value":145}," or ",{"type":18,"tag":30,"props":147,"children":148},{},[149],{"type":24,"value":150},"~/.bashrc",{"type":24,"value":152}," so that the settings take effect immediately in the new terminal window.",{"type":18,"tag":26,"props":154,"children":155},{},[156,158,163],{"type":24,"value":157},"Q2: How do I set the ",{"type":18,"tag":30,"props":159,"children":160},{},[161],{"type":24,"value":162},"DEVICE_ID",{"type":24,"value":164}," environment variable when using MindSpore GPU?",{"type":18,"tag":26,"props":166,"children":167},{},[168,170,174,176,181,183,187,189,193],{"type":24,"value":169},"A2: In MindSpore GPU, you do not need to set the ",{"type":18,"tag":30,"props":171,"children":172},{},[173],{"type":24,"value":162},{"type":24,"value":175}," environment variable. MindSpore GPU automatically selects a visible GPU device based on the environment variable ",{"type":18,"tag":30,"props":177,"children":178},{},[179],{"type":24,"value":180},"CUDA_VISIBLE_DEVICES",{"type":24,"value":182},". After the ",{"type":18,"tag":30,"props":184,"children":185},{},[186],{"type":24,"value":180},{"type":24,"value":188}," environment variable is set, ",{"type":18,"tag":30,"props":190,"children":191},{},[192],{"type":24,"value":162},{"type":24,"value":194}," indicates the index of the visible GPU device.",{"type":18,"tag":26,"props":196,"children":197},{},[198,200,205,207,211,213,218,220,225,227,232,234,238,240,245],{"type":24,"value":199},"After ",{"type":18,"tag":30,"props":201,"children":202},{},[203],{"type":24,"value":204},"export CUDA_VISIBLE_DEVICES=1,3,5",{"type":24,"value":206}," is executed, ",{"type":18,"tag":30,"props":208,"children":209},{},[210],{"type":24,"value":162},{"type":24,"value":212}," must be set to ",{"type":18,"tag":30,"props":214,"children":215},{},[216],{"type":24,"value":217},"0",{"type":24,"value":219},", ",{"type":18,"tag":30,"props":221,"children":222},{},[223],{"type":24,"value":224},"1",{"type":24,"value":226},", or ",{"type":18,"tag":30,"props":228,"children":229},{},[230],{"type":24,"value":231},"2",{"type":24,"value":233},". If ",{"type":18,"tag":30,"props":235,"children":236},{},[237],{"type":24,"value":162},{"type":24,"value":239}," is set to ",{"type":18,"tag":30,"props":241,"children":242},{},[243],{"type":24,"value":244},"3",{"type":24,"value":246}," or a larger value, MindSpore fails to run due to invalid device ID.",{"type":18,"tag":26,"props":248,"children":249},{},[250],{"type":24,"value":251},"Q3: What do I do if error \"/usr/bin/ld: warning: libxxx.so, needed by libmindspore.so, not found\" is reported during application compilation?",{"type":18,"tag":26,"props":253,"children":254},{},[255,257,262],{"type":24,"value":256},"A3: Search for the directory where the dynamic library file is missing and add the path to the environment variable ",{"type":18,"tag":30,"props":258,"children":259},{},[260],{"type":24,"value":261},"LD_LIBRARY_PATH",{"type":24,"value":60},{"type":18,"tag":26,"props":264,"children":265},{},[266],{"type":24,"value":267},"Q4: What do I do if \"ModuleNotFoundError: No module named 'te'\" is reported when running an application?",{"type":18,"tag":26,"props":269,"children":270},{},[271,273,278,280,285,287,291],{"type":24,"value":272},"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 ",{"type":18,"tag":30,"props":274,"children":275},{},[276],{"type":24,"value":277},"ldd name_of_your_executable_app",{"type":24,"value":279}," to check whether ",{"type":18,"tag":30,"props":281,"children":282},{},[283],{"type":24,"value":284},"libpython3.so",{"type":24,"value":286}," that is linked to the application is consistent with the current Python path. If no, modify the sequence of ",{"type":18,"tag":30,"props":288,"children":289},{},[290],{"type":24,"value":261},{"type":24,"value":292},". Example:",{"type":18,"tag":26,"props":294,"children":295},{},[296],{"type":24,"value":297},"export LD_LIBRARY_PATH=`python -c \"import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))\"`:$LD_LIBRARY_PATH",{"type":18,"tag":26,"props":299,"children":300},{},[301,303,307],{"type":24,"value":302},"Locate the runtime library path of the program corresponding to the current Python command. Add the path to the beginning of ",{"type":18,"tag":30,"props":304,"children":305},{},[306],{"type":24,"value":261},{"type":24,"value":60},{"type":18,"tag":26,"props":309,"children":310},{},[311],{"type":24,"value":312},"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?",{"type":18,"tag":26,"props":314,"children":315},{},[316,318,322],{"type":24,"value":317},"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 ",{"type":18,"tag":30,"props":319,"children":320},{},[321],{"type":24,"value":261},{"type":24,"value":323},":",{"type":18,"tag":26,"props":325,"children":326},{},[327],{"type":24,"value":297},{"type":18,"tag":26,"props":329,"children":330},{},[331,333,338],{"type":24,"value":332},"In the Conda virtual environment, Python earlier than version 3.7.6 does not contain the dynamic library. You can run the ",{"type":18,"tag":30,"props":334,"children":335},{},[336],{"type":24,"value":337},"conda install python=3.7.11",{"type":24,"value":339}," command to upgrade the Python version in Conda.",{"type":18,"tag":26,"props":341,"children":342},{},[343],{"type":24,"value":344},"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?",{"type":18,"tag":26,"props":346,"children":347},{},[348],{"type":24,"value":349},"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.",{"type":18,"tag":26,"props":351,"children":352},{},[353,355,360,362,367,369,376],{"type":24,"value":354},"How to solve Problem 1: Open the installation directory, ",{"type":18,"tag":30,"props":356,"children":357},{},[358],{"type":24,"value":359},"/usr/local/Ascend",{"type":24,"value":361}," by default, of the Ascend AI processor software package. Open the ",{"type":18,"tag":30,"props":363,"children":364},{},[365],{"type":24,"value":366},"version.info",{"type":24,"value":368}," file in each subdirectory and check whether the versions match the current MindSpore version. For details, see this ",{"type":18,"tag":51,"props":370,"children":373},{"href":371,"rel":372},"https://www.mindspore.cn/install/en",[55],[374],{"type":24,"value":375},"link",{"type":24,"value":377},". If the versions do not match, update the software package or MindSpore.",{"type":18,"tag":26,"props":379,"children":380},{},[381,383,387,389,395,397,401],{"type":24,"value":382},"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 ",{"type":18,"tag":30,"props":384,"children":385},{},[386],{"type":24,"value":359},{"type":24,"value":388},". If you want to customize an installation directory, see ",{"type":18,"tag":51,"props":390,"children":392},{"href":371,"rel":391},[55],[393],{"type":24,"value":394},"Installation Guide",{"type":24,"value":396}," to set environment variables. If you want to customize an installation directory of the dependencies, set the ",{"type":18,"tag":30,"props":398,"children":399},{},[400],{"type":24,"value":261},{"type":24,"value":402}," environment variable.",{"type":18,"tag":26,"props":404,"children":405},{},[406],{"type":18,"tag":30,"props":407,"children":408},{},[409],{"type":24,"value":410},"7. Installation Verification",{"type":18,"tag":26,"props":412,"children":413},{},[414],{"type":24,"value":415},"Q1: Does MindSpore GPU have specific requirements on the computing capability of the device?",{"type":18,"tag":26,"props":417,"children":418},{},[419],{"type":24,"value":420},"A1: Currently, MindSpore GPU supports only devices with the computing capability higher than 5.3.",{"type":18,"tag":26,"props":422,"children":423},{},[424],{"type":24,"value":425},"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?",{"type":18,"tag":26,"props":427,"children":428},{},[429],{"type":24,"value":430},"import numpy as npimport mindspore as msimport mindspore.ops as ops",{"type":18,"tag":26,"props":432,"children":433},{},[434],{"type":24,"value":435},"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))",{"type":18,"tag":26,"props":437,"children":438},{},[439],{"type":24,"value":440},"A2: You can refer to the installation guide of the corresponding version and check whether the installation is successful.",{"type":18,"tag":26,"props":442,"children":443},{},[444],{"type":24,"value":445},"python -c \"import mindspore;mindspore.run_check()\"",{"type":18,"tag":26,"props":447,"children":448},{},[449],{"type":24,"value":450},"MindSpore is installed successfully if the following information is displayed:",{"type":18,"tag":26,"props":452,"children":453},{},[454,456],{"type":24,"value":455},"MindSpore version: ",{"type":18,"tag":457,"props":458,"children":459},"em",{},[460],{"type":24,"value":461},"version_number",{"type":18,"tag":26,"props":463,"children":464},{},[465],{"type":24,"value":466},"The result of multiplication calculation is correct, MindSpore has been installed successfully!",{"type":18,"tag":26,"props":468,"children":469},{},[470],{"type":24,"value":471},"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?",{"type":18,"tag":26,"props":473,"children":474},{},[475],{"type":24,"value":476},"A3: It is probably a Python environment problem. You can perform the following steps to check whether the Python environment is compatible with MindSpore:",{"type":18,"tag":26,"props":478,"children":479},{},[480],{"type":24,"value":481},"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.",{"type":18,"tag":26,"props":483,"children":484},{},[485,487,492],{"type":24,"value":486},"Run the ",{"type":18,"tag":30,"props":488,"children":489},{},[490],{"type":24,"value":491},"sudo ln -sf /usr/bin/python3.7.x /usr/bin/python",{"type":24,"value":493}," command to create a Python soft link, and then check again.",{"type":18,"tag":26,"props":495,"children":496},{},[497],{"type":24,"value":498},"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?",{"type":18,"tag":26,"props":500,"children":501},{},[502],{"type":24,"value":503},"A4: You can choose either of the following solutions:",{"type":18,"tag":26,"props":505,"children":506},{},[507],{"type":24,"value":508},"1. Import MindSpore before importing other third-party libraries.",{"type":18,"tag":26,"props":510,"children":511},{},[512,514,526,528,539],{"type":24,"value":513},"2. Add the environment variable by configuring ",{"type":18,"tag":30,"props":515,"children":516},{},[517,519,524],{"type":24,"value":518},"export LD_PRELOAD=/{",{"type":18,"tag":457,"props":520,"children":521},{},[522],{"type":24,"value":523},"your_path",{"type":24,"value":525},"}/libgomp.so.1",{"type":24,"value":527},", where ",{"type":18,"tag":30,"props":529,"children":530},{},[531,533,537],{"type":24,"value":532},"{",{"type":18,"tag":457,"props":534,"children":535},{},[536],{"type":24,"value":523},{"type":24,"value":538},"}",{"type":24,"value":540}," is the path displayed in the preceding error message.",{"type":18,"tag":26,"props":542,"children":543},{},[544],{"type":24,"value":545},"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?",{"type":18,"tag":26,"props":547,"children":548},{},[549,551,556],{"type":24,"value":550},"A5: ",{"type":18,"tag":30,"props":552,"children":553},{},[554],{"type":24,"value":555},"--enable-cxx",{"type":24,"value":557}," 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):",{"type":18,"tag":26,"props":559,"children":560},{},[561],{"type":24,"value":562},"$cd gmp-6.1.2",{"type":18,"tag":26,"props":564,"children":565},{},[566],{"type":24,"value":567},"$./configure --enable-cxx$make$make check$sudo make install",{"type":18,"tag":26,"props":569,"children":570},{},[571],{"type":24,"value":572},"Q6: What dol I do if alarm \"UserWarning: The value of the smallest subnormal for type is zero.\" is generated when running MindSpore?",{"type":18,"tag":26,"props":574,"children":575},{},[576],{"type":24,"value":577},"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).",{"type":18,"tag":26,"props":579,"children":580},{},[581],{"type":24,"value":582},"Q7: What do I do if error \"AttributeError: module 'six' has no attribute 'ensure_text'\" is reported when running MindSpore?",{"type":18,"tag":26,"props":584,"children":585},{},[586],{"type":24,"value":587},"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.",{"type":18,"tag":26,"props":589,"children":590},{},[591],{"type":24,"value":592},"Link to the previous FAQs:",{"type":18,"tag":26,"props":594,"children":595},{},[596],{"type":18,"tag":51,"props":597,"children":600},{"href":598,"rel":599},"https://www.hiascend.com/developer/blog/details/0254121507140653021",[55],[601],{"type":24,"value":598},{"title":7,"searchDepth":603,"depth":603,"links":604},4,[],"markdown","content:technology-blogs:en:2660.md","content","technology-blogs/en/2660.md","technology-blogs/en/2660","md",1776506106818]