Files
openvino/scripts/setupvars/setupvars.sh
Przemyslaw Wysocki d2871fd52c [PyOV] Enable Python 3.10 on Azure CI (#12578)
* Fix mypy for numpy==1.21.6

* Apply CR changes

* Allow Python 3.6 for open source

* Attempt to silence mypy

* Revert to 3.6 in setup.pys

* Fix merge conflict

* Add newline

* Fix Python version assert

* Test Python 3.10 CI

* Try bumping up pybind to 2.10

* Link default python to python 3.10

* Add sudo to changing default python

* Bump python version in setupvars

* Fix exception in test

* Do the same for compatibility

* Apply same CI changes to other pipelines

* Attempt to fix arm and windows CIs

* Fix win py lib version and links?

* Try to fix CI

* Fix win python path

* Update win path

* Test disable PDPD

* Disable TF for testing CI

* Add sudo to rm

* Test linux

* Update requirements

* RM sudo

* Add debug step to CI on ARM

* build py from source on linux

* Remove debug step from ARM

* Fix err

* Fill num_proc

* Fic py installation

* Bump pdpd to 2.3.1

* Bump np vers

* Try to upgrade onnx to 1.12.0

* Revert onnx upgrade, enable frontends

* Build py shared

* Export library

* activate py env

* Bump scipy for py3.10

* Another scipy bump

* Fix Windows path, add nfs helper for mount

* Attempt to fix win_cc

* Batch of changes

* Try to fix ngraph-onnx-lin

* Install lsb-release for docker on ngraph-onnx-lin

* Link lsb_release

* Try bumping Ubuntu to 22.04

* Revert ubuntu change in dockerfile

* Refactor tests for onnx1.12

* Fix ONNX compatibility and numpy warnings

* Refactor tests for onnx1.12

* Fix ONNX compatibility and numpy warnings

* Upgrade ONNX to 1.12 in cpp

* Skip unsupported ops

* Revert "Fix ONNX compatibility and numpy warnings"

This reverts commit cd8a0e6b8e.

* Small changes

* Remove unnecessary changes

* Bump Python version in github workflows

* Fix flake error

* Another flake error

* Even more flake errors

* Xfail more tests

* Fix mypy errors

* Change onnx version in tests

* Bump ONNX in MO

* Fix onnx utils in comp

* Minor changes

* Import pathlib

* Add xfails to compatibility tests

* Skip segfaulting tests

* Fix onnx nametuple

* Fix flake

* Try to fix py3.6 onnx

* Switch to venv in windows

* Fix model importer and reqs

* Add __test__

* Debug print

* Fix flake

* Update linux.yml

* Update windows.yml

* Update linux.yml

* Update windows.yml

* Install python3.10

* Update windows.yml

* Update windows.yml

* Update windows.yml

* Update windows.yml

* Update windows.yml

* Update windows.yml

* Update windows.yml

* Update windows.yml

* Install py embedded

* Fix dir

* Fix curl

* Add complete file

* CP file

* Bump py ver

* Fix missing venv

* Try to install

* Disable venv

* Bump OMZ commit

* checkout omz

* Revert omz

* Bump omz

* Revert pybind bump

* Update .gitmodules

* Change pybind to fork

* change ssize_t to size_t

* Install bz2 for py build

* Bump omz

* Bump pandas requirement version

* Revert omz

* Install missing clang

* Bump omz

* Bump versions on fork

* Bump numpy in model zoo

* Fix clang

* Skip segfaulting pdpd test

* Skip another pdpd test

* Skip pdpd places.cpp

* Bump py ver in setupvars.bat

* Disable paddle tests

* Use int instead of str

* Fix requirements path

* Enable lin-cc

* Fixes in CI

* lin-cc and ngrpah-onnx changes

* Update num_proc

* Update ngraph-onnx

* Minor change

* Fix env var

* Change ubuntu to 20

* Get compiler on ngraph-onnx

* Add sudo to apt-get

* Add SSL

* Download ssl

* Different way of installing ssl

* Minor changes

* install zlib

* Fix env var

* Fix docker building error

* Revert changes

* Modify dockerfile

* Change pychecks python version

* Cleanup

* Add LayerNorm to expanded ONNX functions

* Revert previous commit

* Add LayerNorm to expanded ONNX functions

* Apply clang

* Move LayerNorm tests to skip_segfault

* Unskip pdpd tests

* Enable pdpd tests on linux

* Refactoring

* Remove 3.6 from reqs

* Refactoring

* Minor changes

* Minor changes

* Relax MO reqs

* Bump torch version

* relax pytest

* Specify pytest version

* Fix pytest pip conflict

* Bump pybind11 to v2.10.1 release tag

* Specify separate pytest version for py3.10

* Bump attrs

* Add py dependency

* Refactor versions

* Add venv activation to tf tests

* Fix fdupes

* Bump OMZ submodule

* Remove find and replace

* Change pybind to upstream fork

* Set pybind to proper commit

* Minor changes

* Try to fix scipy

* Updated exclude patterns for nlohmann json

* [PyOV] Fix wheel requirements for new package versions

* Specify CPU plugin versions

* Bump OMZ version

* Fix linter

* Fix linter 2

* Fix linter 3

* Disable linter

Co-authored-by: Mateusz <mateusz.mikolajczyk@intel.com>
Co-authored-by: jiwaszki <jan.iwaszkiewicz@intel.com>
Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2022-11-08 11:38:39 +04:00

173 lines
6.9 KiB
Bash
Executable File

#!/bin/bash
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
SCRIPT_DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" >/dev/null 2>&1 && pwd )"
INSTALLDIR="${SCRIPT_DIR}"
export INTEL_OPENVINO_DIR="$INSTALLDIR"
# parse command line options
while [ $# -gt 0 ]
do
key="$1"
case $key in
-pyver)
python_version=$2
echo python_version = "${python_version}"
shift
;;
*)
# unknown option
;;
esac
shift
done
if [ -e "$INSTALLDIR/runtime" ]; then
export InferenceEngine_DIR=$INSTALLDIR/runtime/cmake
export ngraph_DIR=$INSTALLDIR/runtime/cmake
export OpenVINO_DIR=$INSTALLDIR/runtime/cmake
system_type=$(ls "$INSTALLDIR/runtime/lib/")
IE_PLUGINS_PATH=$INSTALLDIR/runtime/lib/$system_type
export HDDL_INSTALL_DIR=$INSTALLDIR/runtime/3rdparty/hddl
if [[ "$OSTYPE" == "darwin"* ]]; then
export DYLD_LIBRARY_PATH=${IE_PLUGINS_PATH}/Release:${IE_PLUGINS_PATH}/Debug${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
export LD_LIBRARY_PATH=${IE_PLUGINS_PATH}/Release:${IE_PLUGINS_PATH}/Debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=${IE_PLUGINS_PATH}/Release/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
else
export LD_LIBRARY_PATH=$HDDL_INSTALL_DIR/lib:${IE_PLUGINS_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=$IE_PLUGINS_PATH/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
fi
HDDL_UNITE_DIR=$INSTALLDIR/runtime/3rdparty/hddl_unite
if [ -e "$HDDL_UNITE_DIR" ]; then
export LD_LIBRARY_PATH=$HDDL_UNITE_DIR/lib:$HDDL_UNITE_DIR/thirdparty/XLink/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
fi
if [ -e "$INSTALLDIR/runtime/3rdparty/tbb" ]; then
tbb_lib_path=$INSTALLDIR/runtime/3rdparty/tbb/lib
if [ -d "$tbb_lib_path/$system_type" ]; then
lib_path=$(find "$tbb_lib_path/$system_type" -name "libtbb*" | sort -r | head -n1)
if [ -n "$lib_path" ]; then
tbb_lib_path=$(dirname "$lib_path")
fi
fi
if ls "$tbb_lib_path"/libtbb* >/dev/null 2>&1; then
if [[ "$OSTYPE" == "darwin"* ]]; then
export DYLD_LIBRARY_PATH=$tbb_lib_path:${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
fi
export LD_LIBRARY_PATH=$tbb_lib_path:${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH}
else
echo "[setupvars.sh] WARNING: Directory with TBB libraries is not detected. Please, add TBB libraries to LD_LIBRARY_PATH / DYLD_LIBRARY_PATH manually"
fi
if [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB" ]; then
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB
elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb" ]; then
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb
elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB" ]; then
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB
elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/cmake" ]; then
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/cmake
else
echo "[setupvars.sh] WARNING: TBB_DIR directory is not defined automatically by setupvars.sh. Please, set it manually to point to TBBConfig.cmake"
fi
fi
fi
if [ -e "$INSTALLDIR/tools/compile_tool" ]; then
export LD_LIBRARY_PATH=$INSTALLDIR/tools/compile_tool${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
fi
# OpenCV environment
if [ -f "$INSTALLDIR/opencv/setupvars.sh" ]; then
source "$INSTALLDIR/opencv/setupvars.sh"
fi
if [ -f "$INSTALLDIR/extras/opencv/setupvars.sh" ]; then
source "$INSTALLDIR/extras/opencv/setupvars.sh"
fi
OS_NAME=""
if command -v lsb_release >/dev/null 2>&1; then
OS_NAME=$(lsb_release -i -s)
fi
PYTHON_VERSION_MAJOR="3"
MIN_REQUIRED_PYTHON_VERSION_MINOR="7"
MAX_SUPPORTED_PYTHON_VERSION_MINOR="10"
check_python_version () {
if [ -z "$python_version" ]; then
python_version=$(python3 -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')
fi
# splitting Python version variable depending on the used shell
if [ -n "$ZSH_VERSION" ]; then
version_arr=(${(@s:.:)python_version})
if [ "${#version_arr[@]}" -ge "2" ]; then
# zsh starts indexing from 1
python_version_major=${version_arr[1]}
python_version_minor=${version_arr[2]}
fi
else
version_arr=(${python_version//./ })
if [ "${#version_arr[@]}" -ge "2" ]; then
python_version_major=${version_arr[0]}
python_version_minor=${version_arr[1]}
fi
fi
if [ "$PYTHON_VERSION_MAJOR" != "$python_version_major" ] ||
[ "$python_version_minor" -lt "$MIN_REQUIRED_PYTHON_VERSION_MINOR" ] ||
[ "$python_version_minor" -gt "$MAX_SUPPORTED_PYTHON_VERSION_MINOR" ] ; then
echo "[setupvars.sh] WARNING: Unsupported Python version. Please install one of Python" \
"${PYTHON_VERSION_MAJOR}.${MIN_REQUIRED_PYTHON_VERSION_MINOR} -" \
"${PYTHON_VERSION_MAJOR}.${MAX_SUPPORTED_PYTHON_VERSION_MINOR} (64-bit) from https://www.python.org/downloads/"
return 0
fi
python_bitness=$(python"$python_version" -c 'import sys; print(64 if sys.maxsize > 2**32 else 32)')
if [ "$python_bitness" != "" ] && [ "$python_bitness" != "64" ] && [ "$OS_NAME" != "Raspbian" ]; then
echo "[setupvars.sh] WARNING: 64 bitness for Python $python_version is required"
fi
if [ -n "$python_version" ]; then
if [[ -d $INTEL_OPENVINO_DIR/python ]]; then
# add path to OpenCV API for Python 3.x
export PYTHONPATH="$INTEL_OPENVINO_DIR/python/python3:$PYTHONPATH"
pydir=$INTEL_OPENVINO_DIR/python/python$python_version
if [[ -d $pydir ]]; then
# add path to Inference Engine Python API
export PYTHONPATH="${pydir}:${PYTHONPATH}"
else
echo "[setupvars.sh] WARNING: Can not find OpenVINO Python module for python${python_version} by path ${pydir}"
echo "[setupvars.sh] WARNING: OpenVINO Python environment does not set properly"
fi
else
echo "[setupvars.sh] WARNING: Can not find OpenVINO Python binaries by path ${INTEL_OPENVINO_DIR}/python"
echo "[setupvars.sh] WARNING: OpenVINO Python environment does not set properly"
fi
fi
}
python_version_to_check="$python_version"
if [ -z "$python_version" ]; then
python_version_to_check="3"
fi
if ! command -v python"$python_version_to_check" > /dev/null 2>&1; then
echo "[setupvars.sh] WARNING: Python is not installed. Please install one of Python" \
"${PYTHON_VERSION_MAJOR}.${MIN_REQUIRED_PYTHON_VERSION_MINOR} -" \
"${PYTHON_VERSION_MAJOR}.${MAX_SUPPORTED_PYTHON_VERSION_MINOR} (64-bit) from https://www.python.org/downloads/"
else
check_python_version
fi
echo "[setupvars.sh] OpenVINO environment initialized"