# Jetson-inference from source

**URL:** <https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620>\
**Category:** Jetson Nano\
**Tags:** jetson-inference\
**Created:** [July 3, 2023, 4:40pm UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620 "2023-07-03T16:40:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![castej10](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@castej10](https://forums.developer.nvidia.com/u/castej10)\
**Post date:** [July 3, 2023, 4:40pm UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/1 "2023-07-03T16:40:43Z")

</div>

Hello,  
Im trying to build jetson inference from source following [jetson-inference/docs/building-repo-2.md at master · dusty-nv/jetson-inference · GitHub](https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md) , to be able to use DetectNet outside the container. I have updated my python 3 to 3.7 on the jetson nano and i was wondering if everything will still work ok on the jetson-inference side? I have to use python 3.7.5 because of the FeatherWing H-bridge to be able to control some motors.

thank you

---

<div class="post-metadata">

**Author:** ![dusty\_nv](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dusty_nv/32/14043_2.png) [@dusty\_nv](https://forums.developer.nvidia.com/u/dusty_nv)\
**Post date:** [July 3, 2023, 8:09pm UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/2 "2023-07-03T20:09:37Z")

</div>

@castej10 I don’t believe I’ve personal built jetson-inference against Python 3.7 specifically (Python 3.6 and 3.8 I have), but if you have the `libpython3.7-dev` packages installed, it should detect it:

- [https://github.com/dusty-nv/jetson-inference/blob/cbd9c0610143beb289ae77b42c0b40d69bc4c801/python/CMakeLists.txt#L11](https://github.com/dusty-nv/jetson-inference/blob/cbd9c0610143beb289ae77b42c0b40d69bc4c801/python/CMakeLists.txt#L11)
- [https://github.com/dusty-nv/jetson-utils/blob/f0bff5c502f9ac6b10aa2912f1324797df94bc2d/python/CMakeLists.txt#L11](https://github.com/dusty-nv/jetson-utils/blob/f0bff5c502f9ac6b10aa2912f1324797df94bc2d/python/CMakeLists.txt#L11)

If it has trouble selecting it, I would change those lines to `set(PYTHON_BINDING_VERSIONS 3.7)`

---

<div class="post-metadata">

**Author:** ![castej10](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@castej10](https://forums.developer.nvidia.com/u/castej10)\
**Post date:** [July 4, 2023, 11:38pm UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/4 "2023-07-04T23:38:45Z")

</div>

if i wanted to instead use the container and communicate with host using RbbitMQ server using the pika library for python, can i change the Dockerfile from:

```auto
...

#
# install development packages
#
RUN add-apt-repository --remove "deb https://apt.kitware.com/ubuntu/ $(lsb_release --codename --short) main" && \
    apt-get update && \
    apt-get purge -y '*opencv*' || echo "existing OpenCV installation not found" && \
    apt-get install -y --no-install-recommends \
            cmake \
...
...
# 
# install python packages
#
COPY python/training/detection/ssd/requirements.txt /tmp/pytorch_ssd_requirements.txt
COPY python/www/flask/requirements.txt /tmp/flask_requirements.txt
COPY python/www/dash/requirements.txt /tmp/dash_requirements.txt

RUN pip3 install --no-cache-dir --verbose --upgrade Cython && \
    pip3 install --no-cache-dir --verbose -r /tmp/pytorch_ssd_requirements.txt && \
    pip3 install --no-cache-dir --verbose -r /tmp/flask_requirements.txt && \
    pip3 install --no-cache-dir --verbose -r /tmp/dash_requirements.txt && \

...

```

to:

```auto
...

#
# install development packages
#
RUN add-apt-repository --remove "deb https://apt.kitware.com/ubuntu/ $(lsb_release --codename --short) main" && \
    apt-get update && \
    apt-get install -y libpython3.7-dev && \
    apt-get purge -y '*opencv*' || echo "existing OpenCV installation not found" && \
    apt-get install -y --no-install-recommends \
            cmake \
...

...
# 
# install python packages
#
COPY python/training/detection/ssd/requirements.txt /tmp/pytorch_ssd_requirements.txt
COPY python/www/flask/requirements.txt /tmp/flask_requirements.txt
COPY python/www/dash/requirements.txt /tmp/dash_requirements.txt

RUN pip3 install --no-cache-dir --verbose --upgrade Cython && \
    pip3 install --no-cache-dir --verbose -r /tmp/pytorch_ssd_requirements.txt && \
    pip3 install --no-cache-dir --verbose -r /tmp/flask_requirements.txt && \
    pip3 install --no-cache-dir --verbose -r /tmp/dash_requirements.txt && \
    pip3 install pika numpy
...

```

then using docker/build.sh command to recreate the image?

---

<div class="post-metadata">

**Author:** ![dusty\_nv](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dusty_nv/32/14043_2.png) [@dusty\_nv](https://forums.developer.nvidia.com/u/dusty_nv)\
**Post date:** [July 5, 2023, 12:09am UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/5 "2023-07-05T00:09:10Z")

</div>

> [@castej10](#):
>
> then using docker/build.sh command to recreate the image?

Sure you could do that - I would actually put your commands in their own `RUN` statement so that when you change them, it doesn’t have to re-run all those other pip3 installations that I have. It may take a bit of time to build the container at first, but once you do, you’ll be able to add your own commands to the end of the Dockerfile and it’ll quickly build just those commands using the build cache.

Note that the typical approach with Docker would be to create your own container by making your own Dockerfile with the commands you added with `FROM jetson-inference:rXX.X` at the top, and build it (look up tutorials on creating your own containers). Alas your approach may be easier to start with.

Also, when building the jetson-inference container, make sure that your default docker runtime is set to nvidia: [https://github.com/dusty-nv/jetson-containers#docker-default-runtime](https://github.com/dusty-nv/jetson-containers#docker-default-runtime)

---

<div class="post-metadata">

**Author:** ![castej10](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@castej10](https://forums.developer.nvidia.com/u/castej10)\
**Post date:** [July 5, 2023, 6:55pm UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/7 "2023-07-05T18:55:06Z")

</div>

also when I edit the Dockerfile and run the command docker/build.sh after quite sometime of bulding the image i get this error:

```auto
eppl@eppl-desktop:~/jetson-inference$ docker/run.sh
ARCH: aarch64
reading L4T version from /etc/nv_tegra_release
L4T BSP Version: L4T R32.7.1
[sudo] password for eppl: 
localuser:root being added to access control list
CONTAINER_IMAGE: jetson-inference:r32.7.1
DATA_VOLUME: --volume /home/eppl/jetson-inference/data:/jetson-inference/data --volume /home/eppl/jetson-inference/python/training/classification/data:/jetson-inference/python/training/classification/data --volume /home/eppl/jetson-inference/python/training/classification/models:/jetson-inference/python/training/classification/models --volume /home/eppl/jetson-inference/python/training/detection/ssd/data:/jetson-inference/python/training/detection/ssd/data --volume /home/eppl/jetson-inference/python/training/detection/ssd/models:/jetson-inference/python/training/detection/ssd/models --volume /home/eppl/jetson-inference/python/www/recognizer/data:/jetson-inference/python/www/recognizer/data 
V4L2_DEVICES: --device /dev/video0 
DISPLAY_DEVICE: -e DISPLAY=:1 -v /tmp/.X11-unix/:/tmp/.X11-unix 
ERROR: ld.so: object '/lib/aarch64-linux-gnu/libGLdispatch.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/aarch64-linux-gnu/libGLdispatch.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/aarch64-linux-gnu/libGLdispatch.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

```

also i get this error in the mounted directories:

```auto
root@eppl-desktop:/jetson-inference/python/training/detection/ssd# ls models
ERROR: ld.so: object '/lib/aarch64-linux-gnu/libGLdispatch.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

```

---

<div class="post-metadata">

**Author:** ![dusty\_nv](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dusty_nv/32/14043_2.png) [@dusty\_nv](https://forums.developer.nvidia.com/u/dusty_nv)\
**Post date:** [July 6, 2023, 2:10am UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/8 "2023-07-06T02:10:10Z")

</div>

> [@castej10](#):
>
> would i have to mount them in my own Dockerfile?

These directories get mounted in `docker run` command when you start the container:

[https://github.com/dusty-nv/jetson-inference/blob/cbd9c0610143beb289ae77b42c0b40d69bc4c801/docker/run.sh#L67](https://github.com/dusty-nv/jetson-inference/blob/cbd9c0610143beb289ae77b42c0b40d69bc4c801/docker/run.sh#L67)

> [@castej10](#):
>
> `ERROR: ld.so: object '/lib/aarch64-linux-gnu/libGLdispatch.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.`

Perhaps that behavior is different from JetPack 4 - you could remove it from the jetson-inference dockerfile:

[https://github.com/dusty-nv/jetson-inference/blob/cbd9c0610143beb289ae77b42c0b40d69bc4c801/Dockerfile#L135](https://github.com/dusty-nv/jetson-inference/blob/cbd9c0610143beb289ae77b42c0b40d69bc4c801/Dockerfile#L135)

or change the `LD_PRELOAD` ENV variable in your own dockerfile

---

<div class="post-metadata">

**Author:** ![castej10](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@castej10](https://forums.developer.nvidia.com/u/castej10)\
**Post date:** [July 6, 2023, 1:30pm UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/9 "2023-07-06T13:30:48Z")

</div>

> [@dusty\_nv](#):
>
> Sure you could do that - I would actually put your commands in their own `RUN` statement so that when you change them, it doesn’t have to re-run all those other pip3 installations that I have. It may take a bit of time to build the container at first, but once you do, you’ll be able to add your own commands to the end of the Dockerfile and it’ll quickly build just those commands using the build cache.

sorry im a bit confused, would i have to have python 3.7 installed on host so that the container can also have python 3.7?

---

<div class="post-metadata">

**Author:** ![dusty\_nv](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dusty_nv/32/14043_2.png) [@dusty\_nv](https://forums.developer.nvidia.com/u/dusty_nv)\
**Post date:** [July 6, 2023, 3:27pm UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/10 "2023-07-06T15:27:14Z")

</div>

Mmm good point - I forgot you were building this in container. In that case, you would want to make sure those `libpython3.7-dev` packages were installed in the Dockerfile before jetson-inference gets built.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [July 25, 2023, 7:49am UTC](https://forums.developer.nvidia.com/t/jetson-inference-from-source/258620/12 "2023-07-25T07:49:51Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
