1/5
We've just installed Vyper using the `uv tool install` command. This might seem a little different if you're used to installing packages using the Python environment. Traditionally, you might be used to running commands like: ```bash python3 -m pip install vyper ``` or even just: ```bash pip install vyper ``` These commands would install Vyper directly into your active Python environment. However, the `uv tool install` command installs Vyper into its own isolated environment. We have a global Python environment, which typically holds the default Python version and any globally installed packages. We also have a virtual environment, which is essentially a self-contained Python environment. This is where we installed Vyper using `uv tool install`. If we were to install Vyper into the global Python environment, we might run into issues if we want to use different package versions. It would then be difficult to switch between the two environments without affecting the other. To show you how isolated environments work, we can run a few commands. We'll start by creating a virtual environment using Python: ```bash python3.11 -m venv .venv ``` Then, we activate this virtual environment using: ```bash source .venv/bin/activate ``` We can check our current environment using: ```bash which vyper ``` We see that it points to the global Python environment, even though we're in the virtual environment. Now, let's deactivate the virtual environment: ```bash deactivate ``` And check the `which` command again: ```bash which vyper ``` We see that Vyper is not found, because we deactivated the virtual environment. Let's run the `uv tool` command again: ```bash uv tool install vyper ``` We see the output, and that Vyper is installed into its isolated environment. Now, if we run the `which` command again: ```bash which vyper ``` We see that Vyper is now installed in the virtual environment. The main advantage of using the `uv tool` to install Vyper is that it creates a completely isolated environment. We can't affect the global Python environment, and vice versa. This is important because Vyper, being a compiler, is extremely sensitive to different package versions. If we were to use different package versions, we could run into issues. It's best practice to install Vyper using the `uv tool` to avoid any conflicts. We're also going to talk about VS Code and how it interacts with virtual environments. We will have an environment, which is typically the global environment, and another environment which is the isolated environment. We can switch between the two environments. We can use our AI to ask questions about the difference between a Python virtual environment and when we're not in a virtual environment. That's it for our lesson on installing Vyper into an isolated environment using the `uv tool`. Remember, using isolated environments is the best way to avoid conflicts when working with Vyper. Keep practicing and don't hesitate to ask your AI buddies or the community any questions you have.
A comprehensive guide to understanding isolated virtual environments (UV tool install) - This lesson covers the basics of virtual environments, demonstrating how to install a Python tool into a virtual environment, and how the process differs from installing the tool into the global Python environment. It also explains why this approach is recommended.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on April 21, 2025
Duration: 2h 20min
Duration: 1h 51min
Duration: 58min
Duration: 2h 23min
Duration: 53min
Duration: 2h 24min
Duration: 28min
Duration: 1h 54min
Duration: 11min
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on April 21, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar