Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg baseline][tensorflow] setup python venv #21912

Merged
merged 21 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d3121ce
Merge pull request #1 from microsoft/master
jgehw Aug 17, 2020
c743e49
Revert "incorporate changes from microsoft:master"
jgehw Aug 18, 2020
2571bd1
Merge pull request #2 from jgehw/revert-1-master
jgehw Aug 18, 2020
98ecc0c
Revert "Revert "incorporate changes from microsoft:master""
jgehw Aug 18, 2020
39312c7
Merge branch 'master' of https://github.com/microsoft/vcpkg
Oct 1, 2020
d3e3c2a
Merge branch 'master' of https://github.com/microsoft/vcpkg
Oct 10, 2020
7bfae95
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Dec 3, 2020
3c9d47e
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Feb 4, 2021
c15f4cd
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Sep 17, 2021
3485e0e
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Oct 11, 2021
6725fb8
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Dec 7, 2021
90a74d7
preliminary approach to solve pip issue
jgehw Dec 7, 2021
1b0b980
fix python venv
jgehw Dec 8, 2021
4118333
fix macOS build command again
jgehw Dec 8, 2021
39fa851
bump version
jgehw Dec 8, 2021
83ecfa6
x-add-version
jgehw Dec 8, 2021
5b9d5ff
Merge remote-tracking branch 'origin/master' into fix-tf-macos
BillyONeal Dec 9, 2021
8471625
Fix spelling of prerequisites.
BillyONeal Dec 9, 2021
02e9925
Add python3-venv
BillyONeal Dec 9, 2021
fb29583
Merge remote-tracking branch 'origin/master' into HEAD
BillyONeal Dec 13, 2021
b965e52
Update linux pool.
BillyONeal Dec 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ports/tensorflow-common/generate_static_link_cmd_linux.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import re
import sys

version = sys.argv[2]
lib_suffix = "" if len(sys.argv) < 4 else sys.argv[3]
params_path = sys.argv[2]
version = sys.argv[3]
lib_suffix = "" if len(sys.argv) < 5 else sys.argv[4]

with open(sys.argv[1], "r") as f_in:
with open("static_link.sh", "w") as f_out:
Expand Down
7 changes: 4 additions & 3 deletions ports/tensorflow-common/generate_static_link_cmd_macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import re
import sys

version = sys.argv[2]
lib_suffix = "" if len(sys.argv) < 4 else sys.argv[3]
params_path = sys.argv[2]
version = sys.argv[3]
lib_suffix = "" if len(sys.argv) < 5 else sys.argv[4]

with open(sys.argv[1], "r") as f_in:
with open("static_link.sh", "w") as f_out:
if os.path.isfile(f"libtensorflow_framework.{version}.dylib-2.params"):
if os.path.isfile(f"{params_path}/libtensorflow_framework.{version}.dylib-2.params"):
p_cd = re.compile(r"^\((cd .*) && \\$")
p_linker = re.compile(fr"^\s*.+cc_wrapper.sh.+(@bazel-out\S+libtensorflow{lib_suffix}\.\d\.\d\.\d\.dylib-2\.params).*")
f_out.write("#!/bin/bash\n# note: ar/binutils version 2.27 required to support output files > 4GB\n")
Expand Down
5 changes: 3 additions & 2 deletions ports/tensorflow-common/generate_static_link_cmd_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import re
import sys

version = sys.argv[2]
lib_suffix = "" if len(sys.argv) < 4 else sys.argv[3]
params_path = sys.argv[2]
version = sys.argv[3]
lib_suffix = "" if len(sys.argv) < 5 else sys.argv[4]

with open(sys.argv[1], "r") as f_in:
with open("static_link.bat", "w") as f_out:
Expand Down
23 changes: 14 additions & 9 deletions ports/tensorflow-common/tensorflow-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(ENV{BAZEL_BIN_PATH} "${BAZEL}")
function(tensorflow_try_remove_recurse_wait PATH_TO_REMOVE)
file(REMOVE_RECURSE ${PATH_TO_REMOVE})
if(EXISTS "${PATH_TO_REMOVE}")
vcpkg_execute_required_process(COMMAND ${CMAKE_COMMAND} -E sleep 5 WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequesits-sleep-${TARGET_TRIPLET})
vcpkg_execute_required_process(COMMAND ${CMAKE_COMMAND} -E sleep 5 WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-sleep-${TARGET_TRIPLET})
file(REMOVE_RECURSE ${PATH_TO_REMOVE})
endif()
endfunction()
Expand Down Expand Up @@ -39,29 +39,34 @@ if(CMAKE_HOST_WIN32)
set(ENV{BAZEL_VC_FULL_VERSION} $ENV{VCToolsVersion})

