Skip to content

Commit

Permalink
Setup Upgrades - PIP package and OS identity (#1376)
Browse files Browse the repository at this point in the history
* Setup - Updates and cmake3

* Numpy - Upgrade Version

* Setup - Update OS check
  • Loading branch information
kiritigowda authored Jun 5, 2024
1 parent bace985 commit c767347
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Documentation for MIVisionX is available at
* OpenCV - [4.6.0](https://github.com/opencv/opencv/releases/tag/4.6.0)
* FFMPEG - [n4.4.2](https://github.com/FFmpeg/FFmpeg/releases/tag/n4.4.2)
* Dependencies for all the above packages
* MIVisionX Setup Script - `V3.2.0`
* MIVisionX Setup Script - `V3.3.0`

### Known issues

Expand Down
63 changes: 38 additions & 25 deletions MIVisionX-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

__copyright__ = "Copyright 2018 - 2024, AMD ROCm MIVisionX"
__license__ = "MIT"
__version__ = "3.2.0"
__version__ = "3.3.0"
__email__ = "mivisionx.support@amd.com"
__status__ = "Shipping"

Expand Down Expand Up @@ -133,7 +133,6 @@ def ERROR_CHECK(call):
print("\nSTATUS: CPU Backend Install\n")
neuralNetInstall = 'OFF'
inferenceInstall = 'OFF'
ffmpegInstall = 'OFF'

# get platfrom info
platfromInfo = platform.platform()
Expand All @@ -160,44 +159,49 @@ def ERROR_CHECK(call):
deps_dir = os.path.expanduser(setupDir_deps)
deps_dir = os.path.abspath(deps_dir)

# check os version
os_info_data = 'NOT Supported'
if os.path.exists('/etc/os-release'):
with open('/etc/os-release', 'r') as os_file:
os_info_data = os_file.read().replace('\n', ' ')
os_info_data = os_info_data.replace('"', '')

# setup for Linux
linuxSystemInstall = ''
linuxCMake = 'cmake'
linuxSystemInstall_check = ''
linuxFlag = ''
if "centos" in platfromInfo or "redhat" in platfromInfo or os.path.exists('/usr/bin/yum'):
if "centos" in os_info_data or "redhat" in os_info_data or os.path.exists('/usr/bin/yum'):
linuxSystemInstall = 'yum -y'
linuxSystemInstall_check = '--nogpgcheck'
if "centos-7" in platfromInfo or "redhat-7" in platfromInfo:
if "VERSION_ID=7" in os_info_data:
linuxCMake = 'cmake3'
ERROR_CHECK(os.system(linuxSystemInstall+' install cmake3'))
if "centos" not in platfromInfo or "redhat" not in platfromInfo:
if "8" in platform.version():
platfromInfo = platfromInfo+'-redhat-8'
elif "9" in platform.version():
platfromInfo = platfromInfo+'-redhat-9'
else:
platfromInfo = platfromInfo+'-redhat-centos-undefined-version'
elif "Ubuntu" in platfromInfo or os.path.exists('/usr/bin/apt-get'):
platfromInfo = platfromInfo+'-redhat-7'
elif "VERSION_ID=8" in os_info_data:
platfromInfo = platfromInfo+'-redhat-8'
elif "VERSION_ID=9" in os_info_data:
platfromInfo = platfromInfo+'-redhat-9'
else:
platfromInfo = platfromInfo+'-redhat-centos-undefined-version'
elif "Ubuntu" in os_info_data or os.path.exists('/usr/bin/apt-get'):
linuxSystemInstall = 'apt-get -y'
linuxSystemInstall_check = '--allow-unauthenticated'
linuxFlag = '-S'
if "Ubuntu" not in platfromInfo:
if "20" in platform.version():
platfromInfo = platfromInfo+'-Ubuntu-20'
elif "22" in platform.version():
platfromInfo = platfromInfo+'-Ubuntu-22'
elif "24" in platform.version():
platfromInfo = platfromInfo+'-Ubuntu-24'
else:
platfromInfo = platfromInfo+'-Ubuntu-undefined-version'
elif os.path.exists('/usr/bin/zypper'):
if "VERSION_ID=20" in os_info_data:
platfromInfo = platfromInfo+'-Ubuntu-20'
elif "VERSION_ID=22" in os_info_data:
platfromInfo = platfromInfo+'-Ubuntu-22'
elif "VERSION_ID=24" in os_info_data:
platfromInfo = platfromInfo+'-Ubuntu-24'
else:
platfromInfo = platfromInfo+'-Ubuntu-undefined-version'
elif "SLES" in os_info_data or os.path.exists('/usr/bin/zypper'):
linuxSystemInstall = 'zypper -n'
linuxSystemInstall_check = '--no-gpg-checks'
platfromInfo = platfromInfo+'-SLES'
else:
print("\nMIVisionX Setup on "+platfromInfo+" is unsupported\n")
print("\nMIVisionX Setup Supported on: Ubuntu 20/22, CentOS 7, RedHat 8/9, & SLES 15\n")
print("\nMIVisionX Setup Supported on: Ubuntu 20/22, RedHat 8/9, & SLES 15\n")
exit()

# MIVisionX Setup
Expand Down Expand Up @@ -255,7 +259,7 @@ def ERROR_CHECK(call):
pip3InferencePackagesUbuntu = [
'future==0.18.2',
'pytz==2022.1',
'numpy==1.22',
'numpy==1.23.0',
'google==3.0.0',
'protobuf==3.12.4',
'onnx==1.12.0'
Expand Down Expand Up @@ -327,6 +331,9 @@ def ERROR_CHECK(call):
'unzip'
]

# update
ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall +' '+linuxSystemInstall_check+' update'))

# Re-Install
if os.path.exists(deps_dir):
print("\nMIVisionX Setup: Re-Installing Libraries from -- "+deps_dir+"\n")
Expand All @@ -335,6 +342,9 @@ def ERROR_CHECK(call):
for i in range(len(commonPackages)):
ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall +
' '+linuxSystemInstall_check+' install -y '+ commonPackages[i]))
if "centos-7" in platfromInfo or "redhat-7" in platfromInfo:
ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall +
' '+linuxSystemInstall_check+' install cmake3'))

