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×
Skip to content
VGSources
Blog

How to Install and Use TensorFlow on a Linux VPS (CPU and NVIDIA GPU)

Install TensorFlow on Ubuntu or another 64-bit Linux VPS with a Python virtual environment. Follow the CPU or NVIDIA GPU path, verify the install, and troubleshoot GPU visibility.
Length12 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install TensorFlow in a 64-bit Linux virtual machine with an isolated Python venv, then choose the CPU package or the NVIDIA GPU extra that matches your VPS. On Ubuntu, the practical sequence is to install Python and venv, create and activate an environment, upgrade pip, install TensorFlow, and run a tensor test. GPU users must first verify that the provider has attached an NVIDIA device and installed a working driver with nvidia-smi.

Check compatibility before installing

TensorFlow installation is gated by more than the Linux distribution. The VPS image, CPU architecture, glibc, Python interpreter, and (for GPU use) the NVIDIA driver all have to line up with an available TensorFlow wheel.

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.

Use a 64-bit Linux VPS

TensorFlow’s Linux pip instructions use Ubuntu 16.04 or newer, 64-bit, as their baseline. Other distributions may work, but Ubuntu is the documented path. Confirm that your VPS is not a 32-bit image and identify its architecture before creating an environment:

uname -m
getconf LONG_BIT

A typical x86 VPS reports x86_64 and 64. ARM servers report an ARM64 value such as aarch64; their wheel availability is narrower than x86.

#1 Best Overall
Sale
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
  • AI Performance: 767 AI TOPS
  • OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode)
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Axial-tech fan design features a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • A 2.5-slot design maximizes compatibility and cooling efficiency for superior performance in small chassis

Select a supported Python version

TensorFlow 2.21 no longer supports Python 3.9. The TensorFlow package table lists Linux x86 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.

VPS architecture Python versions listed for TensorFlow 2.21 Workload covered
Linux x86 3.10, 3.11, 3.12, 3.13 TensorFlow Linux x86 wheels
Linux ARM64 3.10, 3.11 CPU wheels
Any Linux architecture 3.9 Not supported by TensorFlow 2.21

Beginning with TensorFlow 2.10, ARM64 CPU builds have been maintained and tested by AWS as a third party. Release timing can therefore differ from x86. If your distribution supplies Python 3.9 by default, install a supported interpreter rather than forcing a 2.21 installation into that interpreter.

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

Choose an installation path

Your hardware and operational requirements determine the right route. The ordinary starting point is a CPU pip installation; GPU pip is for a VPS with a compatible, exposed NVIDIA device; Docker gives you a repeatable prebuilt environment; and a source build is an advanced fallback.

Path Use it when What it requires
CPU pip Inference, development, or modest training on a CPU-only VPS Supported 64-bit Linux, Python, and pip
NVIDIA GPU pip The provider exposes a compatible NVIDIA GPU and driver nvidia-smi succeeds, plus a supported Python environment
Docker You want a prebuilt, repeatable environment, particularly for GPU work Docker and the provider’s GPU runtime/driver integration
Build from source You need an unsupported architecture, custom compiler options, or a specific GPU capability Build tooling and time; prebuilt packages are preferred for common Linux systems

The pip route is TensorFlow’s supported distribution method. Conda may not provide the latest stable package, so use pip inside a virtual environment when you want the documented installation path.

Install TensorFlow for CPU workloads

These commands use Ubuntu’s package manager and Python’s standard-library venv module. Run them as a user with sudo access.

  1. Refresh package metadata and install Python tooling.
    sudo apt update
    sudo apt install -y python3 python3-venv python3-pip
  2. Confirm the interpreter version.
    python3 --version

    Use a version listed for your architecture. On Linux x86 with TensorFlow 2.21, that means Python 3.10 through 3.13; on ARM64 CPU, Python 3.10 or 3.11.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Create an isolated environment.
    python3 -m venv tf

    The environment directory is named tf here; choose another path if it better suits your project.

  4. Activate it for the current shell.
    source tf/bin/activate

    Your prompt normally gains a (tf) prefix. Every subsequent python and pip command now targets this environment.

  5. Upgrade pip inside the environment.
    python -m pip install --upgrade pip
  6. Install TensorFlow from PyPI.
    python -m pip install tensorflow

Using python -m pip ties pip to the interpreter that will run TensorFlow, avoiding the common mistake of installing into a different system Python.

Verify the CPU installation

Do not treat a completed download as proof that TensorFlow works. Import it and execute a small operation in the activated environment:

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.
python -c "import tensorflow as tf; print(tf.__version__); print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

The command should print a TensorFlow version followed by the result of reducing a randomly generated 1,000-by-1,000 tensor. A successful import and tensor result show that this interpreter can load the package and execute an operation.

If the import fails

  • Check that the environment is active, or call its interpreter directly, for example tf/bin/python -c "import tensorflow as tf; print(tf.__version__)".
  • Run python --version and compare it with the wheel availability for your architecture. Python 3.9 cannot be used for TensorFlow 2.21.
  • Confirm that the VPS is 64-bit with uname -m and getconf LONG_BIT.
  • Upgrade pip in the same environment and retry the package installation rather than mixing a system pip with the virtual environment.

Install TensorFlow on an NVIDIA GPU VPS

A GPU package cannot create hardware that the host has not assigned to your virtual machine. First establish that the provider attached an NVIDIA GPU and that its driver is available:

nvidia-smi

A working command displays the device and driver information. If the command is missing, errors, or shows no device, resolve the VPS image, provider attachment, or driver issue before changing Python packages. The provider must support the required GPU and driver integration; a software-only VPS cannot be converted into a GPU instance by installing TensorFlow.

Install the GPU package in the virtual environment

Activate the same tf environment used for CPU installation, upgrade pip, and install TensorFlow with its CUDA-related extra:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
ASUS Dual GeForce RTX 3050 6GB GDDR6 OC Edition Gaming Graphics Card
  • NVIDIA Ampere Streaming Multiprocessors: The all-new Ampere SM brings 2X the FP32 throughput and improved power efficiency.
  • 2nd Generation RT Cores: Experience 2X the throughput of 1st gen RT Cores, plus concurrent RT and shading for a whole new level of ray-tracing performance.
  • 3rd Generation Tensor Cores: Get up to 2X the throughput with structural sparsity and advanced AI algorithms such as DLSS. These cores deliver a massive boost in game performance and all-new AI capabilities.
  • Axial-tech fan design features a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure.
  • OC Mode : 1500 MHz (Boost Clock)/Default Mode : 1470 MHz (Boost Clock)
source tf/bin/activate
python -m pip install --upgrade pip
python -m pip install 'tensorflow[and-cuda]'

The quoted package name prevents the shell from interpreting the square brackets. The extra supplies the Python-side CUDA dependencies expected by this installation route; it does not replace the host’s NVIDIA driver.

Check whether TensorFlow sees the GPU

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

A list containing a GPU device confirms that TensorFlow can see one. An empty list means the Python import may still work, but no GPU is currently visible to TensorFlow.

Troubleshoot an empty GPU list

Work from the outside in. This prevents you from repeatedly reinstalling TensorFlow when the actual problem is the VPS assignment or host driver.

  1. Re-run nvidia-smi. If it fails, contact the VPS provider or repair the driver installation. TensorFlow cannot discover a device that the operating system cannot report.
  2. Confirm the correct environment. Run the GPU query with the activated environment’s python, and check python -m pip show tensorflow if you need to verify which interpreter contains the package.
  3. Check for missing or conflicting CUDA components. TensorFlow’s Linux instructions identify missing or conflicting components as common causes and provide commands to link NVIDIA shared libraries and ptxas into the environment. Apply those documented linking commands only after the provider’s driver and CUDA support are confirmed.
  4. Repeat the visibility test.
    python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

If the list remains empty while nvidia-smi is healthy, compare the provider’s driver support, the TensorFlow release, and the GPU architecture with the official compatibility instructions. Building TensorFlow from source is a last resort for a capability not covered by the available wheel; it adds compiler and maintenance work.

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

Use Docker when a container is a better fit

TensorFlow documents Docker as an official alternative that can simplify GPU setup by giving you a prebuilt environment. The example image is tensorflow/tensorflow:latest-jupyter. A container still depends on the VPS provider’s NVIDIA driver and GPU runtime integration; Docker does not bypass those host requirements.

Choose Docker when you need the same userspace and Python dependencies across machines, want to discard and recreate environments cleanly, or are already operating services with containers. Choose the venv/pip route when you want the smallest setup, direct access to the VPS filesystem, or a conventional Python service. Whichever route you select, verify the installation from inside the actual runtime that will execute your code.

Run scripts and keep the environment consistent

Activate the environment before running a program:

source tf/bin/activate
python train.py

You can avoid shell activation in automation by invoking the environment’s interpreter directly, such as tf/bin/python train.py. This is useful for scheduled jobs and service definitions because it makes the interpreter path explicit.

Pin the version after validation

Once your import, tensor operation, and (if applicable) GPU visibility test pass, record the TensorFlow version in a requirements file used by the deployment. Pinning after validation makes rebuilds reproducible while still allowing you to choose when to test a newer release. Keep the virtual environment separate from the system Python so operating-system updates do not silently replace the interpreter used by your model.

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.

Run a long-lived service

For an API, worker, or training process that must stay online, run it under the VPS’s normal supervisor, such as systemd, or under a container orchestrator. Configure the supervisor to call the venv interpreter directly, restart failed processes according to your operational policy, and write logs somewhere you can inspect.

Monitor RAM, disk space, CPU utilization, and (on GPU instances) GPU memory. TensorFlow workloads can fail when the operating system or device runs out of memory even though installation and import succeeded. Resource sizing and supervision are deployment practices; they are separate from TensorFlow’s package-install commands.

Common installation mistakes and their fixes

Installing into the wrong Python

Symptoms include a successful pip message followed by ModuleNotFoundError when running the script. Activate tf, then use python -m pip for both installation and inspection. If activation is inconvenient, use tf/bin/python and tf/bin/pip explicitly.

Using Python 3.9 with TensorFlow 2.21

TensorFlow 2.21 removed Python 3.9 support. Install a supported interpreter for the VPS architecture and create a new environment with it; changing only the package command cannot make an incompatible interpreter supported.

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

Assuming ARM64 has the same wheel coverage as x86

Linux ARM64 CPU wheels are listed for Python 3.10 and 3.11, while Linux x86 wheels are listed for 3.10 through 3.13. On ARM64, check wheel availability before selecting a Python release and allow for third-party AWS maintenance and different release timing.

Expecting a GPU without host support

If nvidia-smi cannot see a device, reinstalling the Python package is not the remedy. The instance must include an NVIDIA GPU and a functioning driver. Ask the provider to attach or repair the device, or select a GPU-enabled VPS.

Rank #3
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Powered by GeForce RTX 5070 Ti
  • Integrated with 16GB GDDR7 256bit memory interface
  • PCIe 5.0
  • WINDFORCE cooling system

Mixing CPU and GPU environments accidentally

Keep one environment per deployment choice, or remove and recreate the environment when changing paths. Always run the visibility query from the same interpreter that will execute the workload.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Architecture, wheel, and runtime checks

Architecture checks should happen before a long package download. x86_64 systems have the broadest Linux wheel coverage in the TensorFlow 2.21 table, while aarch64 is limited to the listed ARM64 CPU builds. A 64-bit result alone is not enough: the architecture name and the Python minor version must both match a published wheel. The operating system’s glibc and related system libraries are additional compatibility gates, so an unusual or very old VPS image can fail even when Python itself is supported.

Record the values you used for a successful deployment: Linux distribution and release, architecture, Python version, TensorFlow version, and—on GPU machines—the driver information shown by nvidia-smi. This small inventory makes it easier to reproduce the environment on a replacement VPS and to distinguish an application change from a platform change.

Make upgrades deliberate

Do not casually upgrade TensorFlow in a running service. First copy the environment definition or requirements file, create a test environment, and repeat the import, tensor, and GPU-visibility checks there. On ARM64, recheck the published wheel list whenever changing Python because the available combinations are narrower and release timing can differ from x86. If a new package no longer supports the interpreter on the VPS, install a supported Python version and create a fresh venv rather than modifying the system interpreter in place.

Keep deployment commands explicit. A service should call the tested venv interpreter or the tested container image, not whichever python happens to be first on an interactive user’s PATH. This avoids a situation where a scheduled job uses a different TensorFlow installation than the one you tested manually.

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

Source builds: when the extra work is justified

Pre-built packages are the preferred route for common Linux systems. Consider a source build only when your architecture is unsupported by available wheels, you need compiler options that the package does not provide, or a particular GPU capability is not covered. A source build brings its own compiler, dependency, build-time, and maintenance requirements, so it should not be the first response to an ordinary import error or an empty GPU list.

