For a long time, I didn't understand how to use Virtual Environments in Python 🐍.

If this is just, let's end it here and now: 🧵👇

[2] Virtual Environments let you deal with the dependencies that your code has with external Python libraries.

It avoids having conflicts when your projects depend on different versions of the same library.

👇
[3] Let's imagine that you are building your first Python project and you install the "requests" library:

pip install requests

You get version 2.24.0 installed in your system.

👇
[4] A month later, you decide to work on your second project. It also needs the "requests" library.

But the latest version is not 2.24.0 anymore.

Now version 3 is available, and that's the one you want to use!

👇
[5] You could upgrade your entire system to version 3, but then you'll be potentially breaking the first project you built that depends on 2.24.0!

Can you imagine this happening on a server with many more applications running?

👇
[6] Virtual environments solve this problem.

The first step for every new project is to create a virtual environment for it.

Some people have a central location where they store all environments. I prefer to keep them inside the project folder.

👇
[7] You can create a new virtual environment with Python 3 using the following command:

python3 -m venv .myvenv

Then, you can use "source" to activate the environment.

At this point, you'll have full isolation for your project.

👇
[8] If you install any libraries within a virtual environment, they will never mess with the libraries installed at the system level or other virtual environments.

And this is great!

Here is a @realpython's article covering virtual environments: https://t.co/lgXqJDUlKw
[9] The built-in "venv" module is not the only way to create virtual environments. Here are other options:

- conda
- pipenv
- virtualenv

What's your choice?

More from Santiago

More from Machine learning

This is a Twitter series on #FoundationsOfML.

❓ Today, I want to start discussing the different types of Machine Learning flavors we can find.

This is a very high-level overview. In later threads, we'll dive deeper into each paradigm... 👇🧵

Last time we talked about how Machine Learning works.

Basically, it's about having some source of experience E for solving a given task T, that allows us to find a program P which is (hopefully) optimal w.r.t. some metric


According to the nature of that experience, we can define different formulations, or flavors, of the learning process.

A useful distinction is whether we have an explicit goal or desired output, which gives rise to the definitions of 1️⃣ Supervised and 2️⃣ Unsupervised Learning 👇

1️⃣ Supervised Learning

In this formulation, the experience E is a collection of input/output pairs, and the task T is defined as a function that produces the right output for any given input.

👉 The underlying assumption is that there is some correlation (or, in general, a computable relation) between the structure of an input and its corresponding output and that it is possible to infer that function or mapping from a sufficiently large number of examples.

You May Also Like

Following @BAUDEGS I have experienced hateful and propagandist tweets time after time. I have been shocked that an academic community would be so reckless with their publications. So I did some research.
The question is:
Is this an official account for Bahcesehir Uni (Bau)?


Bahcesehir Uni, BAU has an official website
https://t.co/ztzX6uj34V which links to their social media, leading to their Twitter account @Bahcesehir

BAU’s official Twitter account


BAU has many departments, which all have separate accounts. Nowhere among them did I find @BAUDEGS
@BAUOrganization @ApplyBAU @adayBAU @BAUAlumniCenter @bahcesehirfbe @baufens @CyprusBau @bauiisbf @bauglobal @bahcesehirebe @BAUintBatumi @BAUiletisim @BAUSaglik @bauebf @TIPBAU

Nowhere among them was @BAUDEGS to find
1/“What would need to be true for you to….X”

Why is this the most powerful question you can ask when attempting to reach an agreement with another human being or organization?

A thread, co-written by @deanmbrody:


2/ First, “X” could be lots of things. Examples: What would need to be true for you to

- “Feel it's in our best interest for me to be CMO"
- “Feel that we’re in a good place as a company”
- “Feel that we’re on the same page”
- “Feel that we both got what we wanted from this deal

3/ Normally, we aren’t that direct. Example from startup/VC land:

Founders leave VC meetings thinking that every VC will invest, but they rarely do.

Worse over, the founders don’t know what they need to do in order to be fundable.

4/ So why should you ask the magic Q?

To get clarity.

You want to know where you stand, and what it takes to get what you want in a way that also gets them what they want.

It also holds them (mentally) accountable once the thing they need becomes true.

5/ Staying in the context of soliciting investors, the question is “what would need to be true for you to want to invest (or partner with us on this journey, etc)?”

Multiple responses to this question are likely to deliver a positive result.