diff --git a/cm-mlops/script/app-image-classification-onnx-py/run.sh b/cm-mlops/script/app-image-classification-onnx-py/run.sh index 2b5e8b7701..62b07e1f10 100644 --- a/cm-mlops/script/app-image-classification-onnx-py/run.sh +++ b/cm-mlops/script/app-image-classification-onnx-py/run.sh @@ -23,7 +23,7 @@ export CK_BATCH_COUNT=${CM_BATCH_COUNT} if [[ "${CM_INPUT}" != "" ]]; then export CM_IMAGE=${CM_INPUT}; fi -PIP_EXTRA=`${CM_PYTHON_BIN} -c "import pkg_resources; print(' --break-system-packages ' if int(pkg_resources.get_distribution('pip').version.split('.')[0]) >= 23 else '')"` +PIP_EXTRA=`${CM_PYTHON_BIN} -c "import importlib.metadata; print(' --break-system-packages ' if int(importlib.metadata.version('pip').split('.')[0]) >= 23 else '')"` echo "" ${CM_PYTHON_BIN} -m pip install -r ${CM_TMP_CURRENT_SCRIPT_PATH}/requirements.txt ${PIP_EXTRA} diff --git a/cm-mlops/script/get-sys-utils-cm/do_pip_installs.sh b/cm-mlops/script/get-sys-utils-cm/do_pip_installs.sh index 55a1492492..cbf7e58579 100644 --- a/cm-mlops/script/get-sys-utils-cm/do_pip_installs.sh +++ b/cm-mlops/script/get-sys-utils-cm/do_pip_installs.sh @@ -1,6 +1,6 @@ #!/bin/bash -PIP_EXTRA=`python3 -c "import pkg_resources; print(' --break-system-packages ' if int(pkg_resources.get_distribution('pip').version.split('.')[0]) >= 23 else '')"` +PIP_EXTRA=`python3 -c "import importlib.metadata; print(' --break-system-packages ' if int(importlib.metadata.version('pip').split('.')[0]) >= 23 else '')"` cmd="python3 -m pip install -r ${CM_TMP_CURRENT_SCRIPT_PATH}/requirements.txt ${CM_PYTHON_PIP_USER} ${CM_PYTHON_PIP_COMMON_EXTRA} ${PIP_EXTRA}" echo $cmd eval $cmd diff --git a/cm-mlops/script/get-sys-utils-cm/do_pip_installs.sh.old b/cm-mlops/script/get-sys-utils-cm/do_pip_installs.sh.old new file mode 100644 index 0000000000..55a1492492 --- /dev/null +++ b/cm-mlops/script/get-sys-utils-cm/do_pip_installs.sh.old @@ -0,0 +1,6 @@ +#!/bin/bash + +PIP_EXTRA=`python3 -c "import pkg_resources; print(' --break-system-packages ' if int(pkg_resources.get_distribution('pip').version.split('.')[0]) >= 23 else '')"` +cmd="python3 -m pip install -r ${CM_TMP_CURRENT_SCRIPT_PATH}/requirements.txt ${CM_PYTHON_PIP_USER} ${CM_PYTHON_PIP_COMMON_EXTRA} ${PIP_EXTRA}" +echo $cmd +eval $cmd diff --git a/cm-mlops/script/get-tensorrt/run.sh b/cm-mlops/script/get-tensorrt/run.sh index ac06cbf885..ac3b30a9d0 100644 --- a/cm-mlops/script/get-tensorrt/run.sh +++ b/cm-mlops/script/get-tensorrt/run.sh @@ -4,7 +4,7 @@ if [[ ${CM_TENSORRT_VERSION} == 'vdetected' ]]; then exit 0; fi -PIP_EXTRA=`python3 -c "import pkg_resources; print(' --break-system-packages ' if int(pkg_resources.get_distribution('pip').version.split('.')[0]) >= 23 else '')"` +PIP_EXTRA=`python3 -c "import importlib.metadata; print(' --break-system-packages ' if int(importlib.metadata.version('pip').split('.')[0]) >= 23 else '')"` version=${CM_TENSORRT_VERSION} install_dir=${CM_TENSORRT_INSTALL_PATH} diff --git a/cm-mlops/script/install-python-venv/run.sh b/cm-mlops/script/install-python-venv/run.sh index ac1d86f457..87dfcaf10d 100644 --- a/cm-mlops/script/install-python-venv/run.sh +++ b/cm-mlops/script/install-python-venv/run.sh @@ -1,6 +1,7 @@ #!/bin/bash -PIP_EXTRA=`${CM_PYTHON_BIN} -c "import pkg_resources; print(' --break-system-packages ' if int(pkg_resources.get_distribution('pip').version.split('.')[0]) >= 23 else '')"` +#PIP_EXTRA=`${CM_PYTHON_BIN} -c "import pkg_resources; print(' --break-system-packages ' if int(pkg_resources.get_distribution('pip').version.split('.')[0]) >= 23 else '')"` +PIP_EXTRA=`${CM_PYTHON_BIN} -c "import importlib.metadata; print(' --break-system-packages ' if int(importlib.metadata.version('pip').split('.')[0]) >= 23 else '')"` ${CM_PYTHON_BIN_WITH_PATH} -m pip install virtualenv ${PIP_EXTRA} test $? -eq 0 || exit 1