Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Docker

How to Install and Use TensorFlow on a Linux VPS

By Freedom251 Team · · 10 min read

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For most Linux VPS users, the reliable path is a 64-bit Ubuntu server, a Python virtual environment, an up-to-date pip, and TensorFlow installed from PyPI. Use pip install tensorflow for CPU work. If your provider has attached a compatible NVIDIA GPU and installed its driver, use pip install 'tensorflow[and-cuda]' instead. Verify both the import and device visibility before deploying an application.

This guide covers compatibility checks, CPU and NVIDIA GPU installations, verification, Docker, routine use, production considerations, and the failure modes that most often prevent TensorFlow from starting on a VPS.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check whether the VPS can run TensorFlow

TensorFlow installation is gated by four things: the operating-system image, CPU architecture, Python version, and (for GPU use) the provider’s NVIDIA driver and device exposure. Resolve those gates before creating an environment so that a failed installation is not mistaken for an application error.

Use a 64-bit Linux image

TensorFlow’s official pip instructions use Ubuntu 16.04 or newer, 64-bit, as the Linux baseline. Other distributions can work, but their system libraries and packaging may require additional compatibility work. The VPS image, glibc version, Python interpreter, and architecture must all line up with an available TensorFlow wheel.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Run these checks on the server:

uname -m
getconf LONG_BIT
cat /etc/os-release
ldd --version | head -n 1
  • x86_64 and a 64 result from getconf LONG_BIT indicate the usual 64-bit x86 VPS.
  • aarch64 identifies an ARM64 VPS. TensorFlow publishes ARM64 CPU wheels, but the documented Python range is narrower than for x86.
  • /etc/os-release confirms the distribution and release, while ldd reports the glibc implementation and version that native wheels depend on.

If the machine is 32-bit, do not proceed with the standard installation: move the workload to a 64-bit VPS. If the distribution is not Ubuntu, check that its Python and glibc versions satisfy the wheel’s requirements before troubleshooting pip.

Select a supported Python version

TensorFlow 2.21 no longer supports Python 3.9. Its Linux x86 package table lists wheels for Python 3.10, 3.11, 3.12, and 3.13. Linux ARM64 CPU wheels are listed for Python 3.10 and 3.11. Therefore, an x86 VPS can normally use one of four supported interpreters, while an ARM64 VPS should use Python 3.10 or 3.11 unless a newer release’s package table explicitly adds another version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
python3 --version

Do not assume that the operating system’s default python3 is suitable. If it reports 3.9, install a supported interpreter supplied by your distribution or an approved repository, then create the virtual environment with that interpreter. Keep the interpreter choice explicit when more than one Python version is installed.

Choose CPU pip, NVIDIA GPU pip, or Docker

The installation route should match the hardware and the operational constraints rather than the model size alone.

Route Use it when What it requires Main trade-off
CPU pip Inference, preprocessing, experimentation, or modest training on a CPU-only VPS 64-bit Linux, a supported Python interpreter, and a virtual environment Simplest setup, but no GPU acceleration
NVIDIA GPU pip The VPS provider exposes a compatible NVIDIA device and driver Working nvidia-smi, supported Python, and the TensorFlow CUDA extra More driver and shared-library dependencies to validate
Docker You need a repeatable prebuilt environment, especially for GPU deployment A container runtime plus provider-level GPU and driver integration Additional container operations and runtime configuration
Source build No published wheel supports the architecture, GPU capability, or compiler options you need Build toolchain, source dependencies, and substantial maintenance effort Most complex; unnecessary for common Linux systems with published wheels

Pre-built packages are the normal choice. TensorFlow’s source-build documentation treats compilation as an advanced fallback, not the starting point for a standard VPS.

Install TensorFlow for CPU workloads

The following sequence uses Ubuntu’s package manager for Python and the standard-library venv module for isolation. A virtual environment prevents TensorFlow’s dependencies from altering system Python or colliding with another application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Refresh package metadata and install the prerequisites.
    sudo apt update
    sudo apt install -y python3 python3-venv python3-pip
  2. Confirm the interpreter you will use.
    python3 --version
    python3 -c "import platform; print(platform.machine())"

    On x86, choose Python 3.10 through 3.13 for TensorFlow 2.21. On ARM64, use a documented ARM64 CPU-wheel version, currently Python 3.10 or 3.11 in the TensorFlow package table.

  3. Create a project directory and virtual environment.
    mkdir -p ~/tensorflow-app
    cd ~/tensorflow-app
    python3 -m venv tf

    The venv module is included in Python’s standard library and is the officially recommended way to create an isolated environment in TensorFlow’s installation guidance.

    Rank #2
    Sale
    Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
    • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
    • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
    • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
    • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
    • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
  4. Activate the environment.
    source tf/bin/activate

    Your shell prompt normally gains a (tf) prefix. From this point, use python and python -m pip; they now refer to the environment rather than the system interpreter.

  5. Upgrade pip inside the environment.
    python -m pip install --upgrade pip

    This matters because an old pip may fail to select a compatible wheel or may attempt an avoidable source build.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  6. Install TensorFlow from PyPI.
    python -m pip install tensorflow

    The official pip route is the supported distribution path. A conda package is not required, and TensorFlow’s documentation cautions that conda may not provide the latest stable package.

