{"id":3879,"date":"2025-02-22T23:39:38","date_gmt":"2025-02-22T15:39:38","guid":{"rendered":"https:\/\/chow.karmeng.my\/?p=3879"},"modified":"2025-02-22T23:39:38","modified_gmt":"2025-02-22T15:39:38","slug":"h5py-python-causes-tensorflow-installation-error-for-jetson-nano","status":"publish","type":"post","link":"https:\/\/chow.karmeng.my\/?p=3879","title":{"rendered":"h5py python causes TensorFlow installation error for Jetson Nano"},"content":{"rendered":"\n<p>After forcing the Jetson OS (based on the ubuntu 18.04) to have Python 3.8 running. After having the JetPack 4.6.3 installed in the Jetson Nano Jetson OS.<\/p>\n\n\n\n<p>When attempting to install TensorFlow 2+ manually in the Jetson Nano based on <a href=\"https:\/\/forums.developer.nvidia.com\/t\/official-tensorflow-for-jetson-nano\/71770\">Official TensorFlow for Jetson Nano! &#8211; Jetson &amp; Embedded Systems \/ Jetson Nano &#8211; NVIDIA Developer Forums<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-1024x384.png\" alt=\"\" class=\"wp-image-3880\"\/><figcaption class=\"wp-element-caption\">Running the installation in Jetson Nano<\/figcaption><\/figure>\n\n\n\n<p>Or running the pip3 install command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pip3 install --pre --extra-index-url https:\/\/developer.download.nvidia.com\/compute\/redist\/jp\/v46 tensorflow<\/code><\/pre>\n\n\n\n<p>After a long time installing all the dependency for TensorFlow. A dreaded error message will occur.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>ERROR: Failed to build installable wheels for some pyproject.toml based projects (h5py)<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-1-1024x707.png\" alt=\"\" class=\"wp-image-3881\"\/><figcaption class=\"wp-element-caption\">ERROR: Failed to build installable wheels for some pyproject.toml based projects (h5py)<\/figcaption><\/figure>\n\n\n\n<p>To understand the error, scroll up to read what are the error.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>The first error message scrolling up suggest the version of hd5 are not supported.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-2-1024x737.png\" alt=\"\" class=\"wp-image-3882\"\/><figcaption class=\"wp-element-caption\">Loading library to get build settings and version: \/usr\/lib\/aarch64-linux-gnu\/hdf5\/serial\/libhdf5.so the details<\/figcaption><\/figure>\n\n\n\n<p>Scroll higher, the error was triggered when pip is building the h5py dependency\/library.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-3.png\" alt=\"\" class=\"wp-image-3883\"\/><figcaption class=\"wp-element-caption\">h5py fail, it is a dependency for tensorflow<\/figcaption><\/figure>\n\n\n\n<p>Hence, forming the problem statement, h5py library for Python 3.8 cannot be installed due to the binary hdf5 of Jetson OS is version 1.10.0.<\/p>\n\n\n\n<p>First approach will be updating the Jetson OS using apt-get to update the Jetson OS hdf5 library to at least version 1.10.0<\/p>\n\n\n\n<p>First attempt used based on command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-4.png\" alt=\"\" class=\"wp-image-3884\"\/><figcaption class=\"wp-element-caption\">The hdf5 library is already up to date<\/figcaption><\/figure>\n\n\n\n<p>First attempt does not work, as minor version was not added to the repositories of dated Jetson OS (based on Ubuntu 18.04).<\/p>\n\n\n\n<p>Second attempt, build the hd5 python library via source. Based on idea offered at <a href=\"https:\/\/docs.h5py.org\/en\/stable\/build.html#source-installation\">Installation \u2014 h5py 3.13.0 documentation<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-5.png\" alt=\"\" class=\"wp-image-3885\"\/><figcaption class=\"wp-element-caption\">Following the h5py documentation<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-6-1024x389.png\" alt=\"\" class=\"wp-image-3886\"\/><figcaption class=\"wp-element-caption\">Continue with the documentation, didn&#8217;t bothered setting up git correctly but it still works<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-7.png\" alt=\"\" class=\"wp-image-3887\"\/><figcaption class=\"wp-element-caption\">Typo error but not the reason of build failure<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-8-1024x750.png\" alt=\"\" class=\"wp-image-3888\"\/><figcaption class=\"wp-element-caption\">Error suggested that numpy was not install into the Python 3.8<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-9-1024x176.png\" alt=\"\" class=\"wp-image-3889\"\/><figcaption class=\"wp-element-caption\">Install numpy<\/figcaption><\/figure>\n\n\n\n<p>After numpy is installed, proceed to build the h5py, but encountered a different error.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-10-1024x965.png\" alt=\"\" class=\"wp-image-3890\"\/><figcaption class=\"wp-element-caption\">New error, not old error means progress<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-11-1024x411.png\" alt=\"\" class=\"wp-image-3891\"\/><figcaption class=\"wp-element-caption\">Python.h were not found<\/figcaption><\/figure>\n\n\n\n<p>The second attempt, the error encounter suggesting that the gcc compiler was not able to find header file, the Python.h during its compilation. Hence error.<\/p>\n\n\n\n<p>After taking some time to research, installing python without the development tool kit will not able to help compilation due to missing header.<\/p>\n\n\n\n<p>To fix this error, install the proper development library into Jetson OS.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install libpython3.8-dev<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-12-1024x505.png\" alt=\"\" class=\"wp-image-3892\"\/><figcaption class=\"wp-element-caption\">Recompiling immediately after installation of the Python 3.8 development library, and h5py compiled and created<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>H5PY_SETUP_REQUIRES=0 pip3 install . --no-deps --no-build-isolation<\/code><\/pre>\n\n\n\n<p>Lets rerun the installation attempt to reinstall the TensorFlow.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pip3 install --pre --extra-index-url https:\/\/developer.download.nvidia.com\/compute\/redist\/jp\/v46 tensorflow<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-13-1024x207.png\" alt=\"\" class=\"wp-image-3893\"\/><figcaption class=\"wp-element-caption\">h5py which is manually compiled are detected and accepted by pip3<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-14-1024x392.png\" alt=\"\" class=\"wp-image-3894\"\/><figcaption class=\"wp-element-caption\">TensorFlow installation successful<\/figcaption><\/figure>\n\n\n\n<p>Real test to validate TensorFlow successful installation works.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/chow.karmeng.my\/wp-content\/uploads\/2025\/02\/image-15.png\" alt=\"\" class=\"wp-image-3895\"\/><figcaption class=\"wp-element-caption\">It works<\/figcaption><\/figure>\n\n\n\n<p>And installing TensorFlow on dated Jetson Nano for the Jetson OS is challenging. It will help if a person has knowledge of Ubuntu, Python library management. The part that was left out was <a href=\"https:\/\/jetsonhacks.com\/2023\/06\/12\/upgrade-python-on-jetson-nano-tutorial\/\" data-type=\"link\" data-id=\"https:\/\/jetsonhacks.com\/2023\/06\/12\/upgrade-python-on-jetson-nano-tutorial\/\">how to install Python 3.8<\/a>.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After forcing the Jetson OS (based on the ubuntu 18.04) to have Python 3.8 running. After having the JetPack 4.6.3 installed in the Jetson Nano Jetson OS. When attempting to install TensorFlow 2+ manually in the Jetson Nano based on &hellip; <a href=\"https:\/\/chow.karmeng.my\/?p=3879\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13,25],"tags":[202,207,233,234,235,236,420],"class_list":["post-3879","post","type-post","status-publish","format-standard","hentry","category-it","category-linux","category-ubuntu","tag-h5py","tag-hdf5","tag-jetpack","tag-jetson","tag-jetson-nano","tag-jetson-os","tag-tensorflow"],"_links":{"self":[{"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=\/wp\/v2\/posts\/3879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3879"}],"version-history":[{"count":0,"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=\/wp\/v2\/posts\/3879\/revisions"}],"wp:attachment":[{"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chow.karmeng.my\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}