set(PYTHON3 "${MSYS_ROOT}/mingw64/bin/python3.exe")
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import site; print(site.getsitepackages()[0])" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequesits-pypath-${TARGET_TRIPLET} OUTPUT_VARIABLE PYTHON_LIB_PATH)
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import site; print(site.getsitepackages()[0])" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pypath-${TARGET_TRIPLET} OUTPUT_VARIABLE PYTHON_LIB_PATH)
else()
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path(PREPEND ${PYTHON3_DIR})

vcpkg_execute_required_process(COMMAND ${PYTHON3} -m venv --symlinks "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-venv-${TARGET_TRIPLET})
vcpkg_add_to_path(PREPEND ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv/bin)
set(PYTHON3 ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv/bin/python3)
set(ENV{VIRTUAL_ENV} ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv)

if(VCPKG_TARGET_IS_OSX)
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install -U pip WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pip-${TARGET_TRIPLET})
# acceleration libs currently broken on macOS => force numpy user space reinstall without BLAS/LAPACK/ATLAS
# remove this work-around again, i.e. default to "else" branch, once acceleration libs are fixed upstream
set(ENV{BLAS} "None")
set(ENV{LAPACK} "None")
set(ENV{ATLAS} "None")
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install --user -U --force-reinstall numpy WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequesits-pip-${TARGET_TRIPLET})
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install -U --force-reinstall numpy WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequistes-pip-${TARGET_TRIPLET})
else()
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install --user -U numpy WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequesits-pip-${TARGET_TRIPLET})
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install -U pip numpy WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pip-${TARGET_TRIPLET})
endif()
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import site; print(site.getusersitepackages())" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequesits-pypath-${TARGET_TRIPLET} OUTPUT_VARIABLE PYTHON_LIB_PATH)

vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import site; print(site.getusersitepackages())" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pypath-${TARGET_TRIPLET} OUTPUT_VARIABLE PYTHON_LIB_PATH)
endif()
set(ENV{PYTHON_BIN_PATH} "${PYTHON3}")
set(ENV{PYTHON_LIB_PATH} "${PYTHON_LIB_PATH}")

# check if numpy can be loaded
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import numpy" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequesits-numpy-${TARGET_TRIPLET})
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import numpy" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-numpy-${TARGET_TRIPLET})

set(ENV{USE_DEFAULT_PYTHON_LIB_PATH} 1)
set(ENV{TF_NEED_KAFKA} 0)
Expand Down Expand Up @@ -286,7 +291,7 @@ foreach(BUILD_TYPE dbg rel)
endif()
# for some reason stdout of bazel ends up in stderr, so use err log file in the following command
vcpkg_execute_build_process(
COMMAND ${PYTHON3} "${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_${PLATFORM_SUFFIX}.py" "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-${BUILD_TYPE}-err.log" ${TF_VERSION} ${TF_LIB_SUFFIX}
COMMAND ${PYTHON3} "${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_${PLATFORM_SUFFIX}.py" "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-${BUILD_TYPE}-err.log" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow" ${TF_VERSION} ${TF_LIB_SUFFIX}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME postbuild2-${TARGET_TRIPLET}-${BUILD_TYPE}
)
Expand Down
1 change: 1 addition & 0 deletions ports/tensorflow-common/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "tensorflow-common",
"version-semver": "2.6.0",
"port-version": 1,
"description": "This meta package holds common files for the C [tensorflow] and the C++ [tensorflow-cc] API version of TensorFlow but is not installable on its own.",
"homepage": "https://github.com/tensorflow/tensorflow"
}
2 changes: 1 addition & 1 deletion scripts/azure-pipelines/linux/provision-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ APT_PACKAGES="$APT_PACKAGES libxcb-res0-dev"
APT_PACKAGES="$APT_PACKAGES python3-setuptools python3-mako"

# Additionally required by some packages to install additional python packages
APT_PACKAGES="$APT_PACKAGES python3-pip"
APT_PACKAGES="$APT_PACKAGES python3-pip python3-venv"

# Additionally required by qtwebengine
APT_PACKAGES="$APT_PACKAGES nodejs"
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6690,7 +6690,7 @@
},
"tensorflow-common": {
"baseline": "2.6.0",
"port-version": 0
"port-version": 1
},
"tensorpipe": {
"baseline": "2021-04-26",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/tensorflow-common.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e766afec982de89398663f587da490fc8996474f",
"version-semver": "2.6.0",
"port-version": 1
},
{
"git-tree": "84662f791eb9d38350a4ffe99cd80d49f562b10f",
"version-semver": "2.6.0",
Expand Down