Record the environment’s interpreter and package state after a successful installation:

which python
python -m pip show tensorflow
python -m pip freeze > requirements.txt

Keep the generated requirements file with the application. Before using it for a later deployment, validate the selected TensorFlow version on the target architecture and Python version rather than assuming every platform has the same wheel.

Verify a CPU installation

Verification should test both loading the library and executing an operation. With the environment still activated, run the official small tensor check:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
python -c "import tensorflow as tf; print(tf.__version__); print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

A version number followed by a tensor result shows that the interpreter can import TensorFlow and execute a reduction. Warnings about optional CPU optimizations do not necessarily indicate a failed installation; treat the command’s exit status and traceback as the decisive signals.

If the command fails, confirm that the shell is using the virtual environment:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
which python
python -m pip show tensorflow
python -c "import sys; print(sys.executable)"

If pip show reports no package, activate tf again and install with python -m pip, not a different system-level pip. If pip reports that no matching distribution exists, recheck architecture and Python version against TensorFlow’s wheel table.

Install TensorFlow on an NVIDIA GPU VPS

A GPU-enabled package cannot create a GPU that the VPS provider has not assigned. Start by checking the host-level driver and device exposure:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
nvidia-smi

A working command displays the NVIDIA driver, GPU model, memory, and running processes. If the command is missing or cannot communicate with a driver, stop at this stage and ask the VPS provider to attach a supported NVIDIA GPU and install or enable its driver. Installing Python packages cannot repair a provider-level device or driver problem.

Once nvidia-smi succeeds, activate the environment created for this application and install the GPU extra:

cd ~/tensorflow-app
source tf/bin/activate
python -m pip install --upgrade pip
python -m pip install 'tensorflow[and-cuda]'

The quoted extra is intentional: shell characters in an unquoted requirement can be interpreted by the shell. The command installs TensorFlow with the dependencies specified for its supported NVIDIA GPU path; the host still needs a compatible driver and runtime integration.

Verify that TensorFlow sees the GPU

Run the device query from the same environment:

python -c "import tensorflow as tf; print(tf.__version__); print(tf.config.list_physical_devices('GPU'))"

A non-empty list such as [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')] confirms that TensorFlow can enumerate a GPU. An empty list means the Python import succeeded but GPU visibility did not.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a more explicit diagnostic, use a short script:

python - <<'PY'
import tensorflow as tf
print("TensorFlow:", tf.__version__)
print("Built with CUDA:", tf.test.is_built_with_cuda())
print("GPUs:", tf.config.list_physical_devices("GPU"))
PY

The device list is the operational test. A CUDA-enabled build alone does not prove that the current host driver, shared libraries, and GPU are usable.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Fix an empty GPU list

Work from the outside in, changing one layer at a time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Re-run nvidia-smi. If it fails, the provider’s driver or GPU attachment is the issue, not TensorFlow’s virtual environment.
  2. Confirm the active interpreter and package.
    source ~/tensorflow-app/tf/bin/activate
    which python
    python -m pip show tensorflow
  3. Check for multiple Python environments. Running the verification command with system Python while installing into tf produces a valid import from the wrong environment and can hide the actual problem.
  4. Look for missing NVIDIA tools and libraries.
    which ptxas
    ldconfig -p | grep -E 'libcuda|libcudnn|libcublas' || true

    Missing entries or a ptxas path indicate that the environment cannot locate components required by the GPU stack. TensorFlow’s Linux installation documentation provides commands to link NVIDIA shared libraries and ptxas into the environment; apply those documented commands only after confirming that the provider’s driver and CUDA support match the TensorFlow release.

  5. Inspect the first traceback, not only the final line. Messages about an incompatible driver, an unavailable shared object, or conflicting CUDA components identify different repairs. Do not randomly replace system libraries or mix driver packages from unrelated distributions.
  6. Re-test after every change.
    python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

If the provider offers no supported NVIDIA runtime, use the CPU package or move the workload to a GPU-capable VPS. A Docker image does not remove the need for host-level GPU and driver integration.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use Docker when a container is the better boundary

TensorFlow’s official installation pages describe Docker as an alternative that can simplify GPU setup by supplying a prebuilt user-space environment. The example image is tensorflow/tensorflow:latest-jupyter:

docker pull tensorflow/tensorflow:latest-jupyter
docker run --rm -it -p 8888:8888 tensorflow/tensorflow:latest-jupyter

The image tag is an example, not a reproducibility guarantee: a latest tag can change. For a service, select and record a specific image version after validating it, and keep notebooks or application code outside the disposable container through a mounted volume.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

GPU containers still depend on the VPS provider’s NVIDIA driver and container runtime integration. If the host cannot run nvidia-smi, the container will not manufacture GPU access. Validate GPU visibility inside the container with the same TensorFlow query:

python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

Docker is most useful when several machines need the same user-space dependencies or when you want to separate TensorFlow from the host’s Python packages. A virtual environment is usually less operationally demanding for a single CPU-only VPS application.

Run TensorFlow programs after installation

Keep the environment activated whenever you launch a script:

cd ~/tensorflow-app
source tf/bin/activate
python train.py

You can also bypass shell activation and call the environment’s interpreter directly, which is useful for scheduled jobs and service managers:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
~/tensorflow-app/tf/bin/python ~/tensorflow-app/train.py

Inside a program, inspect available devices before placing work explicitly:

import tensorflow as tf

print(tf.config.list_physical_devices())
print(tf.config.list_physical_devices("GPU"))

TensorFlow can run on the CPU when no GPU is available. Code that requires a GPU should fail clearly or select a documented CPU fallback rather than silently assuming device 0 exists.

Prepare a VPS deployment for long-running work

Installation proves that TensorFlow imports; it does not size the server or supervise a service. For a persistent API, worker, or training process:

  • Run the process under the VPS’s normal supervisor, such as systemd, or under a container orchestrator.
  • Use the virtual-environment interpreter (or a pinned container image) in the supervisor configuration so a system package upgrade cannot silently change the runtime.
  • Pin the TensorFlow version in a requirements file after validating it on the target architecture and Python version.
  • Monitor RAM, disk space, CPU utilization, and GPU memory. TensorFlow workloads can exhaust memory even when the installation itself is small.
  • Keep model files, checkpoints, logs, and temporary data on storage with enough capacity and a backup policy appropriate to the workload.
  • Restrict notebook and API ports at the firewall; expose only the service interface that users need.

These are deployment practices, not TensorFlow performance guarantees. The official installation commands establish a working runtime, while capacity and supervision depend on the model, batch size, concurrency, and VPS plan.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a source build is justified

Build TensorFlow from source only when a published package cannot meet a concrete requirement: an unsupported CPU architecture, a GPU capability not covered by available wheels, or custom compiler and optimization options. The project publishes pre-built packages for common Linux systems, so compiling on an ordinary x86 Ubuntu VPS adds complexity without solving a known problem.

Before choosing a source build, confirm that the limitation is real by checking:

  • the exact architecture reported by uname -m;
  • the Python version and wheel list for the TensorFlow release;
  • the GPU model, driver, and required compute capability;
  • the operating system’s compiler and system-library versions.

Document the build toolchain and resulting artifact if you take this route. A source build must be repeated whenever the interpreter, driver, or TensorFlow source version changes.

Quick troubleshooting matrix

Symptom Likely boundary Action
No matching distribution found Unsupported Python, architecture, or platform wheel Check python3 --version, uname -m, 64-bit status, and the release’s wheel table.
ModuleNotFoundError: tensorflow Wrong interpreter or environment not activated Activate tf; compare which python with python -m pip show tensorflow.
Import traceback involving a shared library OS or native dependency mismatch Read the first missing-library message, verify glibc and architecture, and reinstall in a clean supported environment.
nvidia-smi fails Provider GPU or driver integration Contact the provider or enable its documented GPU runtime before changing TensorFlow packages.
TensorFlow imports but GPU list is empty CUDA/NVIDIA libraries, ptxas, or conflicting components Check the active venv, inspect library paths, and follow TensorFlow’s documented linking procedure.
Process is killed during training VPS memory or GPU-memory exhaustion Monitor resources, reduce workload requirements, or select a larger instance; this is not fixed by reinstalling the package.

Installation checklist

  • Use a 64-bit Linux VPS and confirm x86_64 or supported aarch64 architecture.
  • Use a Python version listed for the TensorFlow release; TensorFlow 2.21 excludes Python 3.9.
  • Create and activate a venv environment.
  • Upgrade pip inside that environment.
  • Install tensorflow for CPU or 'tensorflow[and-cuda]' for a supported NVIDIA GPU.
  • Run the import and tensor-operation check.
  • For GPU use, confirm nvidia-smi and a non-empty tf.config.list_physical_devices('GPU') result.
  • Pin and supervise the validated runtime before making it a long-running service.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DockerLinux VPSMachine LearningNVIDIA GPUPythonTensorFlowUbuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.