Menu
Abstract
This guide provides instructions for installing TensorFlow for Jetson Platform.
1. Overview
TensorFlow on Jetson Platform
Jul 29, 2020. TensorFlow is available for all popular operating systems used, i.e. Windows, Mac OS, GNU / Linux. It can be downloaded and installed from one of the Python Package Indexes using the pip tool and can run in a virtual python environment. Another way to use it is to install it as a Docker container. Install TensorFlow.
TensorFlow™ is an open-source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) that flow between them. This flexible architecture lets you deploy computation to one or more CPUs or GPUs in a desktop, server, or mobile device without rewriting code.
Jetson AGX Xavier
The NVIDIA Jetson AGX Xavier developer kit for Jetson platform is the world's first AI computer for autonomous machines. The Jetson AGX Xavier delivers the performance of a GPU workstation in an embedded module under 30W.
Jetson Nano
NVIDIA Jetson Nano is a small, powerful computer for embedded AI systems and IoT that delivers the power of modern AI in a low-power platform. The Jetson Nano is targeted to get started fast with the NVIDIA Jetpack SDK and a full desktop Linux environment, and start exploring a new world of embedded products.
Jetson TX2
The Jetson TX2 Developer Kit enables a fast and easy way to develop hardware and software for the Jetson TX2 AI supercomputer on a module. It exposes the hardware capabilities and interfaces of the developer board, comes with design guides and other documentation, and is pre-flashed with a Linux development environment. The Jetson TX2 also supports NVIDIA Jetpack—a complete SDK that includes the BSP, libraries for deep learning, computer vision, GPU computing, multimedia processing, and much more.
1.1. Benefits of TensorFlow on Jetson Platform
Installing TensorFlow for Jetson Platform provides you with the access to the latest version of the framework on a lightweight, mobile platform without being restricted to TensorFlow Lite.
2. Prerequisites and Dependencies
Before you install TensorFlow for Jetson, ensure you:- Install JetPack on your Jetson device.
- Install system packages required by TensorFlow:
- Install and upgrade pip3.
- Install the Python package dependencies.
Refer to the TensorFlow For Jetson Platform Release Notes for information about the Python package versions used for the most recent release.
3. Installing TensorFlow
Note: As of the 20.02 TensorFlow release, the package name has changed from tensorflow-gpu to tensorflow. See the section on Upgrading TensorFlow for more information.
Install TensorFlow using the pip3 command. This command will install the latest version of TensorFlow compatible with JetPack 4.4.Note: TensorFlow version 2 was recently released and is not fully backward compatible with TensorFlow 1.x. If you would prefer to use a TensorFlow 1.x package, it can be installed by specifying the TensorFlow version to be less than 2, as in the following command:
If you want to install the latest version of TensorFlow supported by a particular version of JetPack, issue the following command: Where:
If you want to install a specific version of TensorFlow, issue the following command: Where:- JP_VERSION
- The major and minor version of JetPack you are using, such as 42 for JetPack 4.2.2 or 33 for JetPack 3.3.1.
Note: The version of TensorFlow you are trying to install must be supported by the version of JetPack you are using. Also, the package name may be different for older releases. See the TensorFlow For Jetson Platform Release Notes for a list of some recent TensorFlow releases with their corresponding package names, as well as NVIDIA container and JetPack compatibility.
For example, to install TensorFlow 1.13.1 as of the 19.03 release, the command would look similar to the following:
3.1. Installing Multiple TensorFlow Versions
If you want to have multiple versions of TensorFlow available at the same time, this can be accomplished using virtual environments. See below.
Set up the Virtual Environment
First, install the virtualenv package and create a new Python 3 virtual environment:
Activate the Virtual Environment
Next, activate the virtual environment:Install the desired version of TensorFlow and its dependencies:
Deactivate the Virtual Environment
Finally, deactivate the virtual environment:
Run a Specific Version of TensorFlow
After the virtual environment has been set up, simply activate it to have access to the specific version of TensorFlow. Make sure to deactivate the environment after use:
3.2. Upgrading TensorFlow
Note: Due to the recent package renaming, if the TensorFlow version you currently have installed is older than the 20.02 release, you must uninstall it before upgrading to avoid conflicts. See the section on Uninstalling TensorFlow for more information.
To upgrade to a more recent release of TensorFlow, if one is available, run the install command with the ‘upgrade’ flag:
4. Verifying The Installation
To verify that TensorFlow has been successfully installed on Jetson AGX Xavier, you’ll need to launch a Python prompt and import TensorFlow.
Procedure
- From the terminal, run:
- Import TensorFlow:If TensorFlow Download mac os x utorrent. was installed correctly, this command should execute without error.
5. Best Practices
Performance model
It is recommended to choose the right performance mode to get the best possible performance given energy usage limitations. There is a command line tool (nvpmodel) that can be used to change the performance mode. In order to check the current performance mode, issue:
For more information, see:
Swap space on Jetson Xavier
On Jetson Xavier, certain applications could run out of memory (16GB shared between CPU and GPU). This problem can be resolved by creating a swap partition on the external memory. Typically 4GB of swap space is enough.
6. Uninstalling
TensorFlow can easily be uninstalled using the pip3 uninstall command, as below:
Note: If you are If you are using a version of TensorFlow older than the 20.02 release, the package name is tensorflow-gpu, and you will need to run the following command to uninstall TensorFlow instead. See the TensorFlow For Jetson Platform Release Notes for more information.
7. Troubleshooting
Join the NVIDIA Jetson and Embedded Systems community to discuss Jetson Platform-specific issues.
8. Support
TensorFlow
For more information about TensorFlow, see:
Jetson Platform
Install Tensorflow Mac
For more information about Jetson Platform, see:
NVIDIA SDK Manager
- See NVIDIA SDK Manager for more information.
Notices
Notice
This document is provided for information purposes only and shall not be regarded as a warranty of a certain functionality, condition, or quality of a product. NVIDIA Corporation (“NVIDIA”) makes no representations or warranties, expressed or implied, as to the accuracy or completeness of the information contained in this document and assumes no responsibility for any errors contained herein. NVIDIA shall have no liability for the consequences or use of such information or for any infringement of patents or other rights of third parties that may result from its use. This document is not a commitment to develop, release, or deliver any Material (defined below), code, or functionality.
NVIDIA reserves the right to make corrections, modifications, enhancements, improvements, and any other changes to this document, at any time without notice.
Customer should obtain the latest relevant information before placing orders and should verify that such information is current and complete.
NVIDIA products are sold subject to the NVIDIA standard terms and conditions of sale supplied at the time of order acknowledgement, unless otherwise agreed in an individual sales agreement signed by authorized representatives of NVIDIA and customer (“Terms of Sale”). NVIDIA hereby expressly objects to applying any customer general terms and conditions with regards to the purchase of the NVIDIA product referenced in this document. No contractual obligations are formed either directly or indirectly by this document.
Make sure your Mac meets the for Firefox. If you use an old version of OS X, see these articles for more information:.Installing Firefox on Mac.
NVIDIA products are not designed, authorized, or warranted to be suitable for use in medical, military, aircraft, space, or life support equipment, nor in applications where failure or malfunction of the NVIDIA product can reasonably be expected to result in personal injury, death, or property or environmental damage. NVIDIA accepts no liability for inclusion and/or use of NVIDIA products in such equipment or applications and therefore such inclusion and/or use is at customer’s own risk.
NVIDIA makes no representation or warranty that products based on this document will be suitable for any specified use. Testing of all parameters of each product is not necessarily performed by NVIDIA. It is customer’s sole responsibility to evaluate and determine the applicability of any information contained in this document, ensure the product is suitable and fit for the application planned by customer, and perform the necessary testing for the application in order to avoid a default of the application or the product. Weaknesses in customer’s product designs may affect the quality and reliability of the NVIDIA product and may result in additional or different conditions and/or requirements beyond those contained in this document. NVIDIA accepts no liability related to any default, damage, costs, or problem which may be based on or attributable to: (i) the use of the NVIDIA product in any manner that is contrary to this document or (ii) customer product designs.
No license, either expressed or implied, is granted under any NVIDIA patent right, copyright, or other NVIDIA intellectual property right under this document. Information published by NVIDIA regarding third-party products or services does not constitute a license from NVIDIA to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property rights of the third party, or a license from NVIDIA under the patents or other intellectual property rights of NVIDIA.
Reproduction of information in this document is permissible only if approved in advance by NVIDIA in writing, reproduced without alteration and in full compliance with all applicable export laws and regulations, and accompanied by all associated conditions, limitations, and notices.
THIS DOCUMENT AND ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATELY, “MATERIALS”) ARE BEING PROVIDED “AS IS.” NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL NVIDIA BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Notwithstanding any damages that customer might incur for any reason whatsoever, NVIDIA’s aggregate and cumulative liability towards customer for the products described herein shall be limited in accordance with the Terms of Sale for the product.
VESA DisplayPort
DisplayPort and DisplayPort Compliance Logo, DisplayPort Compliance Logo for Dual-mode Sources, and DisplayPort Compliance Logo for Active Cables are trademarks owned by the Video Electronics Standards Association in the United States and other countries.
HDMI
HDMI, the HDMI logo, and High-Definition Multimedia Interface are trademarks or registered trademarks of HDMI Licensing LLC.
OpenCL
OpenCL is a trademark of Apple Inc. used under license to the Khronos Group Inc.
Trademarks
NVIDIA, the NVIDIA logo, and cuBLAS, CUDA, cuDNN, DALI, DIGITS, DGX, DGX-1, DGX-2, DGX Station, DLProf, Jetson, Kepler, Maxwell, NCCL, Nsight Compute, Nsight Systems, NvCaffe, NVIDIA Ampere GPU Architecture, PerfWorks, Pascal, SDK Manager, Tegra, TensorRT, Triton Inference Server, Tesla, TF-TRT, and Volta are trademarks and/or registered trademarks of NVIDIA Corporation in the U.S. and other countries. Other company and product names may be trademarks of the respective companies with which they are associated.
Copyright
© 2018-2020 NVIDIA Corporation. All rights reserved.
Few days back, I decided to setup development environment for deep learning on my Windows 10 laptop. In this article, I would share my experience in setting up a system typically for Data Science developers. Although I used Windows 10 but the steps will be same for Linux and Mac OS.
Being a developer, need IDE for coding and not fan of browser based editor. Jupyter Notebook is favourite tool for data scientist and we can’t skip that in case of data science. Fortunately, VS Code supports Jupyter notebook. You can now directly edit .ipynb files and get the interactivity of Jupyter notebooks with all of the power of VS Code. We will go through it.
In this tutorial, we will cover the following steps:
1. Install Python
2. Install TensorFlow 2.0
3. Install Jupyter Notebook
4. Setup VS Code
5. Testing Environment
6. Virtual Environment (Optional)
2. Install TensorFlow 2.0
3. Install Jupyter Notebook
4. Setup VS Code
5. Testing Environment
6. Virtual Environment (Optional)
1. Install Python
Download Python 3.7.6 from www.python.org(Currently, Tensorflow doesn’t support Python 3.8). I would suggest to install it with “customize installation” option and allow all users.
After installation, check the Python version on terminal. If there are multiple versions of python installed in the machine then change PATH in environment variable to the installed version and restart terminal to check version.
2. Install TensorFlow 2.0
TensorFlow is open source deep learning framework by Google, helps us to build and design Deep Learning models.
For simplicity, we will install CPU version of TensorFlow.
For simplicity, we will install CPU version of TensorFlow.
It will install all supportive extensions like numpy …etc.
Note: Install the GPU version of TensorFlow only if you have an Nvidia GPU. It is good and recommended for better performance. It needs to Install/Update nvidia driver, cuda toolkit, cuDNN and then run following command to install
For more information, check out the official guide here.
The next is to install Matplotlib- a Python library for 2D plotting and can work together with NumPy.
3. Install Jupyter Notebook
Jupyter Notebook is web based interactive environment for writing the code, creating & sharing files and doing visualizations as well.
run following command to install it:
Start the notebook server from the command line:
You should see the notebook open in your browser.
If you want to specify port:
4. Setup VS Code
Download and install VS Code if not already installed.
Install the following VS Code extension from the marketplace.
Note: Make sure you have installed the latest version of the extension.
First time, open the VS Code Command Palette with the shortcut CTRL + SHIFT + P (Windows) or Command + SHIFT + P (macOS) in VSCode and select “Python: Select Interpreter” command. It will display all installed versions. Select the appropriate python environment where Jupyter notebook is installed.
To create new Jupyter notebook, open VS Code Command Palette again and run the “Python: Create Blank New Jupyter Notebook” command.
Why VS Code?
– You can manage source control, open multiple files, and leverage productivity features like IntelliSense, Git integration, and multi-file management, offering a brand-new way for data scientists and developers to experiment and work with data efficiently.
– Variable Explorer will help you keep track of the current state of your notebook variables at a glance, in real-time.
– You can export as Python code and do debugging and other operation like do in regular python application
– Variable Explorer will help you keep track of the current state of your notebook variables at a glance, in real-time.
– You can export as Python code and do debugging and other operation like do in regular python application
5. Testing Environment
Now, it is time to test the environment.
Create a new Jupyter book in VS Code and run following code to test :
Download Tensorflow Mac Virtual Environment Download
The output should be following:
6. Virtual Environment (Optional)
a) As we are going to use same environment for all so installed TensorFlow, Jupyter Notebook in global Python environment. If you want to create a separate environment for this, you can create a virtual environment by running following command:
It will create .venv directory at specified path.
b) To activate python virutal environment
In VS Code:
In Command Palette CTRL + SHIFT + P, Run “Python: Create Terminal“. It will open and activate the terminal in selected Python environment.
c) Now install the TensorFlow, Jupyter notebook …etc in the activated environment.
Conclusion
In this tutorial, we saw
– how to set up a Python Deep Learning development environment using TensorFlow 2.0, Jupyter Notebook and VS Code.
– how Python extension in VS Code empowers notebook development in developer way.
– how to set up a Python Deep Learning development environment using TensorFlow 2.0, Jupyter Notebook and VS Code.
– how Python extension in VS Code empowers notebook development in developer way.
If you face any problems, then feel free to share them in the comment section.
Enjoy Deep Learning !!