{"id":12917,"date":"2022-05-24T23:46:34","date_gmt":"2022-05-24T20:46:34","guid":{"rendered":"https:\/\/kifarunix.com\/?p=12917"},"modified":"2024-03-09T12:42:24","modified_gmt":"2024-03-09T09:42:24","slug":"install-tensorflow-on-rocky-linux","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-tensorflow-on-rocky-linux\/","title":{"rendered":"Install TensorFlow on Rocky Linux"},"content":{"rendered":"\n<p>This tutorial will show you how to install TensorFlow on Rocky Linux. According to their <a href=\"https:\/\/www.tensorflow.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">site<\/a>, <em>TensorFlow is an end-to-end open source platform for machine learning. It has a comprehensive, flexible ecosystem of tools, libraries and community resources that lets researchers push the state-of-the-art in ML and developers easily build and deploy ML powered applications<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install TensorFlow on Rocky Linux<\/h2>\n\n\n\n<p>There are various ways in which you can install TensorFlow;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"#install-using-pip\">Install using Python PIP<\/a><\/li>\n\n\n\n<li>Install via Docker<\/li>\n\n\n\n<li>Build and install from the source.<\/li>\n<\/ol>\n\n\n\n<p>We will only discuss the PIP installation method in this guide. For other methods refer to the documentation.<\/p>\n\n\n\n<p>Before you can proceed with installation, be sure to check on <a href=\"https:\/\/www.tensorflow.org\/install\/pip#hardware_requirements\" target=\"_blank\" rel=\"noreferrer noopener\">hardware<\/a>, <a href=\"https:\/\/www.tensorflow.org\/install\/pip#system_requirements\" target=\"_blank\" rel=\"noreferrer noopener\">system<\/a> and <a href=\"https:\/\/www.tensorflow.org\/install\/pip#software_requirements\" target=\"_blank\" rel=\"noreferrer noopener\">software<\/a> requirements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install-using-pip\">Install TensorFlow using Python PIP<\/h2>\n\n\n\n<p>To install TensorFlow using Python PIP;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install Python 3.x<\/h3>\n\n\n\n<p>TensorFlow requires Python 3.7-3.10.<\/p>\n\n\n\n<p>Confirm the current Python version installed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -V<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Python 3.9.7<\/code><\/pre>\n\n\n\n<p>If your version is lower than 3.7, you can install the required version using the package manager. Refer to the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-python-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Python on Rocky Linux 8<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install PIP on Rocky Linux<\/h3>\n\n\n\n<p>pip version 19.0 or higher is required. You can install PIP on Rocky Linux using the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install python3-pip<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Required Python Libraries and Virtual Environment<\/h3>\n\n\n\n<p>Run the command below to install required Python libraries and virtual environment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install python3-{virtualenv,devel}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create TensorFlow Virtual Environment<\/h3>\n\n\n\n<p>Next, run the command below to install TensorFlow;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir ~\/tensorflow &amp;&amp; cd ~\/tensorflow<\/code><\/pre>\n\n\n\n<p>Create virtual environment, in this case we called our virtual environment, <strong>tensorflow_venv<\/strong>. You can use any name!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -m venv tensorflow_venv<\/code><\/pre>\n\n\n\n<p>Activate the virtual environment created;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>source .\/tensorflow_venv\/bin\/activate<\/code><\/pre>\n\n\n\n<p>You will see the shell prompt change;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(tensorflow_venv) &#91;kifarunix@rocky-linux ~]$<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Upgrade PIP;<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install --upgrade pip<\/code><\/pre>\n\n\n\n<p>Verify installed PIP version;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip3.9 --version<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>pip 22.1.1 from \/home\/kifarunix\/.local\/lib\/python3.9\/site-packages\/pip (python 3.9)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install TensorFlow using PIP<\/h3>\n\n\n\n<p>Within the virtual environment, run the command below to install TensorFlow using PIP.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip3.9 install --upgrade tensorflow<\/code><\/pre>\n\n\n\n<p>Check installed version of TensorFlow;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -c 'import tensorflow as tf;print(tf.version.VERSION)'<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2.9.1<\/code><\/pre>\n\n\n\n<p>You can now use TensorFlow. Refer to the <a href=\"https:\/\/www.tensorflow.org\/learn\" target=\"_blank\" rel=\"noreferrer noopener\">documentation<\/a> for more information.<\/p>\n\n\n\n<p>You can deactivate the virtual environment using the command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>deactivate<\/code><\/pre>\n\n\n\n<p>You should see the shell prompt change.<\/p>\n\n\n\n<p>And that is all on how TensorFlow can be installed on Rocky Linux.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-yarn-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Yarn on Rocky Linux 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-latest-nodejs-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Latest Nodejs on Rocky Linux 8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will show you how to install TensorFlow on Rocky Linux. According to their site, TensorFlow is an end-to-end open source platform for machine<\/p>\n","protected":false},"author":1,"featured_media":12913,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121],"tags":[5235,5231,5234],"class_list":["post-12917","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-rocky-linux-tensorflow-install","tag-tensorflow","tag-tensorflow-install-rocky-linux","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12917"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=12917"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12917\/revisions"}],"predecessor-version":[{"id":20495,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12917\/revisions\/20495"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12913"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=12917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=12917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=12917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}