diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index ef7663a03ce92a..d5439a3c5e1901 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -40,16 +40,11 @@ RUN apt-get update && apt-get -y --no-install-recommends install \ python3-dev \ pybind11-dev \ python3-virtualenv \ - python3-venv \ + cython3 \ tox && \ apt-get clean autoclean && \ apt-get autoremove -y -RUN python3 -m venv ~/.venv -RUN . ~/.venv/bin/activate -RUN which python3 -RUN python3 -m pip install "cython>=3.0.0" --break-system-packages - # Build OpenVINO COPY . /openvino/ WORKDIR /openvino/build @@ -70,8 +65,7 @@ RUN cmake .. \ -DENABLE_OV_PYTORCH_FRONTEND=ON \ -DENABLE_OV_TF_FRONTEND=OFF \ -DENABLE_OPENVINO_DEBUG=OFF \ - -DCMAKE_INSTALL_PREFIX=/openvino/dist \ - -DPYTHON_EXECUTABLE=`which python3` + -DCMAKE_INSTALL_PREFIX=/openvino/dist RUN ninja install # Run tests via tox diff --git a/docs/requirements.txt b/docs/requirements.txt index 834c1aafbf92b9..10f970b6268452 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -5,7 +5,7 @@ Babel==2.11.0 beautifulsoup4==4.9.3 certifi==2023.7.22 colorama==0.4.6 -Cython==3.0.2 +Cython==0.29.33 docutils==0.16 idna==3.4 imagesize==1.2.0 diff --git a/src/bindings/python/src/compatibility/openvino/CMakeLists.txt b/src/bindings/python/src/compatibility/openvino/CMakeLists.txt index 5b7d2efa4b8356..6a1c48777cfa70 100644 --- a/src/bindings/python/src/compatibility/openvino/CMakeLists.txt +++ b/src/bindings/python/src/compatibility/openvino/CMakeLists.txt @@ -21,13 +21,11 @@ endif() include (cmake/UseCython.cmake) -# TODO: Reenable once Windows issue is resolved -# # Check Cython version -# if(CYTHON_VERSION VERSION_LESS "3.0.0") -# message(FATAL_ERROR "OpenVINO Python API needs at least Cython version 3.0.0, found version ${CYTHON_VERSION}") -# else() -# message(STATUS "Found Cython version ${CYTHON_VERSION}") -# endif() +if(CYTHON_VERSION VERSION_LESS 0.29) + message(FATAL_ERROR "OpenVINO Python API needs at least Cython version 0.29, found version ${CYTHON_VERSION}") +else() + message(STATUS "Found Cython version ${CYTHON_VERSION}") +endif() set(pyversion python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) diff --git a/src/bindings/python/src/compatibility/openvino/cmake/CythonConfig.cmake b/src/bindings/python/src/compatibility/openvino/cmake/CythonConfig.cmake index 8129313410c76c..4cc32dacec1375 100644 --- a/src/bindings/python/src/compatibility/openvino/cmake/CythonConfig.cmake +++ b/src/bindings/python/src/compatibility/openvino/cmake/CythonConfig.cmake @@ -50,7 +50,30 @@ include( FindPackageHandleStandardArgs ) FIND_PACKAGE_HANDLE_STANDARD_ARGS( Cython REQUIRED_VARS CYTHON_EXECUTABLE ) # Find Cython version -execute_process(COMMAND ${CYTHON_EXECUTABLE} -V ERROR_VARIABLE CYTHON_OUTPUT) -string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9]+(\\.[0-9]+)?).*" "\\1" CYTHON_VERSION "${CYTHON_OUTPUT}") +execute_process(COMMAND ${CYTHON_EXECUTABLE} -V + ERROR_VARIABLE CYTHON_OUTPUT + OUTPUT_VARIABLE CYTHON_ERROR_MESSAGE + RESULT_VARIABLE CYTHON_EXIT_CODE + OUTPUT_STRIP_TRAILING_WHITESPACE) + +if(CYTHON_EXIT_CODE EQUAL 0) + if(NOT CYTHON_OUTPUT) + set(CYTHON_OUTPUT "${CYTHON_ERROR_MESSAGE}") + endif() + string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9]+(\\.[0-9]+)?).*" "\\1" CYTHON_VERSION "${CYTHON_OUTPUT}") +else() + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(CYTHON_MESSAGE_MODE TRACE) + endif() + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(CYTHON_MESSAGE_MODE FATAL_ERROR) + endif() + message(${CYTHON_MESSAGE_MODE} "Failed to detect cython version: ${CYTHON_ERROR_MESSAGE}") + unset(CYTHON_MESSAGE_MODE) +endif() + +unset(CYTHON_OUTPUT) +unset(CYTHON_EXIT_CODE) +unset(CYTHON_ERROR_MESSAGE) mark_as_advanced( CYTHON_EXECUTABLE CYTHON_VERSION ) diff --git a/src/bindings/python/src/compatibility/openvino/requirements-dev.txt b/src/bindings/python/src/compatibility/openvino/requirements-dev.txt index 8b4d6888dcb55e..aca50982d0dc53 100644 --- a/src/bindings/python/src/compatibility/openvino/requirements-dev.txt +++ b/src/bindings/python/src/compatibility/openvino/requirements-dev.txt @@ -1 +1 @@ -Cython>=3.0.0 +cython>=0.29.32