From d10e8005c0ea32f748a3153623cb36baba5ebef0 Mon Sep 17 00:00:00 2001 From: Alexander Zhogov Date: Thu, 16 Dec 2021 14:33:56 +0300 Subject: [PATCH] Revert "Fix build issue for openvino wheel package on Windows (#9231)" (#9260) This reverts commit 460a6634fdf8d62405969c17cb77953ffb855996. --- .../ie_bridges/python/wheel/.env.in | 15 +++++++ .../ie_bridges/python/wheel/CMakeLists.txt | 44 +++++++++++++------ .../wheel/meta/openvino-dev.requirements.txt | 28 ++++++++++++ .../python/wheel/meta/openvino-dev.setup.cfg | 22 ++++++++++ .../wheel/meta/openvino.requirements.txt | 1 + .../python/wheel/meta/pypi_overview.md | 32 ++++++++++++++ .../python/wheel/requirements-dev.txt | 2 +- .../ie_bridges/python/wheel/setup.cfg | 14 +++--- .../ie_bridges/python/wheel/setup.py | 34 +++++++------- tools/openvino_dev/setup.py | 2 +- 10 files changed, 153 insertions(+), 41 deletions(-) create mode 100644 inference-engine/ie_bridges/python/wheel/.env.in create mode 100644 inference-engine/ie_bridges/python/wheel/meta/openvino-dev.requirements.txt create mode 100644 inference-engine/ie_bridges/python/wheel/meta/openvino-dev.setup.cfg create mode 100644 inference-engine/ie_bridges/python/wheel/meta/openvino.requirements.txt create mode 100644 inference-engine/ie_bridges/python/wheel/meta/pypi_overview.md diff --git a/inference-engine/ie_bridges/python/wheel/.env.in b/inference-engine/ie_bridges/python/wheel/.env.in new file mode 100644 index 00000000000..5dc313f6b1d --- /dev/null +++ b/inference-engine/ie_bridges/python/wheel/.env.in @@ -0,0 +1,15 @@ +WHEEL_PACKAGE_NAME=@WHEEL_PACKAGE_NAME@ +WHEEL_VERSION=@WHEEL_VERSION@ +WHEEL_BUILD=@WHEEL_BUILD@ +WHEEL_LICENCE_TYPE=@WHEEL_LICENCE_TYPE@ +WHEEL_AUTHOR=@WHEEL_AUTHOR@ +WHEEL_AUTHOR_EMAIL=@WHEEL_AUTHOR_EMAIL@ +WHEEL_DESC=@WHEEL_DESC@ +WHEEL_LICENSE=@WHEEL_LICENSE@ +WHEEL_REQUIREMENTS=@WHEEL_REQUIREMENTS@ +WHEEL_OVERVIEW=@WHEEL_OVERVIEW@ + +CMAKE_BUILD_DIR=@CMAKE_BINARY_DIR@ +OV_RUNTIME_LIBS_DIR=@IE_CPACK_RUNTIME_PATH@ +TBB_LIBS_DIR=@TBB_LIBS_DIR@ +PY_PACKAGES_DIR=@PY_PACKAGES_DIR@ diff --git a/inference-engine/ie_bridges/python/wheel/CMakeLists.txt b/inference-engine/ie_bridges/python/wheel/CMakeLists.txt index 64728a5cd7c..53d8207c347 100644 --- a/inference-engine/ie_bridges/python/wheel/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/wheel/CMakeLists.txt @@ -1,13 +1,40 @@ # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # + +set(WHEEL_PACKAGE_NAME "openvino" CACHE STRING "Name of the package") +set(WHEEL_LICENCE_TYPE "OSI Approved :: Apache Software License" CACHE STRING "License type for the package") +set(WHEEL_AUTHOR "Intel Corporation" CACHE STRING "Package author’s name") +set(WHEEL_AUTHOR_EMAIL "openvino_pushbot@intel.com" CACHE STRING "Email address of the package author") +set(WHEEL_DESC "Inference Engine Python* API" CACHE STRING "Short, summary description of the package") +set(WHEEL_URL "https://docs.openvinotoolkit.org/latest/index.html" CACHE STRING "Home page url") +set(WHEEL_DOWNLOAD_URL "https://github.com/openvinotoolkit/openvino/tags" CACHE STRING "Download page url") +set(WHEEL_VERSION "${IE_VERSION}" CACHE STRING "Version of this release" FORCE) set(WHEEL_BUILD "${IE_VERSION_BUILD}" CACHE STRING "Build number of this release" FORCE) +set(WHEEL_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE" CACHE STRING "Wheel license file") +set(WHEEL_REQUIREMENTS "${CMAKE_CURRENT_SOURCE_DIR}/meta/openvino.requirements.txt" CACHE STRING "Wheel requirements.txt file") +set(WHEEL_OVERVIEW "${CMAKE_CURRENT_SOURCE_DIR}/meta/pypi_overview.md" CACHE STRING "Detailed description") + +set(SETUP_PY "${CMAKE_CURRENT_SOURCE_DIR}/setup.py") +set(SETUP_ENV "${CMAKE_CURRENT_SOURCE_DIR}/.env.in") +set(SETUP_ENV_OUT "${CMAKE_CURRENT_SOURCE_DIR}/.env") + set(PY_PACKAGES_DIR ${PYTHON_BRIDGE_CPACK_PATH}/${PYTHON_VERSION}) set(TBB_LIBS_DIR runtime/3rdparty/tbb/lib) -if(WIN32) + +if(APPLE) + set(WHEEL_PLATFORM macosx_10_15_x86_64) +elseif(UNIX) + set(WHEEL_PLATFORM manylinux2014_x86_64) +elseif(WIN32) + set(WHEEL_PLATFORM win_amd64) set(TBB_LIBS_DIR runtime/3rdparty/tbb/bin) +else() + message(FATAL_ERROR "This platform is not supported") endif() +configure_file(${SETUP_ENV} ${SETUP_ENV_OUT} @ONLY) + if(LINUX) find_host_program(patchelf_program NAMES patchelf @@ -28,30 +55,21 @@ endforeach() execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import wheel.bdist_wheel ; print(f'{wheel.bdist_wheel.get_abi_tag()}')" OUTPUT_VARIABLE PYTHON_ABI) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import wheel.vendored.packaging.tags as tags ; print(f'{tags.interpreter_name()}{tags.interpreter_version()}')" OUTPUT_VARIABLE INTERPRETER) -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import wheel.vendored.packaging.tags as tags ; print(f'{next(tags._platform_tags())}')" OUTPUT_VARIABLE WHEEL_PLATFORM) string(STRIP ${PYTHON_ABI} PYTHON_ABI) string(STRIP ${INTERPRETER} INTERPRETER) -string(STRIP ${WHEEL_PLATFORM} WHEEL_PLATFORM) set(openvino_wheel_name "openvino-${WHEEL_VERSION}-${WHEEL_BUILD}-${INTERPRETER}-${PYTHON_ABI}-${WHEEL_PLATFORM}.whl") set(openvino_wheels_output_dir "${CMAKE_BINARY_DIR}/wheels") set(openvino_wheel_path "${openvino_wheels_output_dir}/${openvino_wheel_name}") add_custom_command(OUTPUT ${openvino_wheel_path} - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/licensing" "${CMAKE_BINARY_DIR}/licensing" COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/site-packages" - COMMAND ${CMAKE_COMMAND} -E env OPENVINO_VERSION=${IE_VERSION} - OPENVINO_VERSION=${IE_VERSION} - CMAKE_BUILD_DIR=${CMAKE_BINARY_DIR} - OV_RUNTIME_LIBS_DIR=${IE_CPACK_RUNTIME_PATH} - TBB_LIBS_DIR=${TBB_LIBS_DIR} - PY_PACKAGES_DIR=${PY_PACKAGES_DIR} - ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/setup.py" clean bdist_wheel + COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} clean bdist_wheel --dist-dir ${openvino_wheels_output_dir} --build=${WHEEL_BUILD} --plat-name=${WHEEL_PLATFORM} - DEPENDS ${openvino_wheel_deps} + # COMMAND ${CMAKE_COMMAND} -E remove ${SETUP_ENV_OUT} + DEPENDS ${openvino_wheel_deps} ${SETUP_ENV_OUT} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMENT "Building Python wheel ${openvino_wheel_name}" VERBATIM) diff --git a/inference-engine/ie_bridges/python/wheel/meta/openvino-dev.requirements.txt b/inference-engine/ie_bridges/python/wheel/meta/openvino-dev.requirements.txt new file mode 100644 index 00000000000..ccc569a0194 --- /dev/null +++ b/inference-engine/ie_bridges/python/wheel/meta/openvino-dev.requirements.txt @@ -0,0 +1,28 @@ +defusedxml>=0.7.1 +scipy~=1.5.4 +jstyleson~=0.0.2 +numpy>=1.16.6,<1.20 +addict>=2.4.0 +pandas~=1.1.5 +hyperopt~=0.1.2 +networkx~=2.5 +tqdm>=4.54.1 +texttable~=1.6.3 +py-cpuinfo>=7.0.0 +PyYAML>=5.4.1 +pillow>=8.1.2 +scikit-image>=0.17.2 +scikit-learn>=0.24.1 +yamlloader>=0.5 +shapely>=1.7.1 +nibabel>=3.2.1 +pydicom>=2.1.2 +sentencepiece>=0.1.95 +tokenizers>=0.10.1 +editdistance>=0.5.3 +parasail>=1.2.4 +fast-ctc-decode>=0.2.5 +rawpy>=0.16.0 +nltk>=3.5 +opencv-python==4.5.* +progress>=1.5 diff --git a/inference-engine/ie_bridges/python/wheel/meta/openvino-dev.setup.cfg b/inference-engine/ie_bridges/python/wheel/meta/openvino-dev.setup.cfg new file mode 100644 index 00000000000..d6789c4a084 --- /dev/null +++ b/inference-engine/ie_bridges/python/wheel/meta/openvino-dev.setup.cfg @@ -0,0 +1,22 @@ +[options] +py_modules = + mo + mo_tf + mo_caffe + mo_mxnet + mo_onnx + mo_kaldi + +[options.package_data] + * = * + +[options.entry_points] +console_scripts = + +[metadata] +license_files = + readme* + *LICENSE* + *license* + *third-party-programs* + *EULA* diff --git a/inference-engine/ie_bridges/python/wheel/meta/openvino.requirements.txt b/inference-engine/ie_bridges/python/wheel/meta/openvino.requirements.txt new file mode 100644 index 00000000000..63012dd1739 --- /dev/null +++ b/inference-engine/ie_bridges/python/wheel/meta/openvino.requirements.txt @@ -0,0 +1 @@ +numpy>=1.16.6,<1.20 diff --git a/inference-engine/ie_bridges/python/wheel/meta/pypi_overview.md b/inference-engine/ie_bridges/python/wheel/meta/pypi_overview.md new file mode 100644 index 00000000000..418a04bc16a --- /dev/null +++ b/inference-engine/ie_bridges/python/wheel/meta/pypi_overview.md @@ -0,0 +1,32 @@ +## OpenVINO™ Toolkit + +OpenVINO™ toolkit quickly deploys applications and solutions that emulate human vision. Based on Convolutional Neural Networks (CNNs), the toolkit extends computer vision (CV) workloads across Intel® hardware, maximizing performance. The OpenVINO™ toolkit includes the Deep Learning Deployment Toolkit (DLDT). + +OpenVINO™ toolkit: + +- Enables CNN-based deep learning inference on the edge +- Supports heterogeneous execution across an Intel® CPU, Intel® Integrated Graphics, Intel® Neural Compute Stick 2, and Intel® Vision Accelerator Design with Intel® Movidius™ VPUs +- Speeds time-to-market via an easy-to-use library of computer vision functions and pre-optimized kernels +- Includes optimized calls for computer vision standards, including OpenCV\* and OpenCL™ + +Operating Systems: +- Ubuntu* 18.04 long-term support (LTS), 64-bit +- Windows* 10, 64-bit +- macOS* 10.15, 64-bit + +## Install the Runtime Package Using the PyPI Repository +1. Set up and update pip to the highest version: + ```sh + python3 -m pip install --upgrade pip + ``` +2. Install the Intel® distribution of OpenVINO™ toolkit: + ```sh + pip install openvino + ``` + +3. Verify that the package is installed: + ```sh + python3 -c "from openvino.inference_engine import IECore" + ``` + +Now you are ready to develop and run your application. \ No newline at end of file diff --git a/inference-engine/ie_bridges/python/wheel/requirements-dev.txt b/inference-engine/ie_bridges/python/wheel/requirements-dev.txt index b7574b392d2..8c4ce47c35f 100644 --- a/inference-engine/ie_bridges/python/wheel/requirements-dev.txt +++ b/inference-engine/ie_bridges/python/wheel/requirements-dev.txt @@ -1,3 +1,3 @@ setuptools>=53.0.0 wheel>=0.36.2 - +python-decouple>=3.4 diff --git a/inference-engine/ie_bridges/python/wheel/setup.cfg b/inference-engine/ie_bridges/python/wheel/setup.cfg index c6893c93c42..abb1790b67f 100644 --- a/inference-engine/ie_bridges/python/wheel/setup.cfg +++ b/inference-engine/ie_bridges/python/wheel/setup.cfg @@ -1,11 +1,7 @@ [metadata] license_files = - readme* - *LICENSE* - *license* - *third-party-programs* - ../../../../licensing/runtime-third-party-programs.txt - ../../../../licensing/tbb_third-party-programs.txt - ../../../../licensing/onednn_third-party-programs.txt - ../../../../LICENSE - + readme* + *LICENSE* + *license* + *third-party-programs* + *EULA* diff --git a/inference-engine/ie_bridges/python/wheel/setup.py b/inference-engine/ie_bridges/python/wheel/setup.py index eb8d573dfba..517dce7560e 100644 --- a/inference-engine/ie_bridges/python/wheel/setup.py +++ b/inference-engine/ie_bridges/python/wheel/setup.py @@ -21,6 +21,7 @@ from setuptools import setup, find_namespace_packages, Extension from setuptools.command.build_ext import build_ext from setuptools.command.build_clib import build_clib from setuptools.command.install import install +from decouple import config WHEEL_LIBS_INSTALL_DIR = os.path.join('openvino', 'libs') WHEEL_LIBS_PACKAGE = 'openvino.libs' @@ -40,11 +41,10 @@ elif machine == 'aarch64': ARCH = 'arm64' # The following variables can be defined in environment or .env file -SCRIPT_DIR = Path(__file__).resolve().parents[0] -CMAKE_BUILD_DIR = os.getenv('CMAKE_BUILD_DIR', '.') -OV_RUNTIME_LIBS_DIR = os.getenv('OV_RUNTIME_LIBS_DIR', f'runtime/{LIBS_DIR}/{ARCH}/{CONFIG}') -TBB_LIBS_DIR = os.getenv('TBB_LIBS_DIR', f'runtime/3rdparty/tbb/{LIBS_DIR}') -PY_PACKAGES_DIR = os.getenv('PY_PACKAGES_DIR', f'python/{PYTHON_VERSION}') +CMAKE_BUILD_DIR = config('CMAKE_BUILD_DIR', '.') +OV_RUNTIME_LIBS_DIR = config('OV_RUNTIME_LIBS_DIR', f'runtime/{LIBS_DIR}/{ARCH}/{CONFIG}') +TBB_LIBS_DIR = config('TBB_LIBS_DIR', f'runtime/3rdparty/tbb/{LIBS_DIR}') +PY_PACKAGES_DIR = config('PY_PACKAGES_DIR', f'python/{PYTHON_VERSION}') LIBS_RPATH = '$ORIGIN' if sys.platform == 'linux' else '@loader_path' LIB_INSTALL_CFG = { @@ -428,28 +428,28 @@ if not any(pl in sys.platform for pl in platforms): sys.exit(f'Unsupported platform: {sys.platform}, expected: linux, win32, darwin') # copy license file into the build directory -package_license = os.getenv('WHEEL_LICENSE', SCRIPT_DIR.parents[3] / 'LICENSE') +package_license = config('WHEEL_LICENSE', '') if os.path.exists(package_license): copyfile(package_license, 'LICENSE') packages = find_namespace_packages(get_package_dir(PY_INSTALL_CFG)) package_data: typing.Dict[str, list] = {} -pkg_name = os.getenv('WHEEL_PACKAGE_NAME', 'openvino') +pkg_name = config('WHEEL_PACKAGE_NAME', 'openvino') ext_modules = find_prebuilt_extensions(get_dir_list(PY_INSTALL_CFG)) if pkg_name == 'openvino' else [] setup( - version=os.getenv('WHEEL_VERSION', '0.0.0'), - build=os.getenv('WHEEL_BUILD', '000'), - author_email=os.getenv('WHEEL_AUTHOR_EMAIL', 'openvino_pushbot@intel.com'), + version=config('WHEEL_VERSION', '0.0.0'), + build=config('WHEEL_BUILD', '000'), + author_email=config('WHEEL_AUTHOR_EMAIL', 'openvino_pushbot@intel.com'), name=pkg_name, - license=os.getenv('WHEEL_LICENCE_TYPE', 'OSI Approved :: Apache Software License'), - author=os.getenv('WHEEL_AUTHOR', 'Intel(R) Corporation'), - description=os.getenv('WHEEL_DESC', 'OpenVINO(TM) Runtime'), - install_requires=get_dependencies(os.getenv('WHEEL_REQUIREMENTS', SCRIPT_DIR.parents[0] / 'requirements.txt')), - long_description=get_description(os.getenv('WHEEL_OVERVIEW', SCRIPT_DIR.parents[3] / 'docs/install_guides/pypi-openvino-rt.md')), + license=config('WHEEL_LICENCE_TYPE', 'OSI Approved :: Apache Software License'), + author=config('WHEEL_AUTHOR', 'Intel Corporation'), + description=config('WHEEL_DESC', 'Inference Engine Python* API'), + install_requires=get_dependencies(config('WHEEL_REQUIREMENTS', 'meta/openvino.requirements.txt')), + long_description=get_description(config('WHEEL_OVERVIEW', 'meta/pypi_overview.md')), long_description_content_type='text/markdown', - download_url=os.getenv('WHEEL_DOWNLOAD_URL', 'https://github.com/openvinotoolkit/openvino/tags'), - url=os.getenv('WHEEL_URL', 'https://docs.openvinotoolkit.org/latest/index.html'), + download_url=config('WHEEL_DOWNLOAD_URL', 'https://github.com/openvinotoolkit/openvino/tags'), + url=config('WHEEL_URL', 'https://docs.openvinotoolkit.org/latest/index.html'), cmdclass={ 'build': CustomBuild, 'install': CustomInstall, diff --git a/tools/openvino_dev/setup.py b/tools/openvino_dev/setup.py index 44861d6a3ed..a18d6991a75 100644 --- a/tools/openvino_dev/setup.py +++ b/tools/openvino_dev/setup.py @@ -195,7 +195,7 @@ setup( author_email='openvino_pushbot@intel.com', url='https://docs.openvinotoolkit.org/latest/index.html', download_url='https://github.com/openvinotoolkit/openvino/tags', - description='OpenVINO(TM) Development Tools', + description='OpenVINO™ Developer Package', long_description=get_description(SCRIPT_DIR.parents[1] / 'docs/install_guides/pypi-openvino-dev.md'), long_description_content_type='text/markdown', classifiers=[