mathworks-ref-arch / matlab-dockerfile

Create a docker container that contains a MATLAB install
Other
336 stars 96 forks source link

Installation support packages #84

Closed toladnertum closed 8 months ago

toladnertum commented 8 months ago

Dear MPM Team,

I am trying to install Matlab and several products within docker using the attached docker file.

All products are installed successfully except the "Deep_Learning_Toolbox_Converter_for_ONNX_Model_Format' support package. If I try to install it individually, I get the following error:

Support packages will be installed to: /home/matlab/Documents/MATLAB/SupportPackages/R2023b
Error: Download failed. Check the network connection and retry.
MPM Installation Failure. See below for more information:
(Jan 11, 2024 10:09:09) Starting download of product meta data
(Jan 11, 2024 10:09:09) Finished downloading product meta data
(Jan 11, 2024 10:09:12) Starting to retrieve support package metadata
(Jan 11, 2024 10:09:13) Finished retrieving support package metadata
(Jan 11, 2024 10:09:16) Fatal Engine Exception: no components to install
(Jan 11, 2024 10:09:16) Error Message: engine error

What causes this issue?

# Copyright 2023 The MathWorks, Inc.

# To specify which MATLAB release to install in the container, edit the value of the MATLAB_RELEASE argument.
# Use lower case to specify the release, for example: ARG MATLAB_RELEASE=r2023b
ARG MATLAB_RELEASE=r2023b
ARG MATLAB_RELEASE_UPPER=R2023b

# Specify the extra products to install into the image. These products can either be toolboxes or support packages.
ARG ADDITIONAL_PRODUCTS="Symbolic_Math_Toolbox Optimization_Toolbox Statistics_and_Machine_Learning_Toolbox Deep_Learning_Toolbox Deep_Learning_Toolbox_Converter_for_ONNX_Model_Format Parallel_Computing_Toolbox"

# This Dockerfile builds on the Ubuntu-based mathworks/matlab image.
# To check the available matlab images, see: https://hub.docker.com/r/mathworks/matlab
FROM mathworks/matlab:$MATLAB_RELEASE

# Declare the global argument to use at the current build stage
ARG MATLAB_RELEASE
ARG ADDITIONAL_PRODUCTS

# By default, the MATLAB container runs as user "matlab". To install mpm dependencies, switch to root.
USER root

# Install mpm dependencies
RUN export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get install --no-install-recommends --yes \
    wget \
    unzip \
    ca-certificates \
    && apt-get clean \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*

# Run mpm to install MathWorks products into the existing MATLAB installation directory,
# and delete the mpm installation afterwards.
# Modify it by setting the ADDITIONAL_PRODUCTS defined above,
# e.g. ADDITIONAL_PRODUCTS="Statistics_and_Machine_Learning_Toolbox Parallel_Computing_Toolbox MATLAB_Coder".
# If mpm fails to install successfully then output the logfile to the terminal, otherwise cleanup.

# Switch to user matlab, and pass in $HOME variable to mpm,
# so that mpm can set the correct root folder for the support packages.
WORKDIR /tmp
USER matlab
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm \
    && chmod +x mpm \
    && EXISTING_MATLAB_LOCATION=$(dirname $(dirname $(readlink -f $(which matlab)))) \
    && sudo HOME=${HOME} ./mpm install \
        --destination=${EXISTING_MATLAB_LOCATION} \
        --release=${MATLAB_RELEASE} \
        --products ${ADDITIONAL_PRODUCTS} \
    || (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \
    && sudo rm -f mpm /tmp/mathworks_root.log
greerrrr5 commented 8 months ago

i met the same question too!!

philipc-mw commented 8 months ago

Hi,

Thank you for raising this issue, and apologies for the delayed reply.

Can you let me know the exact build command you are using to build with the above Dockerfile? Is it docker build ., or do you pass in any build arguments?

Just to clarify, when you build using the above Dockerfile, the build completes successfully and everything except Deep_Learning_Toolbox_Converter_for_ONNX_Model_Format is installed, is that correct? Can you let me know the output of matlabshared.supportpkg.getInstalled?

Thank you, Philip

toladnertum commented 8 months ago

I fixed my issue.

The startup file was modified by a later toolbox installation (via tbxmanager). This changed the userpath, which in turn lost the information about the installed support packages.

philipc-mw commented 8 months ago

Hi toladnertum,

Thank you for the update - glad your issue was resolved!

As a sidenote, the Fatal Engine Exception: no components to install error that you saw may have been due to trying to install the support package again, when it was already installed. This error is generic and could be made more helpful - this has been brought to the attention of the relevant team.

Thanks, Philip