Skip to main content
Welcome! If you’re new to conda, you’re in the right place. This tutorial walks through creating and using your first conda environment as part of a real Python workflow. You’ll create an environment, install packages, and use that environment to run a small Python program.
Purpose: This tutorial teaches you the basics of creating and using conda environments for Python development.Outcome: You’ll create a new environment, add packages using both conda and pip, and configure Visual Studio Code to use your environment. By the end, you’ll have created a fun Python program (featuring an ASCII cow!) and learned how to set up environments for your own projects.Audience: Beginners new to environment managementDuration: 20 minutes

Prerequisites and requirements

Before you begin, make sure you have an internet connection and the following software installed on your machine:

Creating your project’s conda environment

The conda installation process creates an environment called base, which is where conda itself is installed. However, when starting work on a new project, it’s best practice to create a new environment. This keeps your environments maintainable and reproducible while also keeping your base environment stable. Let’s create a new environment called hello-env with Python 3.14 as the .
1

Open a shell application

Conda is a command line interface (CLI) tool, which means you’ll use a shell application to run conda commands. For Windows users, you’ll use an application called Anaconda Prompt, which comes installed with Anaconda Distribution and Miniconda. For macOS and Linux users, you’ll use your system’s Terminal application.
To open Anaconda Prompt, type “Anaconda Prompt” in the Windows search bar, then select Anaconda Prompt.
Windows desktop with Anaconda Prompt in the taskbar search field.
2

Create a new environment

Use the copy button to copy the following command, paste it into your shell application, and press Enter (Windows)/ Return (macOS/Linux) to run it:
conda create --name hello-env python=3.14
The --name flag sets the new environment’s name.
3

Activate your new environment

You’ll need to activate your newly created environment before you can use it. Run the following command to activate hello-env:
conda activate hello-env
Conda displays the currently active environment in your shell application beside the input line:
(hello-env) C:\Users\username>
Your new project’s environment is now active!

Learn more

Review the following resources to learn more about the topics covered in this section, or continue on to the next section.

Adding packages to your project’s environment

Right now, your environment only has Python 3.14 and its dependencies installed. However, our project uses functionality that is not provided by the Python standard library, so we must install third-party packages to provide that functionality.
1

Add conda packages

We can find the additional conda packages that we need for our project on the conda-forge community channel.
Conda-forge is a community-maintained collection of conda packages. Conda-forge packages are open source and free to use.
Our project requires the requests and emoji packages. Install the packages and their dependencies:
conda install --channel conda-forge requests emoji 
The --channel flag tells conda to give the specified channel top priority for installing packages and their dependencies.
The requests and emoji Python packages are now available in your environment.
2

Add packages with pip

Our project still requires one last package. However, this package is only available from Python’s package index (also known as PyPI) and must be installed using Python’s package manager, pip. Pip is a dependency of Python, so it was installed when you created your environment with Python in it. You can use it directly in the hello-env environment.
Using conda and pip together requires care to avoid dependency conflicts. Install conda packages first, then use pip only for packages unavailable in conda channels. Review the Installing pip packages page to understand how to safely use conda and pip together for your own projects.
Use pip to install cowsay from PyPI:
pip install cowsay 
Your hello-env environment now includes Python 3.14, requests, emoji, cowsay, and all their dependencies.

Learn more

Review the following resources to learn more about the topics covered in this section, or continue on to the next section.

Using your project’s environment in VS Code

1

Open VS Code

First, open VS Code and select New File… on the Welcome tab.Then, select Python File to create a new untitled Python file.
VS Code welcome screen with the New File... and Python File options indicated with an arrow.
Press Ctrl+S (Windows/ Linux) or Cmd+S (macOS) to open the Save As… dialogue and save your new file as factual-cow.py.
2

Set the interpreter

Next, select hello-env as the file’s Python interpreter.
The Python interpreter is the Python installation that will run your code. By selecting hello-env, you’re telling VS Code to use the Python from your new environment.
To set the interpreter, select the interpreter button in the bottom right corner, then select Python 3.14.0 (hello-env) from the dropdown:
Selecting the hello-env environment as the Python interpreter in VS Code.
If you open a VS Code terminal, your terminal might show (base), even though your interpreter in the bottom right shows Python 3.14.0 (hello-env). The Python interpreter and the terminal are separate: the interpreter runs your .py files, while the terminal is for running commands. If you want to run conda commands from the VS Code terminal (for example, to add packages to your environment), activate the hello-env environment by running the following command in the VS Code terminal: conda activate hello-env.
An active base environment in a VS Code terminal and the hello-env environment as Python interpreter
Your Python interpreter is now set to Python 3.14.0 (hello-env).
3

Import your packages

Now that we’ve set the interpreter, let’s import our packages. Add the following to the top of the factual-cow.py file:
import requests
import emoji
import cowsay
Select Run to run the code. If there are no errors in the terminal, your imports were successful.
4

Write and run code

Let’s write a simple program that uses all three packages we imported. Add the following code below your import statements:
# Use requests to get a random fun fact from an API
response = requests.get("https://uselessfacts.jsph.pl/api/v2/facts/random?language=en")
fact = response.json()["text"]

# Use emoji to add an emoji
message = emoji.emojize(f":light_bulb: Did you know? {fact}")

# Use cowsay to have a cow tell you the fact
cowsay.cow(message)
Select Run to run the code. Your terminal will display a fun fact from a knowledgeable cow!
VS Code UI with Python code and terminal showing an ASCII cow saying, 'Did you know? The only nation whose name begins with an A but doesn't end in an A is Afghanistan.'

Learn more

Review the following resources to learn more about the topics covered in this section, or continue on to the next section.

Tutorial wrap up

Congratulations! You’ve just created your first conda environment, installed packages using both conda and pip, and used your environment in VS Code to run Python code. If you want to clean up after completing this tutorial, you can delete the hello-env environment.
1

Open Anaconda Prompt or Terminal

Return to Anaconda Prompt (Windows) or Terminal (macOS/Linux).
Terminal is your system’s terminal application, not VS Code’s terminal.
2

Deactivate your environment

First, deactivate your hello-env environment:
conda deactivate
3

Delete your environment

Then, delete the hello-env environment:
conda remove --name hello-env --all
The hello-env environment is deleted and .
What you learned
  • How to create and activate conda environments
  • How to install packages from conda-forge and PyPI
  • How to configure VS Code to use your environment
  • How to make a cow tell you fun facts
  • How to delete an environment
Next steps
  • The Concepts section is a great place to learn the basics of the conda ecosystem.
  • The Working with conda section offers more in-depth documentation on how to use conda.
  • The official conda site provides an even deeper level of technical detail on conda’s use, as well as a full index of conda commands.
  • The IDE tutorials offer step-by-step instructions on how to use conda with other popular IDEs like PyCharm and JupyterLab.
Have feedback? Use the Yes or No feedback buttons below to let us know what you thought about this tutorial and help us improve.