Unverified Commit 047a9e22 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Update installation doc and M1 support (#4753)

parent fac7364a
.. b4703fc8c8e8dc1babdb38ba9ebcd4a6
安装 NNI
========
NNI 依赖于 Python 3.7 或以上版本。
您可以通过以下三种方式之一安装 NNI:
* :ref:`通过 pip 安装<zh-installation-pip>`
* :ref:`从源代码编译安装<zh-installation-source>`
* :ref:`使用 Docker 容器<zh-installation-docker>`
.. _zh-installation-pip:
pip 安装
--------
NNI 为 x86-64 平台提供预编译的安装包,您可以使用 pip 进行安装:
.. code-block:: text
pip install nni
您也可以升级已安装的旧版本 NNI:
.. code-block:: text
pip install --latest nni
安装完成后,请运行以下命令进行检查:
.. code-block:: text
nnictl --version
如果您使用的是 Linux 系统并且没有使用 Conda,您可能会遇到 ``bash: nnictl: command not found`` 错误,
此时您需要将 pip 安装的可执行文件添加到 ``PATH`` 环境变量:
.. code-block:: bash
echo 'export PATH=${PATH}:${HOME}/.local/bin' >> ~/.bashrc
source ~/.bashrc
.. _zh-installation-source:
编译安装
--------
NNI 项目使用 `GitHub <https://github.com/microsoft/nni>`__ 托管源代码。
NNI 对 ARM64 平台(包括苹果 M1)提供实验性支持,如果您希望在此类平台上使用 NNI,请从源代码编译安装。
编译步骤请参见英文文档: :doc:`/notes/build_from_source`
.. _zh-installation-docker:
Docker 镜像
-----------
NNI 在 `Docker Hub <https://hub.docker.com/r/msranni/nni>`__ 上提供了官方镜像。
.. code-block:: text
docker pull msranni/nni
安装额外依赖
------------
有一些算法依赖于额外的 pip 包,在使用前需要先指定 ``nni[算法名]`` 安装依赖。以 DNGO 算法为例,使用前请运行以下命令:
.. code-block:: text
pip install nni[DNGO]
如果您已经通过任一种方式安装了 NNI,以上命令不会重新安装或改变 NNI 版本,只会安装 DNGO 算法的额外依赖。
您也可以一次性安装所有可选依赖:
.. code-block:: text
pip install nni[all]
**注意**:SMAC 算法依赖于 swig3,在 Ubuntu 系统中需要手动进行降级:
.. code-block:: bash
sudo apt install swig3.0
sudo rm /usr/bin/swig
sudo ln -s swig3.0 /usr/bin/swig
Build from Source
=================
This article describes how to build and install NNI from `source code`_.
This article describes how to build and install NNI from `source code <https://github.com/microsoft/nni>`__.
We recommend using latest setuptools:
Preparation
-----------
Fetch source code from GitHub:
.. code-block:: bash
git clone https://github.com/microsoft/nni.git
cd nni
Upgrade to latest toolchain:
.. code-block:: text
pip install --upgrade setuptools pip wheel
.. _source code: https://github.com/microsoft/nni
.. note::
Please make sure ``python`` and ``pip`` executables have correct Python version.
For Apple Silicon M1, if ``python`` command is not available, you may need to manually fix dependency building issues.
(`GitHub issue <https://github.com/mapbox/node-sqlite3/issues/1413>`__ |
`Stack Overflow question <https://stackoverflow.com/questions/70874412/sqlite3-on-m1-chip-npm-is-failing>`__)
Development Build
-----------------
......@@ -24,6 +40,8 @@ This will install NNI as symlink, and the version number will be ``999.dev0``.
.. _development mode: https://setuptools.pypa.io/en/latest/userguide/development_mode.html
Then if you want to modify NNI source code, please check :doc:`contribution guide <contributing>`.
Release Build
-------------
......@@ -34,15 +52,16 @@ A release package requires jupyterlab to build the extension:
.. code-block:: text
pip install jupyterlab
pip install jupyterlab==3.0.9
And you need to set ``NNI_RELEASE`` environment variable, and compile TypeScript modules before "bdist_wheel".
You need to set ``NNI_RELEASE`` environment variable to the version number,
and compile TypeScript modules before "bdist_wheel".
In bash:
.. code-block:: bash
export NNI_RELEASE=2.7
export NNI_RELEASE=2.0
python setup.py build_ts
python bdist_wheel
......@@ -50,7 +69,7 @@ In PowerShell:
.. code-block:: powershell
$env:NNI_RELEASE=2.7
$env:NNI_RELEASE=2.0
python setup.py build_ts
python bdist_wheel
......
......@@ -28,7 +28,7 @@
"mini-css-extract-plugin": "^1.6.0",
"monaco-editor": "^0.25.0",
"monaco-editor-webpack-plugin": "^4.0.0",
"node-sass": "^7.0.0",
"node-sass": "^7.0.1",
"parcoord-es": "^2.2.10",
"pnp-webpack-plugin": "^1.6.4",
"postcss-flexbugs-fixes": "^5.0.2",
......
......@@ -2771,11 +2771,6 @@ alphanum-sort@^1.0.2:
resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3"
integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=
 
amdefine@>=0.0.4:
version "1.0.1"
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=
ansi-colors@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
......@@ -7545,7 +7540,7 @@ jest@^27.0.4:
import-local "^3.0.2"
jest-cli "^27.4.5"
 
js-base64@^2.1.8:
js-base64@^2.4.3:
version "2.6.4"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4"
integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==
......@@ -8048,7 +8043,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
 
lodash@^4.0.0, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0, lodash@~4.17.10:
lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0, lodash@~4.17.10:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
......@@ -8595,10 +8590,10 @@ node-releases@^2.0.1:
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5"
integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==
 
node-sass@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-7.0.0.tgz#33ee7c2df299d51f682f13d79f3d2a562225788e"
integrity sha512-6yUnsD3L8fVbgMX6nKQqZkjRcG7a/PpmF0pEyeWf+BgbTj2ToJlCYrnUifL2KbjV5gIY22I3oppahBWA3B+jUg==
node-sass@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-7.0.1.tgz#ad4f6bc663de8acc0a9360db39165a1e2620aa72"
integrity sha512-uMy+Xt29NlqKCFdFRZyXKOTqGt+QaKHexv9STj2WeLottnlqZEEWx6Bj0MXNthmFRRdM/YwyNo/8Tr46TOM0jQ==
dependencies:
async-foreach "^0.1.3"
chalk "^4.1.2"
......@@ -8609,10 +8604,10 @@ node-sass@^7.0.0:
lodash "^4.17.15"
meow "^9.0.0"
nan "^2.13.2"
node-gyp "^7.1.0"
node-gyp "^8.4.1"
npmlog "^5.0.0"
request "^2.88.0"
sass-graph "2.2.5"
sass-graph "4.0.0"
stdout-stream "^1.4.0"
"true-case-path" "^1.0.2"
 
......@@ -10925,15 +10920,15 @@ sanitize.css@*:
resolved "https://registry.yarnpkg.com/sanitize.css/-/sanitize.css-13.0.0.tgz#2675553974b27964c75562ade3bd85d79879f173"
integrity sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA==
 
sass-graph@2.2.5:
version "2.2.5"
resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.5.tgz#a981c87446b8319d96dce0671e487879bd24c2e8"
integrity sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==
sass-graph@4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-4.0.0.tgz#fff8359efc77b31213056dfd251d05dadc74c613"
integrity sha512-WSO/MfXqKH7/TS8RdkCX3lVkPFQzCgbqdGsmSKq6tlPU+GpGEsa/5aW18JqItnqh+lPtcjifqdZ/VmiILkKckQ==
dependencies:
glob "^7.0.0"
lodash "^4.0.0"
scss-tokenizer "^0.2.3"
yargs "^13.3.2"
lodash "^4.17.11"
scss-tokenizer "^0.3.0"
yargs "^17.2.1"
 
sass-loader@^12.1.0:
version "12.4.0"
......@@ -10993,13 +10988,13 @@ schema-utils@^4.0.0:
ajv-formats "^2.1.1"
ajv-keywords "^5.0.0"
 
scss-tokenizer@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1"
integrity sha1-jrBtualyMzOCTT9VMGQRSYR85dE=
scss-tokenizer@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.3.0.tgz#ef7edc3bc438b25cd6ffacf1aa5b9ad5813bf260"
integrity sha512-14Zl9GcbBvOT9057ZKjpz5yPOyUWG2ojd9D5io28wHRYsOrs7U95Q+KNL87+32p8rc+LvDpbu/i9ZYjM9Q+FsQ==
dependencies:
js-base64 "^2.1.8"
source-map "^0.4.2"
js-base64 "^2.4.3"
source-map "^0.7.1"
 
select-hose@^2.0.0:
version "2.0.0"
......@@ -11281,13 +11276,6 @@ source-map-url@^0.4.0:
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56"
integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==
 
source-map@^0.4.2:
version "0.4.4"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
integrity sha1-66T12pwNyZneaAMti092FzZSA2s=
dependencies:
amdefine ">=0.0.4"
source-map@^0.5.0, source-map@^0.5.6:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
......@@ -11298,7 +11286,7 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
 
source-map@^0.7.3, source-map@~0.7.2:
source-map@^0.7.1, source-map@^0.7.3, source-map@~0.7.2:
version "0.7.3"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
......@@ -12894,7 +12882,7 @@ yargs-parser@^21.0.0:
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.0.tgz#a485d3966be4317426dd56bdb6a30131b281dc55"
integrity sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==
 
yargs@>=17.0.1, yargs@^13.3.2, yargs@^16.2.0:
yargs@>=17.0.1, yargs@^16.2.0, yargs@^17.2.1:
version "17.3.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.3.0.tgz#295c4ffd0eef148ef3e48f7a2e0f58d0e4f26b1c"
integrity sha512-GQl1pWyDoGptFPJx9b9L6kmR33TGusZvXIZUT+BOz9f7X2L94oeAskFYLEg/FkhV06zZPBYLvLZRWeYId29lew==
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment