Advice and Tips to Properly Work with Virtual Environments

Advice and Tips to Properly Work with Virtual Environments

Because Virtual Environments can and will save you headaches. In early 2020, I was working on a school project using Keras/Tensorflow. Everything was working great. Then, I shared my code with my teammate so he could start working on it too. However, for some reason, it was not working for him.

In early 2020, I was working on a school project using Keras/Tensorflow. Everything was working great. Then, I shared my code with my teammate so he could start working on it too. However, for some reason, it was not working for him.

We spent hours trying to figure it out. Eventually, we realized that the problem was caused by the fact we had different packages versions installed. Once we managed to make it all work, I decided to find a way to avoid this problem occuring ever again.

That’s where virtual environments come in.

If you are already familiar with virtual environments, you can skip to section 4 where I will give some advice and tricks to help you improve and customize your use of virtual environments.


1. Why use Virtual environments?

As you get better with Python, you will be using more and more packages and it will get more and more difficult to properly deal with dependencies on earlier versions of packages, hence the need for virtual environments.

Think of a virtual environment as a separate folder where you can keep specific versions of packages or even a specific Python version without affecting the rest of your projects.

It’s an easy way to ensure you (and everybody else) can always run your Python scripts with no dependency issues, i.e. always using the correct versions for your packages.

All codes coming up can be executed directly from the Anaconda prompt or the command line.

command-line python virtualenv tips-and-tricks virtual-environment

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

WHY DID I STOP USING COMMAND LINE TO ACTIVATE MY VIRTUAL ENVIRONMENT ?

Learn how to create Virtual Environment using venv and activate using executables. What is a Virtual Environment? Virtual Environments help create, manage and isolate environments for the project, each one using same or different versions of the executables.

Python Tricks Every Developer Should Know

In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.

Virtualenv or Venv ? Virtual Environments in Python [Complete Guide]

In this video we will learn the basics of virtualenv or venv in Python. We will learn how to install virtualenv, activate virtualenv for different versions o...

How to Setup a Virtual Environment With Different Python Versions:

A complete step-by-step tutorial from start to finish. A virtual environment allows your projects to operate independently from the main Python environment. It provides an effective way to prevent version conflicts between dependencies of different projects.

“Python Virtual Environment ” in Nutshell.

I will walk you through everything about Virtual Environment in Python that you should know like from “what is virtual…