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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest setup on a Debian or Ubuntu VPS is to keep the distribution’s default python3 intact, install the packaged development tools with APT, and create one venv for each application. You then install project dependencies inside that environment and configure your service to call its virtual-environment interpreter directly.

This approach avoids breaking operating-system utilities, keeps projects isolated, and gives you a repeatable deployment path. The commands below cover Debian/Ubuntu first, then explain version management, PEP 668 errors, source builds, security, and production operation.

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.

What you need before installing Python

You need shell access to a Linux VPS, a user that can run sudo, and enough disk space for Python packages and your application. Use a non-root account for development and deployment. Root should be reserved for operating-system changes, package installation, and service administration.

Do not assume that the command python exists or refers to Python 3. On many distributions, only python3 is provided, and the unqualified name may be absent or deliberately left unchanged for compatibility.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Identify the distribution and existing interpreter

cat /etc/os-release
python3 --version
command -v python3

/etc/os-release identifies the distribution and release. The version command tells you whether Python 3 is already installed, while command -v shows which executable your shell will run. Record this information before changing anything; it makes troubleshooting a wrong interpreter much easier.

Most Linux distributions either ship Python or provide it through their package manager. The exact package names differ between Debian-family systems, Red Hat-family systems, and other distributions, so do not use an APT command on a server that is not running Debian or Ubuntu.

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

Install Python 3, pip, and venv on Debian or Ubuntu

On a supported Debian or Ubuntu release, install the distribution-supported interpreter and the tools needed to create isolated environments:

sudo apt update
sudo apt install -y python3-full python3-pip python3-venv

apt update refreshes the package index. The second command installs the complete standard-library support commonly needed by applications, the Python package installer, and the venv module. The package manager resolves the correct versions for your release.

Ubuntu’s documentation says that python3 tracks that release’s current default Python 3. Do not remove the default system installation of Python—the python3 package—because Ubuntu warns that doing so would break system tooling. Operating-system utilities may depend on that interpreter even when your own application uses a different one.

Verify the installation

python3 --version
python3 -m pip --version
python3 -m venv --help | head

Use python3 -m pip rather than a bare pip while checking the installation. This asks the selected interpreter to run its own pip module and avoids accidentally invoking a pip belonging to another Python installation.

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.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Create an isolated environment for each project

A virtual environment gives a project its own interpreter entry point and site-packages directory while still using the system Python installation as its base. Python’s Packaging Authority documents venv as a built-in feature from Python 3.3 onward; Python 3.4 and later include pip in newly created environments.

Make the project directory and environment

mkdir -p ~/projects/myapp
cd ~/projects/myapp
python3 -m venv .venv
source .venv/bin/activate
python --version
python -m pip --version

The directory name is only an example. Keep the environment inside the project as .venv (or choose another documented name) and activate it only for interactive work. After activation, your prompt normally shows the environment name, and python resolves to the virtual-environment interpreter.

Ubuntu’s example checks that which python3 resolves to a path under .venv/bin. Run the equivalent checks on your server:

command -v python
command -v python3
python -m site

If the paths do not point into ~/projects/myapp/.venv/bin, activation did not take effect or another shell configuration is overriding it. Activate again from the project directory, or invoke the executable by its full path.

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

Leave and re-enter the environment

deactivate
cd ~/projects/myapp
source .venv/bin/activate

Activation changes shell variables; it does not permanently alter the server. A new SSH session must activate the environment again unless your service or script uses the absolute interpreter path.

Install, inspect, and record project dependencies

Upgrade pip inside the virtual environment and install only the dependencies required by the project:

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
source ~/projects/myapp/.venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

If you are starting a new project, install named packages directly first, then record the resolved set:

python -m pip install package-one package-two
python -m pip freeze > requirements.lock.txt

The requirements.txt file is commonly maintained as an input list, while requirements.lock.txt captures the versions currently installed on this VPS. Commit the dependency files to version control, but do not commit .venv. A virtual environment contains generated binaries and machine-specific paths; it should be recreated from your dependency files on another host.

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

Useful inspection commands

python -m pip list
python -m pip show package-one
python -m pip check
python -m site
  • pip list displays installed distributions and versions.
  • pip show reports metadata and the installation location for one package.
  • pip check detects incompatible declared dependencies.
  • python -m site shows the active interpreter’s site-package directories.

Run these commands after activation, not from an unrelated shell, so the output describes the application environment you will actually use.

Understand and fix “externally managed environment” errors

Recent Debian and Ubuntu releases can implement PEP 668. If you run a system-wide command such as sudo pip install ..., pip may stop with an externally-managed-environment error. The distribution is protecting its package database from files that the operating-system package manager does not know how to update or remove.

Choose the correct installation method

What you are installing Use Reason
A library packaged by Debian or Ubuntu sudo apt install python3-<name> APT tracks files, security updates, and dependencies for the operating system.
A library used by one application A project venv, then python -m pip install ... The project gets isolated versions without modifying system Python.
A standalone Python command-line application pipx, where available Each application receives an isolated environment while its command is exposed globally.
System-wide pip override Avoid on a production VPS It can conflict with distribution packages and damage system tooling.

