I have trouble importing PyTorch in my jetson nano (jetpack 4.4). I have successfully installed it from .whl file. please help.
==> Launching app...Traceback (most recent call last): File "/code/catkin_ws/src/duckietown-safe-ml-demo/packages/safe_ml/src/ood_node.py", line 13, in <module> import torch File "/usr/local/lib/python3.8/dist-packages/torch/__init__.py", line 290, in <module> from torch._C import * # noqa: F403ImportError: /usr/local/lib/python3.8/dist-packages/torch/lib/../../torch.libs/libgomp-804f19d4.so.1.0.0: cannot allocate memory in static TLS block
I am able to build docker image successfully, but when I try to run image, at that time it says that this error.
please Help!!!
# parameters ARG REPO_NAME="duckietown-safe-ml-demo" ARG DESCRIPTION="Safe ML on the Duckie Town Platform" ARG MAINTAINER="michaelj004@e.ntu.edu.sg" # pick an icon from: https://fontawesome.com/v4.7.0/icons/ ARG ICON="cube" # ==================================================> # ==> Do not change the code below this line ARG ARCH=arm32v7 ARG DISTRO=daffy ARG BASE_TAG=${DISTRO}-${ARCH} ARG BASE_IMAGE=dt-ros-commons ARG LAUNCHER=default # define base image FROM duckietown/${BASE_IMAGE}:${BASE_TAG} as BASE # Changed to have the full suite of DT-packages. #ARG AIDO_REGISTRY=docker.io #FROM ${AIDO_REGISTRY}/duckietown/dt-car-interface:${BASE_TAG} AS dt-car-interface #FROM ${AIDO_REGISTRY}/duckietown/dt-core:${BASE_TAG} AS base # recall all arguments ARG ARCH ARG DISTRO ARG REPO_NAME ARG DESCRIPTION ARG MAINTAINER ARG ICON ARG BASE_TAG ARG BASE_IMAGE ARG LAUNCHER # check build arguments RUN dt-build-env-check "${REPO_NAME}" "${MAINTAINER}" "${DESCRIPTION}" # define/create repository path ARG REPO_PATH="${CATKIN_WS_DIR}/src/${REPO_NAME}" ARG LAUNCH_PATH="${LAUNCH_DIR}/${REPO_NAME}" RUN mkdir -p "${REPO_PATH}" RUN mkdir -p "${LAUNCH_PATH}" #WORKDIR "${REPO_PATH}" WORKDIR /code #COPY --from=dt-car-interface ${CATKIN_WS_DIR}/src/dt-car-interface ${CATKIN_WS_DIR}/src/dt-car-interface # keep some arguments as environment variables ENV DT_MODULE_TYPE "${REPO_NAME}" ENV DT_MODULE_DESCRIPTION "${DESCRIPTION}" ENV DT_MODULE_ICON "${ICON}" ENV DT_MAINTAINER "${MAINTAINER}" ENV DT_REPO_PATH "${REPO_PATH}" ENV DT_LAUNCH_PATH "${LAUNCH_PATH}" ENV DT_LAUNCHER "${LAUNCHER}" # Daniel - Add some dependencies RUN apt-get update -y && apt-get install -y --no-install-recommends \ gcc \ libc-dev\ git \ bzip2 \ python3-tk \ python3-wheel \ python3-pip \ python3-pillow \ software-properties-common \ #Pytorch dependencies libopenblas-dev \ libblas-dev \ libcairo2-dev \ pkg-config \ m4 \ cmake \ cython \ python3-dev \ python3-yaml \ curl \ python3-setuptools && \ rm -rf /var/lib/apt/lists/* RUN echo PYTHONPATH=$PYTHONPATH RUN pip3 install -U "pip>=20.2" pipdeptree setuptools wheel RUN pip3 install pycairo COPY ./libraries "${REPO_PATH}/libraries" RUN pip3 install "${REPO_PATH}/libraries/numpy-1.20.0-cp38-cp38-manylinux2014_aarch64.whl" RUN pip3 install "${REPO_PATH}/libraries/torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl" RUN pip3 install "${REPO_PATH}/libraries/torchvision-0.19.0-cp38-cp38-manylinux2014_aarch64.whl" RUN pipdeptree RUN pip list RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list && \ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \ sudo apt-get update && \ sudo apt-get install libedgetpu1-std # install apt dependencies COPY ./dependencies-apt.txt "${REPO_PATH}/" RUN dt-apt-install ${REPO_PATH}/dependencies-apt.txt # install python3 dependencies COPY ./dependencies-py3.txt "${REPO_PATH}/" RUN pip3 install -r ${REPO_PATH}/dependencies-py3.txt # copy the source code COPY ./packages "${REPO_PATH}/packages" # build packages RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \ catkin build \ --workspace ${CATKIN_WS_DIR}/ # install launcher scripts COPY ./launchers/. "${LAUNCH_PATH}/" COPY ./launchers/default.sh "${LAUNCH_PATH}/" RUN dt-install-launchers "${LAUNCH_PATH}" # define default command CMD ["bash", "-c", "dt-launcher-${DT_LAUNCHER}"] # store module metadata LABEL org.duckietown.label.module.type="${REPO_NAME}" \ org.duckietown.label.module.description="${DESCRIPTION}" \ org.duckietown.label.module.icon="${ICON}" \ org.duckietown.label.architecture="${ARCH}" \ org.duckietown.label.code.location="${REPO_PATH}" \ org.duckietown.label.code.version.distro="${DISTRO}" \ org.duckietown.label.base.image="${BASE_IMAGE}" \ org.duckietown.label.base.tag="${BASE_TAG}" \ org.duckietown.label.maintainer="${MAINTAINER}" # <== Do not change the code above this line # <==================================================
here is the dockerfile as attached. please let me know if any other modification is needed. I am using nvidia jetson neno - 4GB with jetpack version 4.4