Files
openvino/inference-engine/ie_bridges/python/README.md
T
Mikhail Ryzhov e2c67bd508 Enabled wheel packaging (#3582)
* Added onnx support for C samples

* Added wheel packaging configuration

* ADD cmake option

* Small refactoring

* Fixes for linux env

* Fixed macOS issues

* removed test code

* Added requirements file

* Added myriad plugin

* [PIP] Runtime wheel packaging v2

* Added rpath logic

* Setting rpath for bindings

* Formatting fixes

* Move target project 1 directory above

* Added target dependencies

* Added blacklist for runtime libs

* Corrected blacklist scope

* Added wheel packaging configuration

* ADD cmake option

* Small refactoring

* Fixes for linux env

* Fixed macOS issues

* removed test code

* Added requirements file

* Added myriad plugin

* [PIP] Runtime wheel packaging v2

* Added rpath logic

* Setting rpath for bindings

* Formatting fixes

* Move target project 1 directory above

* Added blacklist for runtime libs

* Changed lib exstention om macOS

* ADD cmake option

* Revert "ADD cmake option"

This reverts commit 36f98c713bb337a160f9af6c7c79c4371fdfc45f.

* Revert "Changed lib exstention om macOS"

This reverts commit 80086fe1230b64fbcf396de82bc731c10f738eae.

* Revert "Merge branch 'feature/wheel_pack' of https://github.com/mryzhov/openvino into feature/wheel_pack"

This reverts commit 7560d9ab55edc1f8877b83821542570060fb13d8, reversing
changes made to c287798f994dcefc074a06ff7c3ef86222674cc7.

* Revert "Added onnx support for C samples"

This reverts commit 26c595ac136d99bd576d307d33ca15feb15f81e4.

* Fixed merge issues

* Fixed typo in mac tool

* Code review fixes

* Simplified deps and added fatal error

code review fixes

* Removed test data

* Fixed setup.py review comments

* Removed apache 2.0 license

* Review fixes

* fixed pylint issues

* Fixed python api install directory

* Using cmake detected python binary

* Changed wheel build directory

* Renamed subdir from install to wheel

* Removed pylint log

* Made license, description and requirements configurable by cmake options

Those files may be changed in CI

* Changed variable name

* Glob instead of os.walk

* Corrected package name in description

* Added wheel building instructions to readme

* small typo fix

* Changes to support CI build

1) Setup.py can be run without cmake build
2) Wheel metadata can be set by environment variables
3) Cmake build uses configuration from .env file

* Removed unused file
2021-02-08 19:16:28 +03:00

81 lines
2.3 KiB
Markdown

## Software Requirements
- [CMake\*](https://cmake.org/download/) 3.9 or later
- Microsoft\* Visual Studio 2015 or later on Windows\*
- gcc 4.8 or later on Linux
- Python 2.7 or higher on Linux\*
- Python 3.6 or higher on Windows\*
## Prerequisites
2. Install Inference Engine Python API dependencies:
```bash
pip3 install -r requirements.txt
```
## Building on Linux
Build Inference Engine Python API alongside with the Inference Engine build.
You need to run Inference Engine build with the following flags:
```shellscript
cd <IE_ROOT>
mkdir -p build
cd build
cmake -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=`which python3.6` \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.6 ..
make -j16
```
## Building on Windows
You need to run Inference Engine build with the following flags:
```shellscript
cd <IE_ROOT>
mkdir build
cd build
set PATH=C:\Program Files\Python36\Scripts;%PATH%
cmake -G "Visual Studio 15 2017 Win64" ^
-DENABLE_PYTHON=ON ^
-DPYTHON_EXECUTABLE="C:\Program Files\Python36\python.exe" ^
-DPYTHON_INCLUDE_DIR="C:\Program Files\Python36\include" ^
-DPYTHON_LIBRARY="C:\Program Files\Python36\libs\python36.lib" ..
```
Then build generated solution INFERENCE_ENGINE_DRIVER.sln using Microsoft\* Visual Studio or run `cmake --build . --config Release` to build from the command line.
## Building Python wheel
1) Install Inference Engine Python API dependencies:
```bash
pip3 install -r wheel/requirements-dev.txt
```
2) Install the *patchelf* tool on Linux only:
```shellscript
sudo apt install patchelf
```
3) Run Inference Engine build with the following options:
```shellscript
-DENABLE_PYTHON=ON
-DENABLE_WHEEL=ON
```
If you need to include other components to the package you need to enable them too.
For example, to include ngraph python API:
```shellscript
-NGRAPH_PYTHON_BUILD_ENABLE=ON
```
## Running sample
Before running the Python samples:
- add the folder with built `openvino` Python module (located at `bin/intel64/Release/lib/python_api/python3.6` for Linux) to the PYTHONPATH environment variable.
- add the folder with Inference Engine libraries to LD_LIBRARY_PATH variable on Linux (or PATH on Windows).
Example of command line to run classification sample:
```bash
python3 sample/classification_sample.py -m <path/to/xml> -i <path/to/input/image> -d CPU
```