Before committing to a build, recheck the simpler explanations: an unsupported Python minor version, a 32-bit image, an incorrect interpreter, a missing provider-assigned GPU, or a driver/CUDA mismatch. If one of those is the cause, rebuilding TensorFlow will not correct it.

A practical decision checklist

  • Is the VPS a 64-bit Linux system, preferably Ubuntu 16.04 or newer for the documented pip path?
  • Does uname -m match the wheel family you intend to use?
  • Is the Python version supported for that architecture and TensorFlow release?
  • Have you created and activated a dedicated venv?
  • Did you upgrade pip and install with python -m pip?
  • Did the import-and-tensor test complete successfully?
  • For GPU work, does nvidia-smi show the provider-assigned device?
  • Does tf.config.list_physical_devices('GPU') return a device from the production interpreter?
  • Have you pinned the tested TensorFlow version and arranged supervision and resource monitoring for long-running jobs?

Which route should you use?

For most Linux VPS projects, start with CPU pip in a venv. It has the fewest moving parts and provides a clear import test before you add hardware-specific dependencies. Move to the GPU extra only when the provider confirms an NVIDIA device and driver, then validate visibility with TensorFlow itself. Use Docker when reproducibility or a prebuilt GPU userspace outweighs the simplicity of a native venv. Reserve source builds for a genuine wheel or architecture requirement, not as the first response to an ordinary installation error.

Frequently Asked Questions

What Python version does TensorFlow 2.21 support on a Linux VPS?

For Linux x86, the TensorFlow 2.21 package table lists Python 3.10, 3.11, 3.12, and 3.13 wheels. Linux ARM64 CPU wheels are listed for Python 3.10 and 3.11. Python 3.9 is no longer supported by TensorFlow 2.21.

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

How do I install TensorFlow on an Ubuntu CPU VPS?

Install python3, python3-venv, and python3-pip with apt. Create an environment with python3 -m venv tf, activate it, run python -m pip install --upgrade pip, and install with python -m pip install tensorflow.

How do I enable NVIDIA GPU support?

Confirm that nvidia-smi reports the provider-assigned NVIDIA device, activate your virtual environment, and run python -m pip install 'tensorflow[and-cuda]'. The package extra does not replace the host NVIDIA driver or provider GPU runtime.

How can I check whether TensorFlow sees my GPU?

Run python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))" from the same environment that will run your workload. A listed device is visible to TensorFlow; an empty list requires driver, CUDA-component, environment, and provider checks.

Should I use Docker or a Python virtual environment?

Use a venv and pip for the smallest native setup and direct VPS filesystem access. Docker is useful when you need a repeatable prebuilt userspace, especially for GPU work. Containers still require the provider’s NVIDIA driver and GPU runtime integration.

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.

When should I build TensorFlow from source?

Use a source build only for an unsupported architecture, custom compiler options, or a specific GPU capability not covered by available wheels. Pre-built packages are preferred for common Linux systems, and rebuilding will not fix a wrong Python version or missing host GPU driver.

The Bottom Line

Use a 64-bit Ubuntu-compatible VPS, select a Python version with a matching TensorFlow wheel, and install the package inside an isolated venv. Start with tensorflow for CPU work; use tensorflow[and-cuda] only after nvidia-smi confirms a working NVIDIA setup. Verify the import, tensor operation, and GPU list from the exact interpreter or container used in production.

Quick Recap

SaleBestseller No. 1
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
AI Performance: 767 AI TOPS; OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode); Powered by the NVIDIA Blackwell architecture and DLSS 4
$770.55
SaleBestseller No. 2
ASUS Dual GeForce RTX 3050 6GB GDDR6 OC Edition Gaming Graphics Card
ASUS Dual GeForce RTX 3050 6GB GDDR6 OC Edition Gaming Graphics Card
OC Mode : 1500 MHz (Boost Clock)/Default Mode : 1470 MHz (Boost Clock); A stainless steel bracket is harder and more resistant to corrosion.
$257.22
Bestseller No. 3
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
Powered by the NVIDIA Blackwell architecture and DLSS 4; Powered by GeForce RTX 5070 Ti; Integrated with 16GB GDDR7 256bit memory interface
$1,249.99

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.

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.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair 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.