Use the solution named in pip’s error message. A virtual environment is normally the right answer for application dependencies. Do not add --break-system-packages simply to silence the error; on a production VPS, use it only if you fully understand the package ownership, upgrade, rollback, and recovery consequences.

Choose between the distribution Python, multiple versions, and a source build

The default interpreter is usually the lowest-risk choice for a VPS because security fixes and compatibility updates arrive through the distribution. A separate version manager or a self-built interpreter is justified when an application requires a Python version not provided by the release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
Approach Distribution integration Isolation and version control Operational risk
Distribution package Managed by APT or the distribution’s package manager One release default, with per-project venv isolation Lowest; system updates follow the operating system
Version manager such as pyenv Interpreter versions are maintained outside the package manager Convenient selection of multiple Python versions You must maintain builds, updates, and shell or service paths
Compiled CPython Installed into a separate prefix Full control over the version and build options Highest; you own patches, dependencies, testing, and rollback

Use a version manager when projects need different interpreters

Ubuntu documents pyenv as an option for selecting multiple Python versions. It is useful when two applications require different minor versions or when the distribution default is older than the application’s supported range. Keep the distribution python3 available for operating-system tools, and make the version manager’s selection explicit in each project and service.

Before adopting this route, check that your chosen Python version is supported by the application and its native dependencies. A version manager does not remove the need for a virtual environment; create a separate venv with the selected interpreter so packages remain project-specific.

Compile CPython only with a rollback plan

If you build CPython yourself, Python’s Unix documentation recommends make altinstall. It installs a versioned executable instead of replacing or masquerading as /usr/bin/python3. Build into a separate prefix, test the application there, and switch production only after the service has passed its checks.

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

Do not overwrite the distribution interpreter, change a system symlink casually, or point package-manager scripts at an untested build. Keep the previous interpreter available until the new service has started successfully and can complete a representative request or job.

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

Make the environment reproducible

A VPS is easier to rebuild when the application source, dependency files, interpreter choice, and service configuration are explicit. At minimum:

  • Keep application code and dependency files in version control.
  • Exclude .venv/, caches, secrets, logs, and generated files with an appropriate ignore file.
  • Document the required Python version and the command that creates the environment.
  • Install dependencies with python -m pip after activating the intended environment.
  • Regenerate the lock file deliberately when dependencies change, and review the resulting version changes.

A lock file records what was installed on one occasion; it does not replace security review or testing. Recreate the environment in a clean directory when diagnosing dependency problems instead of repeatedly modifying a possibly inconsistent environment.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Run the application safely on a VPS

Point services directly at the virtual environment

Interactive activation is not reliable for system services, cron jobs, deployment hooks, or SSH sessions. Configure the process supervisor or systemd unit to use the absolute path to the project interpreter, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
/home/deploy/projects/myapp/.venv/bin/python /home/deploy/projects/myapp/app.py

For a web application, replace app.py with the project’s production entry point or application server command. The important detail is that the executable lives under .venv/bin; the service should not depend on a user’s interactive PATH.

Apply least privilege

  • Run the application as a dedicated, non-root service account.
  • Give that account access only to the project files, sockets, logs, and data it needs.
  • Keep SSH access restricted and apply the VPS provider’s firewall and host-firewall controls.
  • Install operating-system security updates through the package manager.
  • Store credentials outside the repository and restrict their file permissions.

Python isolation does not isolate a compromised process from the rest of the server. A virtual environment controls Python packages; it does not replace SSH hardening, firewall rules, filesystem permissions, or service supervision.

Troubleshoot common setup failures

python3: command not found

Check the distribution with cat /etc/os-release, refresh its package index, and install the release-supported Python package using that distribution’s package manager. Do not download an arbitrary binary into /usr/bin.

No module named venv

On Debian or Ubuntu, install python3-venv and retry python3 -m venv .venv. If the command still fails, verify that the python3 executable you are invoking belongs to the distribution installation whose packages you just updated.

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

pip installs into the wrong location

Activate the project environment and compare:

command -v python
python -m pip --version
python -m site

The pip path and site-package path should reference the same .venv. Replace a bare pip command with python -m pip so the interpreter and installer cannot silently diverge.

The service works over SSH but fails under systemd

Systemd does not read your interactive shell’s activation commands. Use the absolute .venv/bin/python path, set the service working directory explicitly, provide required environment variables through the service configuration, and inspect the service logs. Test the exact command as the service account before restarting production.

A package fails to build

Some Python packages contain native extensions and require compiler or operating-system development packages. Read the package’s build error, install only the required distribution prerequisites, and retry inside the project environment. Keep those build prerequisites separate from runtime dependencies where your deployment process permits it.

Final verification checklist

  1. Run cat /etc/os-release and record the distribution and release.
  2. Confirm the supported interpreter with python3 --version.
  3. Install python3-full, python3-pip, and python3-venv on Debian or Ubuntu.
  4. Create and activate a project-specific .venv.
  5. Verify command -v python3, command -v pip, python -m site, and python -m pip list.
  6. Install dependencies with python -m pip and record them in a requirements or lock file.
  7. Keep .venv out of version control.
  8. Configure production services with the environment’s absolute interpreter path.
  9. Run the application as a least-privilege account and keep the VPS hardened and patched.

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.