installation.rst 2.08 KB
Newer Older
liuzhe-lz's avatar
liuzhe-lz committed
1
2
Install NNI
===========
3

liuzhe-lz's avatar
liuzhe-lz committed
4
5
6
NNI requires Python >= 3.7.
It is tested and supported on Ubuntu >= 18.04,
Windows 10 >= 21H2, and macOS >= 11.
7

liuzhe-lz's avatar
liuzhe-lz committed
8
9
10
11
12
13
14
15
There are 3 ways to install NNI:

* :ref:`Using pip <installation-pip>`
* :ref:`Build source code <installation-source>`
* :ref:`Using Docker <installation-docker>`

.. _installation-pip:

liuzhe-lz's avatar
liuzhe-lz committed
16
17
Using pip
---------
18

liuzhe-lz's avatar
liuzhe-lz committed
19
20
NNI provides official packages for x86-64 CPUs. They can be installed with pip:

liuzhe-lz's avatar
liuzhe-lz committed
21
22
23
24
25
.. code-block:: text

    pip install nni

Or to upgrade to latest version:
liuzhe-lz's avatar
liuzhe-lz committed
26

liuzhe-lz's avatar
liuzhe-lz committed
27
28
29
.. code-block:: text

    pip install --latest nni
liuzhe-lz's avatar
liuzhe-lz committed
30
31
32

You can check installation with:

liuzhe-lz's avatar
liuzhe-lz committed
33
.. code-block:: text
liuzhe-lz's avatar
liuzhe-lz committed
34
35
36

    nnictl --version

liuzhe-lz's avatar
liuzhe-lz committed
37
On Linux systems without Conda, you may encounter ``bash: nnictl: command not found`` error.
liuzhe-lz's avatar
liuzhe-lz committed
38
39
40
41
42
43
44
In this case you need to add pip script directory to ``PATH``:

.. code-block:: bash

    echo 'export PATH=${PATH}:${HOME}/.local/bin' >> ~/.bashrc
    source ~/.bashrc

liuzhe-lz's avatar
liuzhe-lz committed
45
46
.. _installation-source:

liuzhe-lz's avatar
liuzhe-lz committed
47
48
49
50
51
52
53
54
55
56
Installing from Source Code
---------------------------

NNI hosts source code on `GitHub <https://github.com/microsoft/nni>`__.

NNI has experimental support for ARM64 CPUs, including Apple M1.
It requires to install from source code.

See :doc:`/notes/build_from_source`.

liuzhe-lz's avatar
liuzhe-lz committed
57
58
.. _installation-docker:

liuzhe-lz's avatar
liuzhe-lz committed
59
60
61
62
63
Using Docker
------------

NNI provides official Docker image on `Docker Hub <https://hub.docker.com/r/msranni/nni>`__.

liuzhe-lz's avatar
liuzhe-lz committed
64
.. code-block:: text
liuzhe-lz's avatar
liuzhe-lz committed
65
66
67
68
69
70
71
72
73
74
75

    docker pull msranni/nni

Installing Extra Dependencies
-----------------------------

Some built-in algorithms of NNI requires extra packages.
Use ``nni[<algorithm-name>]`` to install their dependencies.

For example, to install dependencies of :class:`DNGO tuner<nni.algorithms.hpo.dngo_tuner.DNGOTuner>` :

liuzhe-lz's avatar
liuzhe-lz committed
76
.. code-block:: text
liuzhe-lz's avatar
liuzhe-lz committed
77

liuzhe-lz's avatar
liuzhe-lz committed
78
    pip install nni[DNGO]
liuzhe-lz's avatar
liuzhe-lz committed
79
80
81
82
83

This command will not reinstall NNI itself, even if it was installed in development mode.

Alternatively, you may install all extra dependencies at once:

liuzhe-lz's avatar
liuzhe-lz committed
84
.. code-block:: text
liuzhe-lz's avatar
liuzhe-lz committed
85

liuzhe-lz's avatar
liuzhe-lz committed
86
    pip install nni[all]
liuzhe-lz's avatar
liuzhe-lz committed
87
88
89

**NOTE**: SMAC tuner depends on swig3, which requires a manual downgrade on Ubuntu:

liuzhe-lz's avatar
liuzhe-lz committed
90
.. code-block:: bash
liuzhe-lz's avatar
liuzhe-lz committed
91
92
93
94

    sudo apt install swig3.0
    sudo rm /usr/bin/swig
    sudo ln -s swig3.0 /usr/bin/swig