|

|  How to install TensorFlow on Linux?

How to install TensorFlow on Linux?

November 19, 2024

Learn how to seamlessly install TensorFlow on Linux in this step-by-step guide, ensuring a smooth setup for your machine learning projects.

How to install TensorFlow on Linux?

 

Install System Dependencies

 

  • Ensure that Python 3.6 to 3.10 is installed on your system. TensorFlow does not support earlier Python versions.
  •  

  • Upgrade pip to the latest version to avoid any compatibility issues:
    pip install --upgrade pip
    
  •  

  • Install virtualenv to create isolated Python environments:
    pip install virtualenv
    

 

Create a Virtual Environment

 

  • Create a directory for your TensorFlow environment. Enter the directory and set up the virtual environment:
    mkdir tensorflow_env
    cd tensorflow_env
    virtualenv .venv
    
  •  

  • Activate your virtual environment to ensure that your TensorFlow installation doesn't interfere with other projects:
    source .venv/bin/activate
    

 

Install TensorFlow

 

  • With the virtual environment activated, install TensorFlow. You can choose between CPU and GPU support:

       

    • For CPU support only:
      pip install tensorflow
      
    •  

    • For GPU support, ensure your NVIDIA drivers are updated, and install the GPU version:
      pip install tensorflow-gpu
      
  •  

  • Confirm that TensorFlow has been installed by starting a Python shell and importing TensorFlow:
    python
    >>> import tensorflow as tf
    >>> print(tf.__version__)
    

 

Set Up GPU Support

 

  • If you installed the GPU version, ensure that CUDA and cuDNN are correctly installed on your system. Visit the official NVIDIA documentation for the installation process.
  •  

  • Install the NVIDIA CUDA Toolkit and cuDNN with matching versions supported by TensorFlow. Consider setting environment variables to point to these installations:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
    export CUDA_HOME=/usr/local/cuda
    

 

Test Your Installation

 

  • Check if TensorFlow can access the GPU:
    python -c "import tensorflow as tf; print('GPU', 'available' if tf.config.list_physical_devices('GPU') else 'not available')"
    
  •  

  • Run a simple TensorFlow script to test both installation and functionality:
    python -c "import tensorflow as tf; mnist = tf.keras.datasets.mnist; (x_train, y_train), (x_test, y_test) = mnist.load_data(); print('Training data shape:', x_train.shape)"
    

 

Maintain Your TensorFlow Environment

 

  • Keep TensorFlow updated to benefit from the latest features and patches. This is particularly important for staying compatible with CUDA and cuDNN updates.
    pip install --upgrade tensorflow
    
  •  

  • Use version control for your virtual environment's `requirements.txt` file to document the TensorFlow version and other dependencies:
    pip freeze > requirements.txt
    

 

Pre-order Friend AI Necklace

Pre-Order Friend Dev Kit

Open-source AI wearable
Build using the power of recall

Order Now

OMI AI PLATFORM
Remember Every Moment,
Talk to AI and Get Feedback

Omi Necklace

The #1 Open Source AI necklace: Experiment with how you capture and manage conversations.

Build and test with your own Omi Dev Kit 2.

Omi App

Fully Open-Source AI wearable app: build and use reminders, meeting summaries, task suggestions and more. All in one simple app.

Github →

Join the #1 open-source AI wearable community

Build faster and better with 3900+ community members on Omi Discord

Participate in hackathons to expand the Omi platform and win prizes

Participate in hackathons to expand the Omi platform and win prizes

Get cash bounties, free Omi devices and priority access by taking part in community activities

Join our Discord → 

OMI NECKLACE + OMI APP
First & only open-source AI wearable platform

a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded

OMI NECKLACE: DEV KIT
Order your Omi Dev Kit 2 now and create your use cases

Omi Dev Kit 2

Endless customization

OMI DEV KIT 2

$69.99

Make your life more fun with your AI wearable clone. It gives you thoughts, personalized feedback and becomes your second brain to discuss your thoughts and feelings. Available on iOS and Android.

Your Omi will seamlessly sync with your existing omi persona, giving you a full clone of yourself – with limitless potential for use cases:

  • Real-time conversation transcription and processing;
  • Develop your own use cases for fun and productivity;
  • Hundreds of community apps to make use of your Omi Persona and conversations.

Learn more

Omi Dev Kit 2: build at a new level

Key Specs

OMI DEV KIT

OMI DEV KIT 2

Microphone

Yes

Yes

Battery

4 days (250mAH)

2 days (250mAH)

On-board memory (works without phone)

No

Yes

Speaker

No

Yes

Programmable button

No

Yes

Estimated Delivery 

-

1 week

What people say

“Helping with MEMORY,

COMMUNICATION

with business/life partner,

capturing IDEAS, and solving for

a hearing CHALLENGE."

Nathan Sudds

“I wish I had this device

last summer

to RECORD

A CONVERSATION."

Chris Y.

“Fixed my ADHD and

helped me stay

organized."

David Nigh

OMI NECKLACE: DEV KIT
Take your brain to the next level

LATEST NEWS
Follow and be first in the know

Latest news
FOLLOW AND BE FIRST IN THE KNOW

thought to action

team@basedhardware.com

company

careers

invest

privacy

events

products

omi

omi dev kit

omiGPT

personas

omi glass

resources

apps

bounties

affiliate

docs

github

help