Skip to content

Commit

Permalink
Update the setup_vdms.sh script to update the new to the Python3+
Browse files Browse the repository at this point in the history
The script file was updated to only "upgrade" the version of Python
when the current version is lower than the minimum version needed

Also some other script files were updated to call python3 only
  • Loading branch information
rolandoquesada committed Oct 17, 2024
1 parent ad00409 commit d908f32
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/Dockerfile.checkin
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ RUN git clone https://github.com/opencv/opencv.git /dependencies/opencv && \

# VALIJSON
# hadolint ignore=DL3003
RUN python -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" && \
RUN python3 -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" && \
git clone --branch ${VALIJSON_VERSION} https://github.com/tristanpenman/valijson.git /dependencies/valijson && \
cd /dependencies/valijson && cp -r include/* /usr/local/include/ && \
mkdir -p /opt/dist/usr/local/include/ && cp -r include/* /opt/dist/usr/local/include/
Expand All @@ -122,7 +122,7 @@ RUN python -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" &&
# hadolint ignore=DL3003,SC2086
RUN git clone --branch ${FAISS_VERSION} https://github.com/facebookresearch/faiss.git /dependencies/faiss && \
cd /dependencies/faiss && mkdir build && cd build && \
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=$(which python) \
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=$(which python3) \
-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release .. && \
make ${BUILD_THREADS} && make install DESTDIR=/opt/dist && make install && \
git clone https://github.com/tonyzhang617/FLINNG.git /dependencies/FLINNG && \
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/run_coverage_py.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ cd /vdms/tests/python

./run_python_tests.sh
./run_python_aws_tests.sh -u ${AWS_ACCESS_KEY_ID} -p ${AWS_SECRET_ACCESS_KEY}
python -m coverage report -m 2>&1 | tee /vdms/tests/coverage_report/python.new.coverage_report.txt
python -m coverage xml -o /vdms/tests/coverage_report/python.new.coverage_report.xml
python3 -m coverage report -m 2>&1 | tee /vdms/tests/coverage_report/python.new.coverage_report.txt
python3 -m coverage xml -o /vdms/tests/coverage_report/python.new.coverage_report.xml

echo "DONE"

Expand Down
17 changes: 6 additions & 11 deletions .github/scripts/setup_vdms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ fi


# SETUP PYTHON VERSION
version_exists=$(echo "$(python --version | cut -d ' ' -f 2)" || echo false)
if [ "${version_exists}" != "${PYTHON_VERSION}" ]
version_exists=$(echo "$(python3 --version | cut -d ' ' -f 2)" || echo false)
# Compare the current version of Python with the $PYTHON_VERSION
if $(dpkg --compare-versions "${version_exists}" "lt" "${PYTHON_VERSION}")
then
echo "Installing python ${PYTHON_VERSION}..."
apt update -y
Expand All @@ -159,16 +160,10 @@ then
# and update the new path to Python3
ln -s /usr/local/bin/python${PYTHON_BASE} /usr/bin/python3
fi
# Do the same for /usr/bin/python
if [ -f "/usr/bin/python" ]; then
rm /usr/bin/python
ln -s /usr/local/bin/python${PYTHON_BASE} /usr/bin/python
fi
fi
else
echo "python ${PYTHON_VERSION} already installed"
fi
alias python=$(which python${PYTHON_BASE})
alias python3=$(which python${PYTHON_BASE})

python${PYTHON_BASE} -m venv ${VIRTUAL_ENV}
Expand All @@ -177,7 +172,7 @@ export PATH="$VIRTUAL_ENV/bin:$PATH"

if [ "${BUILD_COVERAGE}" = "on" ]; then
apt-get install -y --no-install-suggests --no-install-recommends gdb
python -m pip install --no-cache-dir "gcovr>=7.0"
python3 -m pip install --no-cache-dir "gcovr>=7.0"
curl -L -o ${WORKSPACE}/minio https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x ${WORKSPACE}/minio
mkdir -p ${WORKSPACE}/minio_files/minio-bucket
Expand Down Expand Up @@ -255,7 +250,7 @@ make install


# INSTALL PYTHON PACKAGES
python -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" "coverage>=7.3.1" \
python3 -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" "coverage>=7.3.1" \
"protobuf==4.${PROTOBUF_VERSION}" "cryptography>=42.0.7"


Expand All @@ -269,7 +264,7 @@ cp -r include/* /usr/local/include/
git clone --branch ${FAISS_VERSION} https://github.com/facebookresearch/faiss.git $VDMS_DEP_DIR/faiss
cd $VDMS_DEP_DIR/faiss
mkdir build && cd build
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=$(which python) \
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=$(which python3) \
-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
make ${BUILD_THREADS}
make install
Expand Down
8 changes: 4 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Here is the detailed process of installation of VDMS dependencies.

## Dependencies
To install VDMS, we must install the necessary dependencies via apt, github, and pip (Python 3.9+).
To install VDMS, we must install the necessary dependencies via apt, github, and pip (Python 3.12+).

### Install Debian/Ubuntu Packages
Here we will install the Debian/Ubuntu packages.
Expand Down Expand Up @@ -58,8 +58,8 @@ mkdir -p $VDMS_DEP_DIR


#### Python3 Packages
It is expected that you have Python3.9 or higher installed on your system.
All python calls will use Python3.9+; therefore you may find it convenient to set alias for python.
It is expected that you have Python3.12 or higher installed on your system.
All python calls will use Python3.12+; therefore you may find it convenient to set alias for python.
Here we will install Python 3.12.3 from the Python website.
```bash
PYTHON_VERSION=3.12.3
Expand All @@ -75,7 +75,7 @@ If you prefer, you can install the the Python 3 version available on the OS plat
sudo apt-get install -y python3-dev python3-pip
```

***NOTE:*** If multiple versions of Python 3 are present on your system, verify you are using Python3.9 or higher. You can specify the specific verison and set an alias for `python` and/or `python3` to easily use the desired python version. This can be done using the following:
***NOTE:*** If multiple versions of Python 3 are present on your system, verify you are using Python3.12 or higher. You can specify the specific verison and set an alias for `python` and/or `python3` to easily use the desired python version. This can be done using the following:
```bash
alias python=/usr/bin/python3.x
alias python3=/usr/bin/python3.x
Expand Down
4 changes: 2 additions & 2 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ RUN git clone https://github.com/opencv/opencv.git /dependencies/opencv && \

# VALIJSON
# hadolint ignore=DL3003
RUN python -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" && \
RUN python3 -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" && \
git clone --branch ${VALIJSON_VERSION} https://github.com/tristanpenman/valijson.git /dependencies/valijson && \
cd /dependencies/valijson && cp -r include/* /usr/local/include/ && \
mkdir -p /opt/dist/usr/local/include/ && cp -r include/* /opt/dist/usr/local/include/
Expand All @@ -122,7 +122,7 @@ RUN python -m pip install --no-cache-dir "numpy>=${NUMPY_MIN_VERSION},<2.0.0" &&
# hadolint ignore=DL3003,SC2086
RUN git clone --branch ${FAISS_VERSION} https://github.com/facebookresearch/faiss.git /dependencies/faiss && \
cd /dependencies/faiss && mkdir build && cd build && \
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=$(which python) \
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=$(which python3) \
-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release .. && \
make ${BUILD_THREADS} && make install DESTDIR=/opt/dist && make install && \
git clone https://github.com/tonyzhang617/FLINNG.git /dependencies/FLINNG && \
Expand Down

0 comments on commit d908f32

Please sign in to comment.