Virtual Environments
Last updated Jan 16, 2025
My first error in the course was solved due to a virtual environment issue. So let's talk about setting up a virtual environment, specifically conda on a Mac.
I will add that it is my understanding that a new virtual environment is encouraged for each module - though there may be one module that does not need one? I will update this page once I know the answer!
[Optional] Brew install iterm2
It was recommended to me to use iterm2
Do you have homebrew installed?
Open a terminal window and type
b. If yes, continue. If no, installl homebrew - details https://docs.brew.sh/Installation
brew install iterm2
Conda
You may need to install Anaconda, so head over to the site if you do not have the application.
Open iterm2 (a terminal window) and type
This will show your python version for your awareness
Now the fun part, create an environment! Remember, we will want a different environment for each project. I am using python version 3.12, so the command is
Now we want to add our packages that are not included in the standard library, such as pandas. To do that, we need to
activate
the environment and thenpip install
what we need.
In your terminal, your myenvname of choice should now show at the far left of your command promt in parentheses like
(myenvname) Kaylas-MacBook-Air:data-engineering-zoomcamp-my-work kayla$
In the future, to use these packages, we import them into our python scripts. For example, for pandas we would write import pandas as pd
at the top of our python script.
Last updated