未验证 提交 c1cd6a69 编写于 作者: Z zhongpu 提交者: GitHub

update english installation documents (#1919)

* update english installation documents, test=develop

* fix index_en.rst, test=develop
上级 16c198aa
此差异已折叠。
***
# **Compile on CentOS from Source Code** # **Compile on CentOS from Source Code**
This instruction will show you how to compile PaddlePaddle on a 64-bit desktop or laptop and CentOS. The Centos systems we support must meet the following requirements: ## Environment preparation
* CentOS 7 / 6 (this involves whether the related tools can be installed normally) * **CentOS version (64 bit)**
* **CentOS 6 (not recommended, no official support for compilation problems)**
* **CentOS 7 (GPU version supports CUDA 9.0/9.1/9.2/10.0/10.1 CUDA 9.1, only support single-card mode)**
* **Python version 2.7.15+/3.5.1+/3.6/3.7 (64 bit)**
* **pip or pip3 version 9.0.1+ (64 bit)**
## Determine which version to compile ## Choose CPU/GPU
* **Only PaddlePaddle for CPU is supported.** * If your computer doesn't have NVIDIA® GPU, please install CPU version of PaddlePaddle
## Choose a compilation method * If your computer has NVIDIA® GPU, and the following conditions are met,GPU version of PaddlePaddle is recommended.
We provide two compilation methods under the CentOS system: * **CUDA toolkit 10.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **CUDA toolkit 9.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **Hardware devices with GPU computing power over 1.0**
* Docker source code compilation (the CentOS 6 / 7 GPU version is not supported) (this image already contains python2.7, python3.6, python3.7 environment) You can refer to NVIDIA official documents for installation process and configuration method of CUDA and cudnn. Please refer to[CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/),[cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/)
* Direct native source code compilation (does not support all versions of CentOS 6 and GPU versions of CentOS 7)
We recommend using **Docker for compilation** because we are installing both the tools and the configuration in a Docker image. This way, if you encounter problems, others can reproduce the problem to help. In addition, for developers accustomed to using Windows and MacOS, there is no need to configure a cross-compilation environment using Docker. It should be emphasized that Docker does not virtualize any hardware. The compiler tools running in the Docker container are actually running directly on the native CPU and operating system. The performance is the same as installing the compiler on the machine. * * If you need to use multi card environment, please make sure that you have installed nccl2 correctly, or install nccl2 according to the following instructions (here is the installation instructions of nccl2 under ubuntu 16.04, CUDA9 and cuDNN7). For more version of installation information, please refer to NVIDIA[official website](https://developer.nvidia.com/nccl):
Also for those who can't install Docker for a variety of reasons, we also provide a way to **compile directly from sources**, but since the situation on host machine is more complicated, we only support specific systems.
wget http://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
rpm -i nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
sudo apt-get install -y libnccl2=2.3.7-1+cuda9.0 libnccl-dev=2.3.7-1+cuda9.0
yum update -y
yum install -y libnccl-2.3.7-2+cuda9.0 libnccl-devel-2.3.7-2+cuda9.0 libnccl-static-2.3.7-2+cuda9.0
### ***Compile with Docker***
In order to better use Docker and avoid problems, we recommend using **the highest version of Docker**. For details on **installing and using Docker**, please refer to the [official Docker documentation](https://docs.docker.com/install/). ## Installation steps
Once you have **properly installed Docker**, you can start **compiling PaddlePaddle with Docker**: There are two compilation methods under CentOS system:
* Compile with Docker(GPU version only supports CentOS 7)
* Local compilation (no official support for compilation problems under CentOS 6)
<a name="ct_docker"></a>
### **Compile with Docker**
[Docker](https://docs.docker.com/install/) is an open source application container engine. Using docker, you can not only isolate the installation and use of paddlepaddle from the system environment, but also share GPU, network and other resources with the host
Compiling PaddlePaddle with Docker,you need:
- On the local host [Install Docker](https://hub.docker.com/search/?type=edition&offering=community)
- To enable GPU support on Linux, please [Install nvidia-docker](https://github.com/NVIDIA/nvidia-docker)
Please follow the steps below to install:
1. First select the path where you want to store PaddlePaddle, then use the following command to clone PaddlePaddle's source code from github to a folder named Paddle in the local current directory: 1. First select the path where you want to store PaddlePaddle, then use the following command to clone PaddlePaddle's source code from github to a folder named Paddle in the local current directory:
...@@ -33,28 +56,66 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad ...@@ -33,28 +56,66 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad
2. Go to the Paddle directory: `cd Paddle` 2. Go to the Paddle directory: `cd Paddle`
3. Take advantage of the image we provided (with this command you don't have to download the image in advance): 3. Create and enter a Docker container that meets the compilation environment:
* Compile CPU version of PaddlePaddle:
`docker run --name paddle-test -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash`
> --name paddle-test names the Docker container you created as paddle-test;
> -v $PWD:/paddle mount the current directory to the /paddle directory in the docker container (PWD variable in Linux will be expanded to [absolute path](https://baike.baidu.com/item/绝对路径/481185) of the current path);
`docker run --name paddle-test -v $PWD:/paddle --network=host -it` `hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash` > -it keeps interaction with the host,`hub.baidubce.com/paddlepaddle/paddle:latest-dev` use the image named `hub.baidubce.com/paddlepaddle/paddle:latest-dev` to create Docker container, /bin/bash start the /bin/bash command after entering the container.
* Compile GPU version of PaddlePaddle (only supports CentOS 7):
`nvidia-docker run --name paddle-test -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash`
> --name paddle-test names the Docker container you created as paddle-test;
> -v $PWD:/paddle mount the current directory to the /paddle directory in the docker container (PWD variable in Linux will be expanded to [absolute path](https://baike.baidu.com/item/绝对路径/481185) of the current path);
> -it keeps interaction with the host,`hub.baidubce.com/paddlepaddle/paddle:latest-dev` use the image named `hub.baidubce.com/paddlepaddle/paddle:latest-dev` to create Docker container, /bin/bash start the /bin/bash command after entering the container.
> Note: hub.baidubce.com/paddlepaddle/paddle:latest-dev internally install CUDA 8.0.
> `--name paddle-test` names the Docker container you created as paddle-test, `-v $PWD:/paddle` mounts the current directory to the /paddle directory in the Docker container (the PWD variable in Linux will expand to the current [Absolute path](https://baike.baidu.com/item/%E7%BB%9D%E5%AF%B9%E8%B7%AF%E5%BE%84/481185)), `-it` keeps interacting with the host, `hub.baidubce.com/paddlepaddle/paddle` creates a Docker container with an image called `hub.baidubce.com/paddlepaddle/paddle:latest-dev`, /bin/bash enters the container After starting the `/bin/bash` command.
4. After entering Docker, go to the paddle directory: `cd paddle` 4. After entering Docker, go to the paddle directory: `cd paddle`
5. Switch to a more stable version to compile: 5. Switch to a more stable version to compile:
`git checkout v1.1` `git checkout [name of the branch]`
For example:
`git checkout release/1.5`
Note: python3.6、python3.7 version started supporting from release/1.2 branch
6. Create and enter the /paddle/build path: 6. Create and enter the /paddle/build path:
`mkdir -p /paddle/build && cd /paddle/build` `mkdir -p /paddle/build && cd /paddle/build`
7. Use the following command to install the dependencies: (For Python3: Please select the pip for the python version you wish to use, such as pip3.5, pip3.6) 7. Use the following command to install the dependencies:
For Python2: pip install protobuf==3.1.0 For Python2: pip install protobuf
For Python3: pip3.5 install protobuf==3.1.0 For Python3: pip3.5 install protobuf
Note: We used Python3.5 command as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
> Install protobuf 3.1.0 > Install protobuf 3.1.0
...@@ -65,12 +126,16 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad ...@@ -65,12 +126,16 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad
8. Execute cmake: 8. Execute cmake:
> For details on the compilation options, see the [compilation options table](../Tables.html/#Compile). > For details on the compilation options, see the [compilation options table](../Tables.html/#Compile).
> Please attention to modify parameters `-DPY_VERSION` for the version of Python you want to compile with, for example `-DPY_VERSION=3.5` means the version of python is 3.5.x
* For users who need to compile the **CPU version PaddlePaddle**: * For users who need to compile the **CPU version PaddlePaddle**:
`cmake .. -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release` `cmake .. -DPY_VERSION=3.5 -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release`
> We currently do not support the compilation of the GPU version PaddlePaddle under CentOS. * For users who need to compile the **GPU version PaddlePaddle**:
`cmake .. -DPY_VERSION=3.5 -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release`
> We currently do not support the compilation of the GPU version PaddlePaddle under CentOS 6.
9. Execute compilation: 9. Execute compilation:
...@@ -80,30 +145,23 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad ...@@ -80,30 +145,23 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad
10. After compiling successfully, go to the `/paddle/build/python/dist` directory and find the generated `.whl` package: `cd /paddle/build/python/dist` 10. After compiling successfully, go to the `/paddle/build/python/dist` directory and find the generated `.whl` package: `cd /paddle/build/python/dist`
11. Install the compiled `.whl` package on the current machine or target machine: (For Python3: Please select the pip corresponding to the python version you wish to use, such as pip3.5, pip3.6) 11. Install the compiled `.whl` package on the current machine or target machine:
For Python2: pip install (whl package name) For Python2: pip install -U (whl package name)
For Python3: pip3.5 install (whl package name) For Python3: pip3.5 install -U (whl package name)
Note: For the command involving Python 3, we use Python 3.5 as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
Now that you have successfully installed PaddlePaddle using Docker, you only need to run PaddlePaddle after entering the Docker container. For more Docker usage, please refer to the [official Docker documentation](https://docs.docker.com/). Congratulations, now that you have successfully installed PaddlePaddle using Docker, you only need to run PaddlePaddle after entering the Docker container. For more Docker usage, please refer to the [official Docker documentation](https://docs.docker.com/).
> Notes: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container. > Note: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container.
Congratulations, you have now completed the process of compiling PaddlePaddle using Docker.
<br/><br/>
### *Local compilation*
**Please strictly follow the order of the following instructions**
<a name="ct_source"></a>
### **Local compilation**
1. Check that your computer and operating system meet the compilation standards we support: `uname -m && cat /etc/*release` 1. Check that your computer and operating system meet the compilation standards we support: `uname -m && cat /etc/*release`
2. Update the source of `yum`: `yum update`, and add the necessary yum source: `yum install -y epel-release`, and install openCV in advance 2. Update the source of `yum`: `yum update`, and add the necessary yum source: `yum install -y epel-release`, and install [OpenCV](https://opencv.org/releases.html) in advance
3. Install the necessary tools `bzip2` and `make`: `yum install -y bzip2 `, `yum install -y make` 3. Install the necessary tools `bzip2` and `make`: `yum install -y bzip2 `, `yum install -y make`
...@@ -143,11 +201,12 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -143,11 +201,12 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
3. Find `virtualenvwrapper.sh`: `find / -name virtualenvwrapper.sh` (please find the corresponding Python version of `virtualenvwrapper.sh`) 3. Find `virtualenvwrapper.sh`: `find / -name virtualenvwrapper.sh` (please find the corresponding Python version of `virtualenvwrapper.sh`)
4. See the installation method in `virtualenvwrapper.sh`: `cat vitualenvwrapper.sh` 4. See the installation method in `virtualenvwrapper.sh`: `cat vitualenvwrapper.sh`, this shell file describes the steps and commands
5. Install `virtualwrapper` 5. Install `virtualwrapper` as described in `virtualenvwrapper.sh`
6. Create a virtual environment called `paddle-venv`: `mkvirtualenv paddle-venv` 6. Set VIRTUALENVWRAPPER_PYTHON:`export VIRTUALENVWRAPPER_PYTHON=[python-lib-path]:$PATH` (here replace the last two levels content of [python-lib-path] with /bin/)
7. Create virtual environment named `paddle-venv`: `mkvirtualenv paddle-venv`
5. Enter the virtual environment: `workon paddle-venv` 5. Enter the virtual environment: `workon paddle-venv`
...@@ -156,7 +215,7 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -156,7 +215,7 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
* Here is the installation method for `patchELF`. Other dependencies can be installed using `yum install` or `pip install`/`pip3 install` followed by the name and version: * Here is the installation method for `patchELF`. Other dependencies can be installed using `yum install` or `pip install`/`pip3 install` followed by the name and version:
`yum install patchelf` `yum install patchelf`
> Users who can't use apt installation can refer to patchElF [github official documentation](https://gist.github.com/ruario/80fefd174b3395d34c14). > Users who can't use apt installation can refer to patchElF github [official documentation](https://gist.github.com/ruario/80fefd174b3395d34c14).
7. Put the PaddlePaddle source cloned in the Paddle folder in the current directory and go to the Paddle directory: 7. Put the PaddlePaddle source cloned in the Paddle folder in the current directory and go to the Paddle directory:
...@@ -166,7 +225,11 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -166,7 +225,11 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
8. Switch to a more stable release branch for compilation (support for Python 3.6 and 3.7 is added from the 1.2 branch): 8. Switch to a more stable release branch for compilation (support for Python 3.6 and 3.7 is added from the 1.2 branch):
- `git checkout release/1.2` - `git checkout [name of target branch]`
For example:
`git checkout release/1.5`
9. And please create and enter a directory called build: 9. And please create and enter a directory called build:
...@@ -179,30 +242,57 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -179,30 +242,57 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
* For users who need to compile the **CPU version PaddlePaddle**: * For users who need to compile the **CPU version PaddlePaddle**:
For Python2: cmake .. -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release For Python2: cmake .. -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
For Python3: cmake .. -DPY_VERSION=3.5 -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIRS} \ For Python3: cmake .. -DPY_VERSION=3.5 -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIRS} \
-DPYTHON_LIBRARY=${PYTHON_LIBRARY} -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARY=${PYTHON_LIBRARY} -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
> If you encounter `Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)`, you can re-execute the cmake command. > If you encounter `Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)`, you can re-execute the cmake command.
> Please note that the PY_VERSION parameter is replaced with the python version you need. > Please note that the PY_VERSION parameter is replaced with the python version you need.
* For users who need to compile the **GPU version PaddlePaddle**:
1. Please make sure that you have installed nccl2 correctly, or install nccl2 according to the following instructions (here is ubuntu 16.04, CUDA9, ncDNN7 nccl2 installation instructions), for more information on the installation information please refer to the [NVIDIA official website](https://developer.nvidia.com/nccl/nccl-download):
i. `wget http://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm`
ii. `rpm -i nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm`
iii. `yum install -y libnccl-2.3.7-2+cuda9.0 libnccl-devel-2.3.7-2+cuda9.0 libnccl-static-2.3.7-2+cuda9.0`
2. If you have already installed `nccl2` correctly, you can start cmake: *(For Python3: Please configure the correct python version for the PY_VERSION parameter)*
For Python2: cmake .. -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
For Python3: cmake .. -DPYTHON_EXECUTABLE:FILEPATH=[您可执行的Python3的路径] -DPYTHON_INCLUDE_DIR:PATH=[之前的PYTHON_INCLUDE_DIRS] -DPYTHON_LIBRARY:FILEPATH=[之前的PYTHON_LIBRARY] -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
Note: For the command involving Python 3, we use Python 3.5 as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
11. Compile with the following command: 11. Compile with the following command:
`make -j$(nproc)` `make -j$(nproc)`
> Use multicore compilation
> If “Too many open files” error is displayed during compilation, please use the instruction ulimit -n 8192 to increase the number of files allowed to be opened by the current process. Generally speaking, 8192 can ensure the completion of compilation.
12. After compiling successfully, go to the `/paddle/build/python/dist `directory and find the generated `.whl` package: `cd /paddle/build/python/dist` 12. After compiling successfully, go to the `/paddle/build/python/dist `directory and find the generated `.whl` package: `cd /paddle/build/python/dist`
13. Install the compiled `.whl` package on the current machine or target machine: 13. Install the compiled `.whl` package on the current machine or target machine:
`Pip install (whl package name) `or `pip3 install (whl package name)` `Pip install -U (whl package name) `or `pip3 install -U (whl package name)`
Congratulations, now you have completed the process of compiling PaddlePaddle natively. Congratulations, now you have completed the process of compiling PaddlePaddle natively.
<br/><br/> <br/><br/>
### ***Verify installation*** ### ***Verify installation***
After the installation is complete, you can use `python` to enter the Python interpreter and then use `import paddle.fluid` to verify that the installation was successful. After the installation is complete, you can use `python` or `python3` to enter the Python interpreter and then use `import paddle.fluid as fluid` and then `fluid.install_check.run_check()` to verify that the installation was successful.
If `Your Paddle Fluid is installed succesfully!` appears, it means the installation was successful.
<br/><br/> <br/><br/>
### ***How to uninstall*** ### ***How to uninstall***
...@@ -210,3 +300,6 @@ After the installation is complete, you can use `python` to enter the Python int ...@@ -210,3 +300,6 @@ After the installation is complete, you can use `python` to enter the Python int
Please use the following command to uninstall PaddlePaddle (users who use Docker to install PaddlePaddle should use the following command in the container containing PaddlePaddle. Please use the corresponding version of pip): Please use the following command to uninstall PaddlePaddle (users who use Docker to install PaddlePaddle should use the following command in the container containing PaddlePaddle. Please use the corresponding version of pip):
* ***CPU version of PaddlePaddle***: `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle` * ***CPU version of PaddlePaddle***: `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle`
* ***GPU version of PaddlePaddle***: `pip uninstall paddlepaddle-gpu` or `pip3 uninstall paddlepaddle-gpu`
Users installing PaddlePaddle with Docker, please use above commands in the container involved PaddlePaddle and attention to use the corresponding version of Pip
***
# **Compile on MacOS from Source Code** # **Compile on MacOS from Source Code**
This instruction will show you how to compile PaddlePaddle on *64-bit desktops or laptops* and MacOS systems. The MacOS systems we support need to meet the following requirements: ## Environment preparation
* MacOS 10.12/10.13/10.14 (this involves whether the related tools can be installed normally) * **MacOS version 10.11/10.12/10.13/10.14 (64 bit) (not support GPU version)**
* **Python version 2.7.15+/3.5.1+/3.6/3.7 (64 bit)**
* **pip or pip3 version 9.0.1+ (64 bit)**
## Determine which version to compile ## Choose CPU/GPU
* **Only PaddlePaddle for CPU is supported.** * Currently, only PaddlePaddle for CPU is supported.
## Choose a compilation method ## Installation steps
There are two compilation methods in MacOS system:
Under the MacOS 10.12/10.13/10.14 system we offer 2 ways to compile: * Compile with docker
* Local compilation
* Docker source compilation (this image already contains python2.7, python3.6, python3.7 environment) <a name="mac_docker"></a>
* Direct source code compilation ### ***Compile with Docker***
We recommend **using Docker for compilation** because we are installing both the tools and the configuration in a Docker image. This way, if you encounter problems, others can reproduce the problem to help. In addition, for developers accustomed to using Windows and MacOS, there is no need to configure a cross-compilation environment using Docker. It should be emphasized that Docker does not virtualize any hardware. The compiler tools running in the Docker container are actually running directly on the native CPU and operating system. The performance is the same as installing the compiler on the machine.
Also for those who can't install Docker for a variety of reasons, we also provide a way to **compile directly from local sources**, but since the situation on this machine is more complicated, we only support specific systems. [Docker](https://docs.docker.com/install/) is an open source application container engine. Using docker, you can not only isolate the installation and use of paddlepaddle from the system environment, but also share GPU, network and other resources with the host
<br/><br/> Compiling PaddlePaddle with Docker,you need:
### ***Compile with Docker***
In order to better use Docker and avoid problems, we recommend using **the highest version of Docker**. For details on **installing and using Docker**, please refer to the [official Docker documentation](https://docs.docker.com/install/). - On the local host [Install Docker](https://hub.docker.com/search/?type=edition&offering=community)
> Please note that running Docker on MacOS requires logging in with your dockerID, otherwise an Authenticate Failed error will occur. - Log in to Docker with Docker ID to avoid `Authenticate Failed` error
Once you have **properly installed Docker**, you can start **compiling PaddlePaddle with Docker**: Please follow the steps below to install:
1. Enter the terminal of the Mac 1. Enter the terminal of the Mac
...@@ -38,27 +37,40 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad ...@@ -38,27 +37,40 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad
3. Go to the Paddle directory: `cd Paddle` 3. Go to the Paddle directory: `cd Paddle`
4. Take advantage of the image we provided (with this command you don't have to download the image in advance): 4. Create and enter a Docker container that meets the compilation environment:
`docker run --name paddle-test -v $PWD:/paddle --network=host -it` `hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash` `docker run --name paddle-test -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash`
> --name paddle-test Name the Docker container you created as paddle-test, -v $PWD:/paddle mount the current directory to the /paddle directory in the Docker container (the PWD variable in Linux will expand to the current path's [Absolute path](https://baike.baidu.com/item/绝对路径/481185)), -it keeps interacting with the host, `hub.baidubce.com/paddlepaddle/paddle:latest-dev` creates a Docker container with a mirror named `hub.baidubce.com/paddlepaddle/paddle:latest-dev`, /bin /bash starts the /bin/bash command after entering the container. > --name paddle-test name the Docker container you created as paddle-test,
5. After entering Docker, go to the paddle directory: `cd paddle` > -v $PWD:/paddle mount the current directory to the /paddle directory in the Docker container (the PWD variable in Linux will expand to the current path's [Absolute path](https://baike.baidu.com/item/绝对路径/481185)),
> -it keeps interacting with the host, `hub.baidubce.com/paddlepaddle/paddle:latest-dev` creates a Docker container with a mirror named `hub.baidubce.com/paddlepaddle/paddle:latest-dev`, /bin /bash starts the /bin/bash command after entering the container.
5. After entering Docker, go to the paddle directory:
`cd paddle`
6. Switch to a more stable version to compile: 6. Switch to a more stable version to compile:
`git checkout v1.1` `git checkout [name of the branch]`
For example:
`git checkout release/1.5`
Note: python3.6、python3.7 version started supporting from release/1.2 branch
7. Create and enter the /paddle/build path: 7. Create and enter the /paddle/build path:
`mkdir -p /paddle/build && cd /paddle/build` `mkdir -p /paddle/build && cd /paddle/build`
8. Use the following command to install the dependencies: (For Python3: Please select the pip for the python version you wish to use, such as pip3.5, pip3.6) 8. Use the following command to install the dependencies:
For Python2: pip install protobuf==3.1.0
For Python3: pip3.5 install protobuf==3.1.0
For Python2: pip install protobuf==3.1.0 Note: We used Python3.5 command as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
For Python3: pip3.5 install protobuf==3.1.0
> Install protobuf 3.1.0. > Install protobuf 3.1.0.
...@@ -69,12 +81,13 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad ...@@ -69,12 +81,13 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad
9. Execute cmake: 9. Execute cmake:
> For details on the compilation options, see the [compilation options table](../Tables_en.html/#Compile). > For details on the compilation options, see the [compilation options table](../Tables_en.html/#Compile).
> Please attention to modify parameters `-DPY_VERSION` for the version of Python you want to compile with, for example `-DPY_VERSION=3.5` means the version of python is 3.5.x
* For users who need to compile the **CPU version PaddlePaddle**: * For users who need to compile the **CPU version PaddlePaddle**:
`cmake .. -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release` `cmake .. -DPY_VERSION=3.5 -DWITH_GPU=OFF -DWITH_TESTING=OFF -DWITH_AVX=OFF -DCMAKE_BUILD_TYPE=Release`
> We currently do not support the compilation of the GPU version PaddlePaddle under CentOS. > We currently do not support the compilation of the GPU version PaddlePaddle under CentOS.
10. Execute compilation: 10. Execute compilation:
...@@ -87,23 +100,22 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad ...@@ -87,23 +100,22 @@ Once you have **properly installed Docker**, you can start **compiling PaddlePad
12. Install the compiled `.whl` package on the current machine or target machine: (For Python3: Please select the pip corresponding to the python version you wish to use, such as pip3.5, pip3.6) 12. Install the compiled `.whl` package on the current machine or target machine: (For Python3: Please select the pip corresponding to the python version you wish to use, such as pip3.5, pip3.6)
For Python2: pip install (whl package name) For Python2: pip install -U (whl package name)
For Python3: pip3.5 install (whl package name) For Python3: pip3.5 install -U (whl package name)
Note: We used Python3.5 command as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
Now that you have successfully installed PaddlePaddle using Docker, you only need to run PaddlePaddle after entering the Docker container. For more Docker usage, please refer to the [official Docker documentation](https://docs.docker.com/). Congratulations, now that you have successfully installed PaddlePaddle using Docker, you only need to run PaddlePaddle after entering the Docker container. For more Docker usage, please refer to the [official Docker documentation](https://docs.docker.com/).
> Note: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container. > Note: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container.
Congratulations, you have now completed the process of compiling PaddlePaddle using Docker. <a name="mac_source"></a>
<br/><br/> <br/><br/>
### ***Native compilation*** ### ***Local compilation***
**Please strictly follow the order of the following instructions** **Please strictly follow the order of the following instructions**
1. Check that your computer and operating system meet our supported compilation standards: `uname -m` and view the system version `about this Mac`. And install openCV in advance. 1. Check that your computer and operating system meet our supported compilation standards: `uname -m` and view the system version `about this Mac`. And install [OpenCV](https://opencv.org/releases.html) in advance.
2. Install python and pip: 2. Install python and pip:
...@@ -132,7 +144,7 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -132,7 +144,7 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
- d. Set PYTHON_INCLUDE_DIR: `export PYTHON_INCLUDE_DIRS=[python-include-path]` - d. Set PYTHON_INCLUDE_DIR: `export PYTHON_INCLUDE_DIRS=[python-include-path]`
- e. Set the system environment variable path: `export PATH=[python-bin-path]:$PATH` (here [python-bin-path] is the result of replacing the last two levels of [python-lib-path] with the path after /bin/ ) - e. Set the system environment variable path: `export PATH=[python-bin-path]:$PATH` (here [python-bin-path] is the result of replacing the last two levels of [python-lib-path] with the path after /bin/)
- f. Set the dynamic library link: `export LD_LIBRARY_PATH=[python-ld-path]` and `export DYLD_LIBRARY_PATH=[python-ld-path]` (here [python-ld-path] is the [python-bin-path]'s parent directory ) - f. Set the dynamic library link: `export LD_LIBRARY_PATH=[python-ld-path]` and `export DYLD_LIBRARY_PATH=[python-ld-path]` (here [python-ld-path] is the [python-bin-path]'s parent directory )
...@@ -161,7 +173,13 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -161,7 +173,13 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
7. Switch to a more stable release branch to compile: (Note that python 3.6, python 3.7 version are supported from the 1.2 branch) 7. Switch to a more stable release branch to compile: (Note that python 3.6, python 3.7 version are supported from the 1.2 branch)
`git checkout release/1.2` `git checkout [name of the branch]`
For example:
`git checkout release/1.5`
Note: python3.6、python3.7 version started supporting from release/1.2 branch
8. And please create and enter a directory called build: 8. And please create and enter a directory called build:
...@@ -175,8 +193,8 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -175,8 +193,8 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
For Python2: cmake .. -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release For Python2: cmake .. -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
For Python3: cmake .. -DPY_VERSION=3.5 -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIRS} \-DPYTHON_LIBRARY=${PYTHON_LIBRARY} -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release For Python3: cmake .. -DPY_VERSION=3.5 -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIRS} \
-DPYTHON_LIBRARY=${PYTHON_LIBRARY} -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
> ``-DPY_VERSION=3.5`` Please change to the Python version of the installation environment. > ``-DPY_VERSION=3.5`` Please change to the Python version of the installation environment.
...@@ -188,7 +206,7 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -188,7 +206,7 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
12. Install the compiled `.whl` package on the current machine or target machine: 12. Install the compiled `.whl` package on the current machine or target machine:
`pip install (whl package name)` or `pip3 install (whl package name)` `pip install -U (whl package name)` or `pip3 install -U (whl package name)`
> If you have multiple python environments and pips installed on your computer, please see the [FAQ](../Tables.html/#MACPRO). > If you have multiple python environments and pips installed on your computer, please see the [FAQ](../Tables.html/#MACPRO).
...@@ -197,7 +215,9 @@ Congratulations, now you have completed the process of compiling PaddlePaddle us ...@@ -197,7 +215,9 @@ Congratulations, now you have completed the process of compiling PaddlePaddle us
<br/><br/> <br/><br/>
### ***Verify installation*** ### ***Verify installation***
After the installation is complete, you can use `python` to enter the Python interpreter and then use `import paddle.fluid` to verify that the installation was successful. After the installation is complete, you can use `python` or `python3` to enter the Python interpreter and then use `import paddle.fluid as fluid` and then `fluid.install_check.run_check()` to verify that the installation was successful.
If `Your Paddle Fluid is installed succesfully!` appears, it means the installation was successful.
<br/><br/> <br/><br/>
### ***How to uninstall*** ### ***How to uninstall***
...@@ -205,3 +225,5 @@ After the installation is complete, you can use `python` to enter the Python int ...@@ -205,3 +225,5 @@ After the installation is complete, you can use `python` to enter the Python int
Please use the following command to uninstall PaddlePaddle (users who use Docker to install PaddlePaddle should use the following command in the container containing PaddlePaddle. Please use the corresponding version of pip): Please use the following command to uninstall PaddlePaddle (users who use Docker to install PaddlePaddle should use the following command in the container containing PaddlePaddle. Please use the corresponding version of pip):
* ***CPU version of PaddlePaddle***: `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle` * ***CPU version of PaddlePaddle***: `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle`
Users installing PaddlePaddle with Docker, please use above commands in the container involved PaddlePaddle and attention to use the corresponding version of Pip
***
# **Compile on Ubuntu from Source Code** # **Compile on Ubuntu from Source Code**
This instruction describes how to compile PaddlePaddle on *64-bit desktops or laptops* and Ubuntu systems. The Ubuntu systems we support must meet the following requirements: ## Environment preparation
* Ubuntu 14.04/16.04/18.04 (this involves whether the related tools can be installed successfully) * **Ubuntu version (64 bit)**
* **Ubuntu 14.04 (GPU version supports CUDA 10.0/10.1)**
* **Ubuntu 16.04 (GPU version supports CUDA 9.0/9.1/9.2/10.0/10.1)**
* **Ubuntu 18.04 (GPU version supports CUDA 10.0/10.1)**
* **Python version 2.7.15+/3.5.1+/3.6/3.7 (64 bit)**
* **pip or pip3 version 9.0.1+ (64 bit)**
## Determine which version to compile ## Choose CPU/GPU
* **CPU version of PaddlePaddle**, if your system does not have an NVIDIA® GPU, you must install this version. This version is easier than the GPU version. So even if you have a GPU on your computer, we recommend that you first install the CPU version of PaddlePaddle to check if your local environment is suitable. * If your computer doesn't have NVIDIA® GPU, please install CPU version of PaddlePaddle
* **GPU version of PaddlePaddle**, in order to make the PaddlePaddle program run more quickly, we usually use the GPU to accelerate the PaddlePaddle program, but the GPU version of PaddlePaddle needs to have the NVIDIA® GPU that meets the following conditions (see NVIDIA for the specific installation process and configuration). Official documentation: [For CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/), For [cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/)) * If your computer has NVIDIA® GPU, and the following conditions are met,GPU version of PaddlePaddle is recommended.
* **CUDA toolkit 10.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **CUDA toolkit 9.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **CUDA toolkit 8.0 with cuDNN v7.1+(for multi card support, NCCL2.1.15-2.2.13)**
* **Hardware devices with GPU computing power over 1.0**
* *CUDA Toolkit 9.0 with cuDNN v7* You can refer to NVIDIA official documents for installation process and configuration method of CUDA and cudnn. Please refer to[CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/),[cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/)
* *CUDA Toolkit 8.0 with cuDNN v7*
* *Hardware devices with GPU compute capability exceeding 1.0*
## Choose a compilation method * * If you need to use multi card environment, please make sure that you have installed nccl2 correctly, or install nccl2 according to the following instructions (here is the installation instructions of nccl2 under ubuntu 16.04, CUDA9 and cuDNN7). For more version of installation information, please refer to NVIDIA[official website](https://developer.nvidia.com/nccl):
Under Ubuntu's system we offer 2 ways to compile:
* Docker source compilation (this image already contains python2.7, python3.6, python3.7 environment) wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
dpkg -i nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt-get install -y libnccl2=2.3.7-1+cuda9.0 libnccl-dev=2.3.7-1+cuda9.0
* Direct native source code compilation (does not support GPU version under ubuntu18.04) ## Installation steps
We recommend using **Docker for compilation** because we are installing both the tools and the configuration in a Docker image. This way, if you encounter problems, others can reproduce the problem to help. In addition, for developers accustomed to using Windows and MacOS, there is no need to configure a cross-compilation environment using Docker. Someone uses a virtual machine to analogize to Docker. It should be emphasized that Docker does not virtualize any hardware. The compiler tools running in the Docker container are actually running directly on the native CPU and operating system. The performance is the same as installing the compiler on the machine. There are two compilation methods in Ubuntu system:
We also provide methods that can be **compiled from local source code**, but since the situation on host machine is more complicated, we only provide support for specific systems. * Compile with docker (GPU version under Ubuntu 18.04 is not supported temporarily)
* Local compilation
<br/><br/> <a name="ubt_docker"></a>
## ***Compile with Docker*** ### **Compile with docker**
[Docker](https://docs.docker.com/install/) is an open source application container engine. Using docker, you can not only isolate the installation and use of paddlepaddle from the system environment, but also share GPU, network and other resources with the host
Compiling PaddlePaddle with Docker,you need:
In order to better use Docker and avoid problems, we recommend using **the highest version of Docker**. For details on **installing and using Docker**, please refer to [the official Docker documentation](https://docs.docker.com/install/). - On the local host [Install Docker](https://hub.docker.com/search/?type=edition&offering=community)
> Please note that to install and use the PaddlePaddle version that supports GPU, you must first install nvidia-docker - To enable GPU support on Linux, please [Install nvidia-docker](https://github.com/NVIDIA/nvidia-docker)
Once you have **properly installed Docker**, you can start **compiling PaddlePaddle with Docker**: Please follow the steps below to install:
1. First select the path where you want to store PaddlePaddle, then use the following command to clone PaddlePaddle's source code from github to a folder named Paddle in the local current directory: 1. First, select the path where you want to store PaddlePaddle, and then use the following command to clone the source code of PaddlePaddle from GitHub to the folder named Paddle under the current local directory:
`git clone https://github.com/PaddlePaddle/Paddle.git` `git clone https://github.com/PaddlePaddle/Paddle.git`
2. Go to the Paddle directory: `cd Paddle` 2. Enter the Paddle Directory: `cd Paddle`
3. Create and enter a Docker container that meets the compilation environment:
* Compile CPU version of PaddlePaddle:
`docker run --name paddle-test -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash`
> --name paddle-test names the Docker container you created as paddle-test;
> -v $PWD:/paddle mount the current directory to the /paddle directory in the docker container (PWD variable in Linux will be expanded to [absolute path](https://baike.baidu.com/item/绝对路径/481185) of the current path);
> -it keeps interaction with the host,`hub.baidubce.com/paddlepaddle/paddle:latest-dev` use the image named `hub.baidubce.com/paddlepaddle/paddle:latest-dev` to create Docker container, /bin/bash start the /bin/bash command after entering the container.
* Compile GPU version of PaddlePaddle:
`nvidia-docker run --name paddle-test -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash`
> --name paddle-test names the Docker container you created as paddle-test;
3. Take advantage of the image we provided (with this command you don't have to download the image in advance):
`docker run --name paddle-test -v $PWD:/paddle --network=host -it hub.baidubce.com/paddlepaddle/paddle:latest-dev /bin/bash` > -v $PWD:/paddle mount the current directory to the /paddle directory in the docker container (PWD variable in Linux will be expanded to [absolute path](https://baike.baidu.com/item/绝对路径/481185) of the current path);
> --name paddle-test names the Docker container you created as paddle-test, -v $PWD:/paddle mounts the current directory to the /paddle directory in the Docker container (the PWD variable in Linux will expand to the current path's [absolute path](https://baike.baidu.com/item/%E7%BB%9D%E5%AF%B9%E8%B7%AF%E5%BE%84/481185)), -it keeps interacting with the host, `hub.baidubce.com/paddlepaddle/paddle:latest-dev` creates a Docker container with a mirror named `hub.baidubce.com/paddlepaddle/paddle:latest-dev`, /bin /bash Starts the /bin/bash command after entering the container.
4. After entering Docker, go to the paddle directory: `cd paddle` > -it keeps interaction with the host,`hub.baidubce.com/paddlepaddle/paddle:latest-dev` use the image named `hub.baidubce.com/paddlepaddle/paddle:latest-dev` to create Docker container, /bin/bash start the /bin/bash command after entering the container.
5. Switch to a more stable release branch to compile: (Note that python 3.6, python 3.7 version are supported from the 1.2 branch)
`git checkout release/1.2` > Note: hub.baidubce.com/paddlepaddle/paddle:latest-dev internally install CUDA 8.0.
6. Create and enter the /paddle/build path: 4. After entering Docker, enter the Paddle Directory:
`cd paddle`
5. Switch to a more stable release branch for compilation:
`git checkout [name of the branch]`
For example:
`git checkout release/1.5`
Note: python3.6、python3.7 version started supporting from release/1.2 branch
6. Create and enter /paddle/build Directory:
`mkdir -p /paddle/build && cd /paddle/build` `mkdir -p /paddle/build && cd /paddle/build`
7. Use the following command to install the dependencies: (For Python3: Please select the pip for the python version you wish to use, such as pip3.5, pip3.6) 7. Use the following command to install dependencies:
For Python2: pip install protobuf==3.1.0 For Python2: pip install protobuf
For Python3: pip3.5 install protobuf==3.1.0 For Python3: pip3.5 install protobuf
Note: We used Python3.5 command as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
> Install protobuf 3.1.0. > Install protobuf
`apt install patchelf` `apt install patchelf`
> Installing patchelf, PatchELF is a small and useful program for modifying the dynamic linker and RPATH of ELF executables. > Install patchelf
This is a small but useful program, it can be used to modify dynamic linker and RPATH of ELF executable
8. Execute cmake: 8. Execute cmake
> For the meaning of the specific compiling options, [compilation options table](../Tables.html/#Compile) is your resort. Please note that the parameter `-DPY_VERSION` is the python version used in your current environment. > For the specific meaning of compilation options, you can read [Compile options table](../Tables.html#Compile)
* For users who need to compile the **CPU version PaddlePaddle**: > Please attention to modify parameters `-DPY_VERSION` for the version of Python you want to compile with, for example `-DPY_VERSION=3.5` means the version of python is 3.5.x
`cmake .. -DPY_VERSION=3.5 -DWITH_FLUID_ONLY=ON -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release` * Compile**CPU version of PaddlePaddle**:
* For users who need to compile the **GPU version PaddlePaddle**: `cmake .. -DPY_VERSION=3.5 -DWITH_GPU=OFF -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release`
`cmake .. -DPY_VERSION=3.5 -DWITH_FLUID_ONLY=ON -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release` * Compile**GPU version of PaddlePaddle**:
9. Execute compilation: `cmake .. -DPY_VERSION=3.5 -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release`
9. Execute compiling:
`make -j$(nproc)` `make -j$(nproc)`
> Use multicore compilation > Use multicore compilation
10. After compiling successfully, go to the `/paddle/build/python/dist` directory and find the generated `.whl` package: `cd /paddle/build/python/dist` 10. after compiling successful, enter `/paddle/build/python/dist` Directory and find generated `.whl` package: `cd /paddle/build/python/dist`
11. Install the compiled `.whl` package on the current machine or target machine: (For Python3: Please select the pip corresponding to the python version you wish to use, such as pip3.5, pip3.6) 11. Install the compiled `.whl` package on the current machine or target machine:
For Python2: pip install (whl package name) For Python2: pip install -U(whl package name)
For Python3: pip3.5 install (whl package name) For Python3: pip3.5 install -U(whl package name)
Note: For the command involving Python 3, we use Python 3.5 as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
Now that you have successfully installed PaddlePaddle using Docker, you only need to run PaddlePaddle after entering the Docker container. For more Docker usage, please refer to the [official Docker documentation](https://docs.docker.com/). Congratulations, now you have completed the compilation and installation of PaddlePaddle. You only need to enter the Docker container and run PaddlePaddle to start using. For more Docker usage, please refer to [official docker documentation](https://docs.docker.com)
> Note: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container. > Note: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container.
Congratulations, you have now completed the process of compiling PaddlePaddle using Docker. <a name="ubt_source"></a>
<br/><br/>
### ***Local compilation*** ### ***Local compilation***
**Please strictly follow the following instructions step by step** **Please strictly follow the following instructions step by step**
...@@ -114,26 +164,29 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -114,26 +164,29 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
3. We support compiling and installing with virtualenv. First, create a virtual environment called `paddle-venv` with the following command: 3. We support compiling and installing with virtualenv. First, create a virtual environment called `paddle-venv` with the following command:
* a. Install Python-dev: (Please install python3.x-dev that matches the current environment python version) * a. Install Python-dev: (Please note that gcc4.8 is not supported in python2.7 under Ubuntu 16.04, please use gcc5.4 to compile Paddle)
For Python2: apt install python-dev For Python2: apt install python-dev
For Python3: apt install python3.5-dev For Python3: apt install python3.5-dev
* b. Install pip: (Please ensure that pip version is 9.0.1 and above ): (Please note that the version corresponding to python3 is modified) * b. Install pip: (Please ensure that pip version is 9.0.1 and above ):
For Python2: apt install python-pip For Python2: apt install python-pip
For Python3: apt-get udpate && apt-get install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt install curl && curl https://bootstrap.pypa.io/get-pip. Py -o - | python3.5 && easy_install pip For Python3: apt-get udpate && apt-get install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt install curl && curl https://bootstrap.pypa.io/get-pip. Py -o - | python3.5 && easy_install pip
* c. Install the virtual environment `virtualenv` and `virtualenvwrapper` and create a virtual environment called `paddle-venv` (please note the python version) : * c. Install the virtual environment `virtualenv` and `virtualenvwrapper` and create a virtual environment called `paddle-venv` :
1. `apt install virtualenv` or `pip install virtualenv` or `pip3 install virtualenv` 1. `apt install virtualenv` or `pip install virtualenv` or `pip3 install virtualenv`
2. `apt install virtualenvwrapper` or `pip install virtualenvwrapper` or `pip3 install virtualenvwrapper` 2. `apt install virtualenvwrapper` or `pip install virtualenvwrapper` or `pip3 install virtualenvwrapper`
3. Find `virtualenvwrapper.sh`: `find / -name virtualenvwrapper.sh` 3. Find `virtualenvwrapper.sh`: `find / -name virtualenvwrapper.sh`
4. (Only for Python3) Set the interpreter path for the virtual environment: `export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.5` 4. (Only for Python3) Set the interpreter path for the virtual environment: `export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.5`
5. See the installation method in `virtualenvwrapper.sh`: `cat virtualenvwrapper.sh` 5. See the installation method in `virtualenvwrapper.sh`: `cat virtualenvwrapper.sh`, this shell file describes the steps and commands
6. Install `virtualwrapper` according to the installation method in `virtualenvwrapper.sh` 6. Install `virtualwrapper` according to the installation method in `virtualenvwrapper.sh`
7. Create a virtual environment called `paddle-venv`: `mkvirtualenv paddle-venv` 7. Set VIRTUALENVWRAPPER_PYTHON:`export VIRTUALENVWRAPPER_PYTHON=[python-lib-path]:$PATH` (Here, replace the last two directories of [python-lib-path] with /bin/)
8. Create a virtual environment called `paddle-venv`: `mkvirtualenv paddle-venv`
Note: for the above commands involving Python 3, we use Python 3.5 as an example. If your Python version is 3.6 / 3.7, please change Python 3.5 in the above commands to Python 3.6 / Python 3.7
4. Enter the virtual environment: `workon paddle-venv` 4. Enter the virtual environment: `workon paddle-venv`
...@@ -155,6 +208,10 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -155,6 +208,10 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
- `git checkout [name of target branch]` - `git checkout [name of target branch]`
For example:
`git checkout release/1.5`
8. And please create and enter a directory called build: 8. And please create and enter a directory called build:
`mkdir build && cd build` `mkdir build && cd build`
...@@ -185,12 +242,16 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us ...@@ -185,12 +242,16 @@ Congratulations, you have now completed the process of compiling PaddlePaddle us
For Python3: cmake .. -DPY_VERSION=3.5 -DWITH_FLUID_ONLY=ON -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release For Python3: cmake .. -DPY_VERSION=3.5 -DWITH_FLUID_ONLY=ON -DWITH_GPU=ON -DWITH_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
> `-DPY_VERSION=3.5` Please change to the Python version of the installation environment Note: We used Python3.5 command as an example above, if the version of your Python is 3.6/3.7, please change Python3.5 in the commands to Python3.6/Python3.7
10. Compile with the following command: 10. Compile with the following command:
`make -j$(nproc)` `make -j$(nproc)`
> compile using multi-core
> If “Too many open files” error is displayed during compilation, please use the instruction ulimit -n 8192 to increase the number of files allowed to be opened by the current process. Generally speaking, 8192 can ensure the completion of compilation.
11. After compiling successfully, go to the `/paddle/build/python/dist `directory and find the generated `.whl` package: `cd /paddle/build/python/dist` 11. After compiling successfully, go to the `/paddle/build/python/dist `directory and find the generated `.whl` package: `cd /paddle/build/python/dist`
12. Install the compiled `.whl` package on the current machine or target machine: 12. Install the compiled `.whl` package on the current machine or target machine:
...@@ -202,12 +263,16 @@ Congratulations, now you have completed the process of compiling PaddlePaddle na ...@@ -202,12 +263,16 @@ Congratulations, now you have completed the process of compiling PaddlePaddle na
<br/><br/> <br/><br/>
### ***Verify installation*** ### ***Verify installation***
After the installation is complete, you can use `python` or `python3` to enter the Python interpreter and then use `import paddle.fluid` to verify that the installation was successful. After the installation is complete, you can use `python` or `python3` to enter the Python interpreter and then use `import paddle.fluid as fluid` and then `fluid.install_check.run_check()` to verify that the installation was successful.
If `Your Paddle Fluid is installed succesfully!` appears, it means the installation was successful.
<br/><br/> <br/><br/>
### ***How to uninstall*** ### ***How to uninstall***
Please use the following command to uninstall PaddlePaddle (users who use Docker to install PaddlePaddle should use the following command in the container containing PaddlePaddle. Please use the corresponding version of pip): Please use the following command to uninstall PaddlePaddle:
- ***CPU version of PaddlePaddle***: `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle` - ***CPU version of PaddlePaddle***: `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle`
- ***GPU version of PaddlePaddle***: `pip uninstall paddlepaddle-gpu` or `pip3 uninstall paddlepaddle-gpu` - ***GPU version of PaddlePaddle***: `pip uninstall paddlepaddle-gpu` or `pip3 uninstall paddlepaddle-gpu`
Users installing PaddlePaddle with Docker, please use above commands in the container involved PaddlePaddle and attention to use the corresponding version of Pip
此差异已折叠。
***
# **Install on CentOS** # **Install on CentOS**
This note will show you how to install PaddlePaddle on a *64-bit desktop or laptop* and CentOS. The CentOS system we support needs to meet the following requirements:
Please note: Attempts on other systems may cause the installation to fail. Please ensure that your environment meets the conditions. The installation we provide by default requires your computer processor to support the AVX instruction set. Otherwise, please select the version of `no_avx` in [the latest Release installation package list](./Tables.html/#ciwhls-release).
Under CentOS you can use `cat /proc/cpuinfo | grep avx` to check if your processor supports the AVX instruction set.
* CentOS 6 / 7
## Determine which version to install
* Only PaddlePaddle for CPU is supported. If your computer does not have an NVIDIA® GPU, you can only install this version. If your computer has a GPU, it is recommended that you install the CPU version of PaddlePaddle first to check if your local environment is suitable.
* PaddlePaddle with GPU support, in order to make the PaddlePaddle program run more quickly, we accelerate the PaddlePaddle program through the GPU, but the GPU version of PaddlePaddle needs to have the NVIDIA® GPU that meets the following conditions (see the NVIDIA official for the specific installation process and configuration). Documentation: [For CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/), [For cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/))
* *CUDA Toolkit 9.0 with cuDNN v7*
* *CUDA Toolkit 8.0 with cuDNN v7*
* *Hardware devices with GPU compute capability exceeding 1.0*
## Choose an installation method ## Environmental preparation
We offer 4 installation methods under the CentOS system: * **CentOS Version(64 bit)**
* **CentOS 6 (GPU version supports CUDA 9.0/9.1/9.2/10.0/10.1, only supports single card)**
* **CentOS 7 (GPU version supports CUDA 9.0/9.1/9.2/10.0/10.1, CUDA 9.1 only supports single card)**
* **Python version 2.7.15+/3.5.1+/3.6/3.7 (64 bit)**
* **pip or pip3 version 9.0.1+ (64 bit)**
* Pip installation ### Note
* Docker installation (the GPU version is not supported) (the version of python in the image is 2.7)
* Source code compilation and installation (all versions of CentOS 6 and GPU version of CentOS 7 are not supported)
* Docker source compilation and installation (not supported for GPU version) (Python version 2.7, 3.5, 3.6, 3.7 in image)
**With pip installation** (the easiest way to install), we offer you a pip installation method, but it depends more on your native environment and may have some issues related to your local environment. * You can use`uname -m && cat /etc/*release` to view the local operating system and bit information
* Confirm that the Python where you need to install PaddlePaddle is your expected location, because your computer may have multiple Python
**Use Docker for installation** (the safest way to install), because we are installing the tools and configuration in a Docker image so that if something goes wrong, others can reproduce the problem for help. In addition, for developers accustomed to using Windows and MacOS, there is no need to configure a cross-compilation environment using Docker. It should be emphasized that Docker does not virtualize any hardware. The compiler tools running in the Docker container are actually run directly on the native CPU and operating system. The performance is the same as installing the compiler on the machine. * If you are using Python 2, use the following command to output Python path. Depending on the environment, you may need to replace Python in all command lines in the description with specific Python path
Compile and install from [**source**](#ct_source) and [**use Docker**](#ct_docker). This is a process of compiling the PaddlePaddle source code into a binary file and then installing the binary file. Compared with the binary form of PaddlePaddle that has been successfully tested and compiled for you, this manual compilation is more complicated, and we will answer you in detail at the end of this tutorial. which python
* If you are using Python 3, use the following command to output Python path. Depending on your environment, you may need to replace Python 3 in all command lines in the instructions with Python or specific Python path
<br/><br/> which python3
## ***Install PaddlePaddle using pip***
First, we use the following commands to check if **the environment of this machine** is suitable for installing PaddlePaddle: * You need to confirm whether the version of Python meets the requirements
`Uname -m && cat /etc/*release` * If you are using Python 2, use the following command to confirm that it is 2.7.15+
> The above command will display the operating system and processing bits of the machine. Please make sure your computer is consistent with the requirements of this tutorial. python --version
Second, your computer needs to meet the following requirements: * If you are using Python 3, use the following command to confirm that it is 3.5.1+/3.6/3.7
* Python2.7.x (devel), Pip >= 9.0.1 python3 --version
> CentOS6 needs to compile Python 2.7 into a [shared library](./FAQ.html/#FAQ). * It is required to confirm whether the version of pip meets the requirements. The version of pip is required to be 9.0.1+
* Python3.5+.x (devel), Pip3 >= 9.0.1 * If you are using Python 2
> You may have installed pip on your CentOS. Please use pip -V to confirm that we recommend using pip 9.0.1 or higher to install. python -m ensurepip
Update the source of yum: `yum update` and install the extension source to install pip: `yum install -y epel-release` python -m pip --version
Use the following command to install or upgrade Python and pip to the required version: * If you are using Python 3
python3 -m ensurepip
- For Python2: `sudo yum install python-devel python-pip` python3 -m pip --version
- For Python3: (Please refer to the official Python installation, and pay attention to whether the python3 version is consistent with the python version corresponding to the pip3 command. If there are multiple python3 versions, please specify the pip version such as pip3.7, or add soft link from pip3 to the python version you use. )
* You need to confirm that Python and pip are 64bit, and the processor architecture is x86_64(or called x64、Intel 64、AMD64). Currently, paddlepaddle does not support arm64 architecture. The first line below outputs "64bit", and the second line outputs "x86_64", "x64" or "AMD64":
* If you are using Python 2
python -c "import platform;print(platform.architecture()[0]);print(platform.machine())"
> Even if you already have `Python` in your environment, you need to install the `python develop` package. * If you are using Python 2
Here's how to install PaddlePaddle: python3 -c "import platform;print(platform.architecture()[0]);print(platform.machine())"
1. Use pip install to install PaddlePaddle: * The installation package provided by default requires computer support for MKL
* If you do not know the machine environment, please download and use[Quick install script](https://fast-install.bj.bcebos.com/fast_install.sh), for instructions please refer to[here](https://github.com/PaddlePaddle/FluidDoc/tree/develop/doc/fluid/beginners_guide/install/install_script.md)
* For users who need **the CPU version PaddlePaddle**: `pip install paddlepaddle` or `pip3 install paddlepaddle` ## Choose CPU/GPU
* For users who need **the GPU version PaddlePaddle**: `pip install paddlepaddle-gpu` or `pip3 install paddlepaddle-gpu` * If your computer doesn't have NVIDIA® GPU, please install the CPU version of PaddlePaddle
> 1 . In order to prevent problem "nccl.h cannot be found", please first install nccl2 according to the instructions of [NVIDIA official website](https://developer.nvidia.com/nccl/nccl-download). * If your computer has NVIDIA® GPU, please make sure that the following conditions are met and install the GPU version of PaddlePaddle
> 2 . If you do not specify the pypi package version number, we will by default provide you with a version of PaddlePaddle that supports Cuda 9/cuDNN v7. * **CUDA toolkit 10.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **CUDA toolkit 9.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **Hardware devices with GPU computing power over 1.0**
* For users with `Cannot uninstall 'six'.` problems, the probable reason is the existing Python installation issues in your system. In this case, use `pip install paddlepaddle --ignore-installed six`(CPU) or `pip install paddlepaddle-gpu -- Ignore-installed six` (GPU) to resolve. You can refer to NVIDIA official documents for installation process and configuration method of CUDA and cudnn. Please refer to [CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/),[cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/)
* For users with **other requirements**: `pip install paddlepaddle==[version number]` or `pip3 install paddlepaddle==[version number]` * 如果您需要使用多卡环境请确保您已经正确安装nccl2,或者按照以下指令安装nccl2(这里提供的是CentOS 7,CUDA9,cuDNN7下nccl2的安装指令),更多版本的安装信息请参考NVIDIA[官方网站](https://developer.nvidia.com/nccl):
> For `the version number`, please refer to [the latest Release installation package list](./Tables.html/#whls). If you need to obtain and install **the latest PaddlePaddle development branch**, you can download and install the latest whl installation package and c-api development package from [the latest dev installation package list](./Tables.html/#ciwhls) or our [CI system](https://paddleci.ngrok.io/project.html?projectId=Manylinux1&tab=projectOverview). To log in, click on "Log in as guest".
Now you have completed the process of installing PaddlePaddle via `pip install`. wget http://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
rpm -i nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm
yum update -y
yum install -y libnccl-2.3.7-2+cuda9.0 libnccl-devel-2.3.7-2+cuda9.0 libnccl-static-2.3.7-2+cuda9.0
## Installation method
<br/><br/> There are five installation methods under CentOS system:
## *Install using Docker*
In order to better use Docker and avoid problems, we recommend using **the highest version of Docker**. For details on installing and using Docker, please refer to [the official Docker documentation](https://docs.docker.com/install/). * pip installation(recommend)
* [Conda Installation](./install_Conda_en.html)
* [Docker Installation](./install_Docker_en.html)
* [Compile From Source Code](./compile/compile_CentOS_en.html#ct_source)
* [Compile From Docker Source Code](./compile/compile_CentOS_en.html#ct_docker)
> Please note that to install and use the PaddlePaddle version that supports GPU, you must first install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker). Here is pip installation
Once you have **properly installed Docker**, you can start **installing PaddlePaddle with Docker**. ## Installation steps
1. Use the following command to pull the image we pre-installed for PaddlePaddle: * CPU version of PaddlePaddle:
* For Python 2: `python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple` or `python -m pip install paddlepaddle -i https://pypi.tuna.tsinghua.edu.cn/simple`
* For Python 3: `python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple` or `python3 -m pip install paddlepaddle -i https://pypi.tuna.tsinghua.edu.cn/simple`
* GPU version of PaddlePaddle:
* For Python 2: `python -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple``python -m pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple`
* For Python 3: `python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple``python3 -m pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple`
* For users who need a **CPU version of PaddlePaddle**, use the following command to pull the image we pre-installed for your *PaddlePaddle For CPU*: You can[Verify installation succeeded or not](#check),if you have any questions, you can refer to [FAQ](./FAQ.html)
`Docker pull hub.baidubce.com/paddlepaddle/paddle: 1.2`
* You can also pull any of our Docker images by following the instructions below: Note:
`Docker pull hub.baidubce.com/paddlepaddle/paddle:[tag]` * If it is python2.7, it is recommended to use the `python` command; if it is python3.x, it is recommended to use the 'python3' command
> (Please replace [tag] with the contents of [the mirror table](./Tables.html/#dockers))
* `python -m pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple` This command will install the PaddlePaddle that supports CUDA 10.0 cuDNN v7. If you have different requirements for CUDA or cuDNN version, you can use `python -m pip install paddlepaddle-gpu==[Version number] -i https://pypi.tuna.tsinghua.edu.cn/simple` or `python3 -m pip install paddlepaddle-gpu==[version] -i https://pypi.tuna.tsinghua.edu.cn/simple` command to install. For version number, you can see[here](https://pypi.org/project/paddlepaddle-gpu#history), for the correspondence between paddlepaddle and CUDA, cuDNN version, please see [installation package list](./Tables.html#whls)
2. Use the following command to build from the already pulled image and enter the Docker container:
`Docker run --name [Name of container] -it -v $PWD:/paddle <imagename> /bin/bash` * Download the latest stable installation package by default. For development installation package, please refer to [here](./Tables.html#ciwhls)
> In the above command, --name [Name of container] sets the name of the Docker; the -it parameter indicates that the container is running interactively with the host machine; -v $PWD:/paddle specifies the current path (the PWD variable in Linux will expand to [The absolute path](https://baike.baidu.com/item/%E7%BB%9D%E5%AF%B9%E8%B7%AF%E5%BE%84/481185) of the current path ) which is mounted to the /paddle directory inside the container; `<imagename>` specifies the name of the image to use, if you need to use our image please use `hub.baidubce.com/paddlepaddle/paddle:[tag]`. Note: The meaning of the tag is the same as the second step. /bin/bash is the command to be executed in Docker. <a name="check"></a>
## ***Verify installation***
3. (Optional: When you need to enter the Docker container a second time) re-enter the PaddlePaddle container with the following command:
`Docker start [Name of container]`
> start the container created previously
`Docker attach [Name of container]`
> Enter the started container in the last step.
Now that you have successfully installed PaddlePaddle using Docker, you only need to run PaddlePaddle after entering the Docker container. For more Docker usage, please refer to [the official Docker documentation](https://docs.docker.com/).
> Note: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container.
After the installation is complete, you can use `python` or `python3` to enter the Python interpreter and then use `import paddle.fluid` and `fluid.install_check.run_check()`
<br/><br/> If `Your Paddle Fluid is installed succesfully!` appears, to verify that the installation was successful.
## ***Verify installation***
After the installation is complete, you can use `python` or `python3` to enter the Python interpreter and then use `import paddle.fluid` to verify that the installation was successful.
<br/><br/>
## ***How to uninstall*** ## ***How to uninstall***
Please use the following command to uninstall PaddlePaddle (users who use Docker to install PaddlePaddle should use the following command in the container containing PaddlePaddle. Please use the corresponding version of pip): Please use the following command to uninstall PaddlePaddle:
* ***CPU version of PaddlePaddle***: `pip uninstall paddlepaddle` or `pip3 uninstall paddlepaddle` * ***CPU version of PaddlePaddle***: `python -m pip uninstall paddlepaddle` or `python3 -m pip uninstall paddlepaddle`
* ***GPU version of PaddlePaddle***: `pip uninstall paddlepaddle-gpu` or `pip3 uninstall paddlepaddle-gpu` * ***GPU version of PaddlePaddle***: `python -m pip uninstall paddlepaddle-gpu` or `python3 -m pip uninstall paddlepaddle-gpu`
# **Docker Installation**
[Docker](https://docs.docker.com/install/) is an open source application container engine. Using docker, you can not only isolate the installation and use of paddlepaddle from the system environment, but also share GPU, network and other resources with the host
## Environment preparation
- Currently supported system types, please see [Installation instruction](./index_cn.html), please note that Docker is not currently supported in CentOS 6
- On the local host [Install Docker](https://hub.docker.com/search/?type=edition&offering=community)
- To enable GPU support on Linux, please [Install nvidia-docker](https://github.com/NVIDIA/nvidia-docker)
## Installation steps
1. Pull PaddlePaddle image
* CPU version of PaddlePaddle: `docker pull hub.baidubce.com/paddlepaddle/paddle:[version number]`
* GPU version of PaddlePaddle: `docker pull hub.baidubce.com/paddlepaddle/paddle:[version number]-gpu-cuda9.0-cudnn7`
If your machine is not in mainland China, you can pull the image directly from DockerHub:
* CPU version of PaddlePaddle: `docker pull paddlepaddle/paddle:[version number]`
* GPU version of PaddlePaddle: `docker pull paddlepaddle/paddle:[version number]-gpu-cuda9.0-cudnn7`
After `:', please fill in the PaddlePaddle version number, such as the current version. For more details, please refer to [image profile](#dockers), in the above example, `cuda9.0-cudnn7` is only for illustration. you can see [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) to get the image that matches your machine.
2. Build and enter Docker container
* Use CPU version of PaddlePaddle:
`docker run --name [Name of container] -it -v $PWD:/paddle <imagename> /bin/bash`
> --name [Name of container] set name of Docker;
> -it The parameter indicates that the container has been operated interactively with the local machine;
> -v $PWD:/paddle specifies to mount the current path of the host (PWD variable in Linux will expand to the absolute path of the current path) to the /paddle directory inside the container;
> `<imagename>` Specify the name of the image to be used. You can view it through the 'docker images' command. /bin/Bash is the command to be executed in Docker
* Use GPU version of PaddlePaddle:
`nvidia-docker run --name [Name of container] -it -v $PWD:/paddle <imagename> /bin/bash`
> --name [Name of container] set name of Docker;
> -it The parameter indicates that the container has been operated interactively with the local machine;
> -v $PWD:/paddle specifies to mount the current path of the host (PWD variable in Linux will expand to the absolute path of the current path) to the /paddle directory inside the container;
> `<imagename>` Specify the name of the image to be used. You can view it through the 'docker images' command. /bin/Bash is the command to be executed in Docker
Now you have successfully used Docker to install PaddlePaddle. For more information about using Docker, see[Docker official documents](https://docs.docker.com)
<a name="dockers"></a>
</br></br>
### **Introduction to mirror images**
<p align="center">
<table>
<thead>
<tr>
<th> Mirror source </th>
<th> Mirror description </th>
</tr>
</thead>
<tbody>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:[Version] </td>
<td> Install pecified version of PaddlePaddle </td>
</tr>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:latest </td>
<td> Install development version of PaddlePaddle。Note: This release may contain features and unstable features that have not yet been released, so it is not recommended for regular users or production environments. </td>
</tr>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:latest-gpu </td>
<td> Install development of PaddlePaddle(support GPU). Note: This release may contain features and unstable features that have not yet been released, so it is not recommended for regular users or production environments. </td>
</tr>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:latest-dev </td>
<td> Install the latest development environment of PaddlePaddle </td>
</tr>
</tbody>
</table>
</p>
You can find the docker mirroring of the published versions of PaddlePaddle in [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/).
### Note
* Python version in the image is 2.7
* In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container.
### 补充说明
* When you need to enter the docker container for the second time, use the following command:
```
#Container created before startup
docker start [Name of container]
#Enter the starting container
docker attach [Name of container]
```
* If you are a newcomer to Docker, you can refer to the materials on the Internet for learning, such as [Docker tutorial](http://www.runoob.com/docker/docker-hello-world.html)
## How to uninstall
After entering the Docker container, execute the following command:
* **CPU version of PaddlePaddle**: `pip uninstall paddlepaddle`
* **GPU version of PaddlePaddle**: `pip uninstall paddlepaddle-gpu`
Or delete the docker container directly through `docker rm [Name of container]`
\ No newline at end of file
***
# **Install on Ubuntu** # **Install on Ubuntu**
This instruction describes how to install PaddlePaddle on a *64-bit desktop or laptop* and Ubuntu system. The Ubuntu systems we support must meet the following requirements: ## Environment preparation
Please note: Attempts on other systems may cause the installation to fail. Please ensure that your environment meets the conditions. The installation we provide by default requires your computer processor to support the AVX instruction set. Otherwise, please select the version of `no_avx` in the [latest Release installation package list](./Tables_en.html/#ciwhls-release).
Under Ubuntu, you can use `cat /proc/cpuinfo | grep avx` to check if your processor supports the AVX instruction set.
* Ubuntu 14.04 /16.04 /18.04
## Determine which version to install
* PaddlePaddle for CPU is supported. If your computer does not have an NVIDIA® GPU, you can only install this version. If your computer has a GPU, it is also recommended that you install the CPU version of PaddlePaddle first to check if your local environment is suitable.
* PaddlePaddle for GPU is supported. In order to make the PaddlePaddle program run more quickly, we accelerate the PaddlePaddle program through the GPU, but the GPU version of the PaddlePaddle needs to have the NVIDIA® GPU that meets the following conditions (see the NVIDIA official documentation for the specific installation process and configuration: [For CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/), [For cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/))
* *CUDA Toolkit 9.0 with cuDNN v7* * **Ubuntu version (64 bit)**
* *CUDA Toolkit 8.0 with cuDNN v7* * **Ubuntu 14.04 (GPU version supports CUDA 10.0/10.1)**
* *Hardware devices with GPU computing power exceeding 1.0* * **Ubuntu 16.04 (GPU version supports CUDA 9.0/9.1/9.2/10.0/10.1)**
* **Ubuntu 18.04 (GPU version supports CUDA 10.0/10.1)**
* **Python version 2.7.15+/3.5.1+/3.6/3.7 (64 bit)**
* **pip or pip3 version 9.0.1+ (64 bit)**
### Note
## Choose an installation method * You can use `uname -m && cat /etc/*release` view the operating system and digit information of the machine
* Confirm that the Python where you need to install PaddlePaddle is your expected location, because your computer may have multiple Python
Under the Ubuntu system, we offer 4 installation methods:
* Pip installation
* Docker installation (the version of python in the image is 2.7)
* Source code compilation and installation
* Docker source code compilation and installation (the python version in the image is 2.7, 3.5, 3.6, 3.7)
**With pip installation** (the easiest way to install), we offer you a pip installation method, but it depends more on your native environment and may have some issues related to your local environment. * If you are using Python 2, use the following command to output Python path. Depending on the environment, you may need to replace Python in all command lines in the description with specific Python path
**Use Docker for installation** (the safest way to install), because we have installed the tools and configuration in a Docker image so that if something goes wrong, others can reproduce the problem for help. In addition, for developers accustomed to using Windows and MacOS, there is no need to configure a cross-compilation environment using Docker. It should be emphasized that Docker does not virtualize any hardware. The compiler tools running in the Docker container are actually running directly on the native CPU and operating system. The performance is the same as installing the compiler on the machine. which python
Compile and install from [**source**](#ubt_source) and [**use Docker**](#ubt_docker). This is a process of compiling the PaddlePaddle source code into a binary file and then installing the binary file. Compared to the binary PaddlePaddle that has been successfully tested and compiled for you, the manual compilation is more complicated, we will answer you in detail at the end of the description.
<br/><br/>
### ***Install using pip***
* If you are using Python 3, use the following command to output Python path. Depending on the environment, you may need to replace Python 3 in all command lines in the description with Python or specific Python path
First, we use the following commands to **check if the environment of this machine** is suitable for installing PaddlePaddle: which python3
uname -m && cat /etc/*release * You need to confirm that the version of Python meets the requirements
* If you are using Python 2,use the following command to confirm it is 2.7.15+
>The above command will display the operating system and processing bits of the machine. Please make sure your computer is consistent with the requirements of this tutorial. python --version
Second, your computer needs to meet any of the following requirements: * If you are using Python 3,use the following command to confirm it is 3.5.1+/3.6/3.7
* Python2.7.x (dev), Pip >= 9.0.1 python3 --version
* Python3.5+.x (dev), Pip3 >= 9.0.1
>You may have installed pip on your Ubuntu. Please use pip -V or pip3 -V to confirm its version is the recommended pip 9.0.1 or higher. * You need to confirm that the version of pip meets the requirements, pip version is required 9.0.1+
Update apt source: `apt update` * If you are using Python 2
Use the following command to install or upgrade Python and pip to the required version: (pip and dev installation in python3.6, python3.7 differs greatly across different Ubuntu versions, thus the steps are omitted here) python -m ensurepip
- For python2: `sudo apt install python-dev python-pip` python -m pip --version
- For python3.5: `sudo apt install python3.5-dev and curl https://bootstrap.pypa.io/get-pip.py -o - | python3.5 && easy_install pip` * If you are using Python 3
- For python3.6, python3.7: We assumed that python3.6 (3.7) and the corresponding versions of dev and pip3 are properly installed by yourself. python3 -m ensurepip
python3 -m pip --version
>Even if you already have Python 2 or Python 3 in your environment, you need to install Python-dev or Python 3.5 (3.6, 3.7) -dev. * Confirm that Python and pip is 64 bit,and the processor architecture is x86_64(or called x64、Intel 64、AMD64)architecture. Currently, PaddlePaddle doesn't support arm64 architecture. The first line below outputs "64bit", and the second line outputs "x86_64", "x64" or "AMD64" :
Now let's install PaddlePaddle: * If you are using Python 2
python -c "import platform;print(platform.architecture()[0]);print(platform.machine())"
* If you are using Python 3
1. Use pip install to install PaddlePaddle python3 -c "import platform;print(platform.architecture()[0]);print(platform.machine())"
* The installation package provided by default requires computer support for MKL
* If you do not know the machine environment, please download and use[Quick install script](https://fast-install.bj.bcebos.com/fast_install.sh), please refer to[here](https://github.com/PaddlePaddle/FluidDoc/tree/develop/doc/fluid/beginners_guide/install/install_script.md).
* For users who need **the CPU version PaddlePaddle**: `pip install paddlepaddle` or `pip3 install paddlepaddle` ## Choose CPU/GPU
* For users who need **the GPU version PaddlePaddle**: `pip install paddlepaddle-gpu` or `pip3 install paddlepaddle-gpu` * If your computer doesn't have NVIDIA® GPU, please install CPU version of PaddlePaddle
> 1.In order to prevent problem "nccl.h cannot be found", please first install nccl2 according to the following command (here is ubuntu 16.04, CUDA9, ncDNN v7 nccl2 installation instructions), for more information about the installation information, please refer to [the NVIDIA official website](https://developer.nvidia.com/nccl/nccl-download): * If your computer has NVIDIA® GPU, and meet the following conditions, we command you to install PaddlePaddle
* **CUDA toolkit 10.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **CUDA toolkit 9.0 with cuDNN v7.3+(for multi card support, NCCL2.3.7 or higher)**
* **Hardware devices with GPU computing power over 1.0**
i. `Wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb`
ii. `dpkg -i nvidia-machine- Learning-repo-ubuntu1604_1.0.0-1_amd64.deb`
iii. `sudo apt-get install -y libnccl2=2.2.13-1+cuda9.0 libnccl-dev=2.2.13-1+cuda9.0`
> 2.If you do not specify the pypi package version number, we will by default provide you with a version of PaddlePaddle that supports Cuda 9/cuDNN v7. You can refer to NVIDIA official documents for installation process and configuration method of CUDA and cudnn. Please refer to[CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/),[cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/)
* For users with `Cannot uninstall 'six'.` problems, the probable reason is the existing Python installation issues in your system. In this case, use `pip install paddlepaddle --ignore-installed six`(CPU) or `pip install paddlepaddle-gpu -- Ignore-installed six` (GPU) to resolve. * If you need to use multi card environment, please make sure that you have installed nccl2 correctly, or install nccl2 according to the following instructions (here is the installation instructions of nccl2 under ubuntu 16.04, CUDA9 and cuDNN7). For more version of installation information, please refer to NVIDIA[official website](https://developer.nvidia.com/nccl):
* For users with **other requirements**: `pip install paddlepaddle==[version number]` or `pip3 install paddlepaddle==[version number]`
> For `the version number`, please refer to [the latest Release installation package list](./Tables.html/#whls). If you need to obtain and install **the latest PaddlePaddle development branch**, you can download and install the latest whl installation package and c-api development package from [the latest dev installation package list](./Tables.html/#ciwhls) or our [CI system](https://paddleci.ngrok.io/project.html?projectId=Manylinux1&tab=projectOverview). To log in, click on "Log in as guest". wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
dpkg -i nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
sudo apt-get install -y libnccl2=2.3.7-1+cuda9.0 libnccl-dev=2.3.7-1+cuda9.0
Now you have completed the process of installing PaddlePaddle using `pip install`.
## Choose an installation method
<br/><br/> Under the Ubuntu system, we offer 5 installation methods:
### ***Install using Docker***
In order to better use Docker and avoid problems, we recommend using **the highest version of Docker**. For details on **installing and using Docker**, please refer to [the official Docker documentation](https://docs.docker.com/install/).
> Please note that to install and use the PaddlePaddle version that supports GPU, you must first install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker)
If Docker is **properly installed**, you can start **installing PaddlePaddle using Docker**.
1. Use the following command to pull the image we pre-installed for PaddlePaddle:
* For users who need **a CPU version of PaddlePaddle**, use the following command to pull the image we pre-installed for your *PaddlePaddle For CPU*:
`Docker pull hub.baidubce.com/paddlepaddle/paddle: 1.2`
* For users who need **a GPU version of PaddlePaddle**, use the following command to pull the image we pre-installed for your *PaddlePaddle For GPU*:
`Docker pull hub.baidubce.com/paddlepaddle/paddle:1.2-gpu-cuda9.0-cudnn7`
* You can also pull any of our Docker images by following the instructions below:
`Docker pull hub.baidubce.com/paddlepaddle/paddle:[tag]`
> (Please replace [tag] with the contents of [the mirror table](https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/beginners_guide/install/Tables.html/#dockers)) * Pip installation (recommended)
* [Conda安装](./install_Conda.html)
* [Docker installation](./install_Docker.html)
* [Source code compilation and installation](./compile/compile_Ubuntu.html#ubt_source)
* [Docker source code compilation and installation](./compile/compile_Ubuntu.html#ubt_docker)
2. Use the following command to build from the already pulled image and enter the Docker container: We will introduce pip installation here.
`Docker run --name [Name of container] -it -v $PWD:/paddle <imagename> /bin/bash` ## Installation steps
> In the above command, --name [Name of container] sets the name of the Docker; the `-it` parameter indicates that the container is running interactively with the host machine; -v $PWD:/paddle specifies the current path (the PWD variable in Linux will expand to The absolute path of the current path) is mounted to the /paddle directory inside the container; `<imagename>` specifies the name of the image to use, if you need to use our image please use `hub.baidubce.com/paddlepaddle/paddle:[tag]`. Note: The meaning of tag is the same as the second step; /bin/bash is the command to be executed in Docker. * CPU version of PaddlePaddle:
* For Python 2: `python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple` or `python -m pip install paddlepaddle -i https://pypi.tuna.tsinghua.edu.cn/simple`
* For Python 3: `python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple` or `python3 -m pip install paddlepaddle -i https://pypi.tuna.tsinghua.edu.cn/simple`
3. (Optional: When you need to enter the Docker container a second time) re-enter the PaddlePaddle container with the following command: * GPU version PaddlePaddle:
* For Python 2: `python -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple` or `python -m pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple`
* For Python 3: `python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple` or `python3 -m pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple`
`Docker start [Name of container]` You can [verify whether the installation is successful](#check), if you have any questions please see [FAQ](./FAQ.html)
> start the container created previously. Note:
`Docker attach [Name of container]` * For python2.7, we recommend to use `python` command; For python3.x, we recommend to use `python3` command.
> Enter the started container. * `python -m pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple` This command will install PaddlePaddle supporting CUDA 10.0 cuDNN v7, if you have different requirement to the version of CUDA or cuDNN, you can use `python -m pip install paddlepaddle-gpu==[version number] -i https://pypi.tuna.tsinghua.edu.cn/simple` or `python3 -m pip install paddlepaddle-gpu==[version number] -i https://pypi.tuna.tsinghua.edu.cn/simple` command to install, for version number please see[version number](https://pypi.org/project/paddlepaddle-gpu#history), for correspondence between paddlepaddle and CUDA and cuDNN version, please see [Installation package list](./Tables.html#whls)
Now that you have successfully installed PaddlePaddle using Docker, you only need to run PaddlePaddle after entering the Docker container. For more Docker usage, please refer to [the official Docker documentation](https://docs.docker.com/).
>Note: In order to reduce the size, `vim` is not installed in PaddlePaddle Docker image by default. You can edit the code in the container after executing `apt-get install -y vim` in the container. * Download the latest stable installation package by default. For development installation package, please refer to[here](./Tables.html#ciwhls)
<a name="check"></a>
<br/><br/> <br/><br/>
## ***Verify installation*** ## ***Verify installation***
After the installation is complete, you can use `python` or `python3` to enter the python interpreter and then use `import paddle.fluid` to verify that the installation was successful. After the installation is complete, you can use `python` or `python3` to enter the Python interpreter and then use `import paddle.fluid as fluid` and then `fluid.install_check.run_check()` to verify that the installation was successful.
If `Your Paddle Fluid is installed succesfully!` appears, it means the installation was successful.
<br/><br/> <br/><br/>
## ***How to uninstall*** ## ***How to uninstall***
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册