Installing MindSpore CPU by Conda-macOS
Conda is an open-source, cross-platform, language-agnostic package manager and environment management system. It allows users to easily install different versions of binary software packages and any required libraries appropriate for their computing platform.
This document describes how to quickly install MindSpore by Conda in a macOS system.
System Environment Information Confirmation
- According to the system and chip situation in the table below, determine the appropriate Python and Conda versions, and for the macOS version and chip information, click on the Apple logo in the upper left corner of the desktop - >
About this mac
:
Chip |
Architecture |
macOS Version |
Supported Python Version |
Supported Conda Version |
M1 |
ARM |
11.3 |
Python 3.8-3.9 |
Mambaforge or Miniforge |
Intel |
x86_64 |
10.15/11.3 |
Python 3.7-3.9 |
Anaconda or Miniconda |
Note: Python 3.8.10 or Python 3.8.5 via Conda are the oldest Python releases that supports macOS for ARM
Creating and Accessing the Conda Virtual Environment
Create a Conda virtual environment based on the Python version you want to use and go to the virtual environment.
-
If you want to use Python 3.7.5 (for 64-bit macOS 10.15):
conda create -c conda-forge -n mindspore_py37 -c conda-forge python=3.7.5
conda activate mindspore_py37
-
If you want to use Python 3.8.5 (for 64-bit macOS 10.15 and 11.3):
conda create -c conda-forge -n mindspore_py38 -c conda-forge python=3.8.5
conda activate mindspore_py38
-
If you want to use Python 3.9.0 (for 64-bit macOS 10.15 and 11.3):
conda create -c conda-forge -n mindspore_py39 -c conda-forge python=3.9.0
conda activate mindspore_py39
Installing MindSpore
Ensure that you are in the Conda virtual environment and run the following command to install the latest MindSpore. To install other versions, please refer to the specified version number of Version List after mindspore-ascend=
.
conda install mindspore-cpu -c mindspore -c conda-forge
When the network is connected, dependency items are automatically downloaded during .whl package installation. (For details about the dependency, see required_package in setup.py .) In other cases, you need to install it by yourself. When running models, you need to install additional dependencies based on requirements.txt specified for different models in ModelZoo. For details about common dependencies, see requirements.txt.
Installation Verification
python -c "import mindspore;mindspore.run_check()"
The outputs should be the same as:
MindSpore version: __version__
The result of multiplication calculation is correct, MindSpore has been installed successfully!
It means MindSpore has been installed successfully.
Version Update
Use the following command if you need to update the MindSpore version:
conda update mindspore-cpu -c mindspore -c conda-forge