# neural net packages
if neuralNetInstall == 'ON' and backend == 'HIP':
Expand Down Expand Up @@ -382,6 +392,9 @@ def ERROR_CHECK(call):
for i in range(len(commonPackages)):
ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall +
' '+linuxSystemInstall_check+' install -y '+ commonPackages[i]))
if "centos-7" in platfromInfo or "redhat-7" in platfromInfo:
ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall +
' '+linuxSystemInstall_check+' install cmake3'))

# neural net packages
if neuralNetInstall == 'ON' and backend == 'HIP':
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Review all notable [changes](CHANGELOG.md#changelog) with the latest release
* OpenCV - [4.6.0](https://github.com/opencv/opencv/releases/tag/4.6.0)
* FFMPEG - [n4.4.2](https://github.com/FFmpeg/FFmpeg/releases/tag/n4.4.2)
* Dependencies for all the above packages
* MIVisionX Setup Script - `V3.2.0`
* MIVisionX Setup Script - `V3.3.0`
### Known issues
Expand Down
2 changes: 1 addition & 1 deletion docker/mivisionx-on-ubuntu20.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ENV CUPY_INSTALL_USE_HIP=1
ENV ROCM_HOME=/opt/rocm
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install git g++ hipblas hipsparse rocrand hipfft rocfft rocthrust-dev hipcub-dev python3 python3-pip python3-dev && \
git clone -b v12.2.0 https://github.com/ROCmSoftwarePlatform/cupy.git && \
git submodule update --init && pip install -e . --no-cache-dir -vvvv && pip install numpy==1.22 && cd
git submodule update --init && pip install -e . --no-cache-dir -vvvv && pip install numpy==1.23.0 && cd

ENV MIVISIONX_WORKSPACE=/workspace
WORKDIR $MIVISIONX_WORKSPACE
Expand Down
2 changes: 1 addition & 1 deletion docker/ubuntu20/level-5.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ENV CUPY_INSTALL_USE_HIP=1
ENV ROCM_HOME=/opt/rocm
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install git g++ hipblas hipsparse rocrand hipfft rocfft rocthrust-dev hipcub-dev python3 python3-pip python3-dev && \
git clone -b v12.2.0 https://github.com/ROCmSoftwarePlatform/cupy.git && \
git submodule update --init && pip install -e . --no-cache-dir -vvvv && pip install numpy==1.22 && cd
git submodule update --init && pip install -e . --no-cache-dir -vvvv && pip install numpy==1.23.0 && cd

ENV MIVISIONX_WORKSPACE=/workspace
WORKDIR $MIVISIONX_WORKSPACE
Expand Down
2 changes: 1 addition & 1 deletion docker/ubuntu22/level-5.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install git g++ hipblas hipsparse
pip install pytest==3.1 && git clone -b v2.10.4 https://github.com/pybind/pybind11 && cd pybind11 && mkdir build && cd build && \
cmake -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON ../ && make -j4 && sudo make install && cd ../../ && \
git clone -b v12.2.0 https://github.com/ROCmSoftwarePlatform/cupy.git && cd cupy && git submodule update --init && \
pip install -e . --no-cache-dir -vvvv && pip install numpy==1.22
pip install -e . --no-cache-dir -vvvv && pip install numpy==1.23.0

ENV MIVISIONX_WORKSPACE=/workspace
WORKDIR $MIVISIONX_WORKSPACE
Expand Down
2 changes: 1 addition & 1 deletion docs/install/model-compiler-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Prerequisites

.. code-block:: shell
sudo pip3 install future==0.18.2 pytz==2022.1 numpy==1.22
sudo pip3 install future==0.18.2 pytz==2022.1 numpy==1.23.0
.. note::
Expand Down
2 changes: 1 addition & 1 deletion model_compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ MIVisionX allows hundreds of different [OpenVX](https://www.khronos.org/registry
```
* PIP3 Packages
```
sudo pip3 install future==0.18.2 pytz==2022.1 numpy==1.22
sudo pip3 install future==0.18.2 pytz==2022.1 numpy==1.23.0
```

**Note:** MIVisionX installs model compiler scripts at `/opt/rocm/libexec/mivisionx/model_compiler/python/`
Expand Down
2 changes: 1 addition & 1 deletion tests/neural_network_tests/runNeuralNetworkTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def script_info():
pip3InferencePackagesDebian = [
'future==0.18.2',
'pytz==2022.1',
'numpy==1.22',
'numpy==1.23.0',
'google==3.0.0',
'protobuf==3.12.4',
'onnx==1.12.0'
Expand Down

0 comments on commit c767347

Please sign in to comment.