This document is relevant for: Inf2, Trn1

Install TensorFlow 2.x (tensorflow-neuronx)#

Warning

This document is archived. TensorFlow is no longer officially supported by the AWS Neuron SDK. It is provided for reference only. For current framework support, see ML framework support on AWS Neuron SDK.

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

# Install Python 
sudo dnf install python3.12

# Install Python venv 
sudo dnf install -y python3.12-venv gcc-c++ 

# Create Python venv
python3.12 -m venv aws_neuron_venv_tensorflow 

# Activate Python venv 
source aws_neuron_venv_tensorflow/bin/activate 
python -m pip install -U pip 

# Install Jupyter notebook kernel
pip install ipykernel 
python3.12 -m ipykernel install --user --name aws_neuron_venv_tensorflow --display-name "Python (tensorflow-neuronx)"
pip install jupyter notebook
pip install environment_kernels

# Set pip repository pointing to the Neuron repository 
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com

# Install wget, awscli 
python -m pip install wget 
python -m pip install awscli 

# Install Neuron Compiler and Framework
python -m pip install neuronx-cc==2.* tensorflow-neuronx

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

# Install Python 
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.12

# Install Python venv 
sudo apt-get install -y python3.12-venv g++ 

# Create Python venv
python3.12 -m venv aws_neuron_venv_tensorflow 

# Activate Python venv 
source aws_neuron_venv_tensorflow/bin/activate 
python -m pip install -U pip 

# Install Jupyter notebook kernel
pip install ipykernel 
python3.12 -m ipykernel install --user --name aws_neuron_venv_tensorflow --display-name "Python (tensorflow-neuronx)"
pip install jupyter notebook
pip install environment_kernels

# Set pip repository pointing to the Neuron repository 
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com

# Install wget, awscli 
python -m pip install wget 
python -m pip install awscli 

# Install Neuron Compiler and Framework
python -m pip install neuronx-cc==2.* tensorflow-neuronx

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

# Install Python 
sudo dnf install python3.12

# Install Python venv 
sudo dnf install -y python3.12-venv gcc-c++ 

# Create Python venv
python3.12 -m venv aws_neuron_venv_tensorflow 

# Activate Python venv 
source aws_neuron_venv_tensorflow/bin/activate 
python -m pip install -U pip 

# Install Jupyter notebook kernel
pip install ipykernel 
python3.12 -m ipykernel install --user --name aws_neuron_venv_tensorflow --display-name "Python (tensorflow-neuronx)"
pip install jupyter notebook
pip install environment_kernels

# Set pip repository pointing to the Neuron repository 
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com

# Install wget, awscli 
python -m pip install wget 
python -m pip install awscli 

# Install Neuron Compiler and Framework
python -m pip install neuronx-cc==2.* tensorflow-neuronx

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

# Install Python 
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.12

# Install Python venv 
sudo apt-get install -y python3.12-venv g++ 

# Create Python venv
python3.12 -m venv aws_neuron_venv_tensorflow 

# Activate Python venv 
source aws_neuron_venv_tensorflow/bin/activate 
python -m pip install -U pip 

# Install Jupyter notebook kernel
pip install ipykernel 
python3.12 -m ipykernel install --user --name aws_neuron_venv_tensorflow --display-name "Python (tensorflow-neuronx)"
pip install jupyter notebook
pip install environment_kernels

# Set pip repository pointing to the Neuron repository 
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com

# Install wget, awscli 
python -m pip install wget 
python -m pip install awscli 

# Install Neuron Compiler and Framework
python -m pip install neuronx-cc==2.* tensorflow-neuronx

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

# Install Python 
sudo dnf install python3.12

# Install Python venv 
sudo dnf install -y python3.12-venv gcc-c++ 

# Create Python venv
python3.12 -m venv aws_neuron_venv_tensorflow 

# Activate Python venv 
source aws_neuron_venv_tensorflow/bin/activate 
python -m pip install -U pip 

# Install Jupyter notebook kernel
pip install ipykernel 
python3.12 -m ipykernel install --user --name aws_neuron_venv_tensorflow --display-name "Python (tensorflow-neuronx)"
pip install jupyter notebook
pip install environment_kernels

# Set pip repository pointing to the Neuron repository 
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com

# Install wget, awscli 
python -m pip install wget 
python -m pip install awscli 

# Install Neuron Compiler and Framework
python -m pip install neuronx-cc==2.* tensorflow-neuronx

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

# Install Python 
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.12

# Install Python venv 
sudo apt-get install -y python3.12-venv g++ 

# Create Python venv
python3.12 -m venv aws_neuron_venv_tensorflow 

# Activate Python venv 
source aws_neuron_venv_tensorflow/bin/activate 
python -m pip install -U pip 

# Install Jupyter notebook kernel
pip install ipykernel 
python3.12 -m ipykernel install --user --name aws_neuron_venv_tensorflow --display-name "Python (tensorflow-neuronx)"
pip install jupyter notebook
pip install environment_kernels

# Set pip repository pointing to the Neuron repository 
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com

# Install wget, awscli 
python -m pip install wget 
python -m pip install awscli 

# Install Neuron Compiler and Framework
python -m pip install neuronx-cc==2.* tensorflow-neuronx

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 1151, in <module>
    print(n2_manifest.generate_script(args))
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 138, in generate_script
    str_python = self.set_python_venv(args)
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 575, in set_python_venv
    packages_supporting_python_versions = self.get_pip_packages_supporting_python_versions(args)
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 82, in get_pip_packages_supporting_python_versions
    framework_python_versions = df_framework.loc[
IndexError: index 0 is out of bounds for axis 0 with size 0

Note

  • For a successful installation or update, execute each line of the instructions below separately or copy the contents of the code block into a script file and source its contents.

  • When launching a Trn1, please adjust your primary EBS volume size to a minimum of 512GB.

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 1151, in <module>
    print(n2_manifest.generate_script(args))
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 138, in generate_script
    str_python = self.set_python_venv(args)
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 575, in set_python_venv
    packages_supporting_python_versions = self.get_pip_packages_supporting_python_versions(args)
  File "/home/docs/checkouts/readthedocs.org/user_builds/awsdocs-neuron/checkouts/latest/src/helperscripts/n2-helper.py", line 82, in get_pip_packages_supporting_python_versions
    framework_python_versions = df_framework.loc[
IndexError: index 0 is out of bounds for axis 0 with size 0

This document is relevant for: Inf2, Trn1