Hi Reader,
Happy (belated) new year! 🥳
I just updated my email settings in order to comply with the latest anti-spam rules. Would you reply to this email so that I know you received it?
You don’t even need to write anything… just click Reply, then Send. Thank you! 🙏
Can One Episode Ruin a TV Show?
This is an excellent example of a thoughtful and engaging statistical analysis. It has a strong narrative and relevant visualizations. See if you can incorporate some of those elements into your next analysis!
In the previous tip, I explained the differences between conda, Anaconda, and Miniconda.
I said that you can use conda to manage virtual environments:
In today’s tip, I’m going to explain the benefits of virtual environments and the how to use virtual environments in conda.
Let’s go! 👇
A virtual environment is like a “workspace” where you can install a set of packages with specific versions. Each environment is isolated from all other environments, and also isolated from the base environment. (The base environment is created when you install conda.)
So, why use virtual environments at all?
Thus by using environments, you won’t breaking existing projects when you install, update, or remove packages, since each project can have its own environment.
You can also delete environments once you’re done with them, and if you run into problems with an environment, it’s easy to start a new one!
conda environments have a lot of complexity, but there are actually only six commands you need to learn in order to get most of the benefits:
1️⃣ conda create -n myenv jupyter pandas matplotlib scikit-learn
This tells conda to:
That last point is a mouthful, but it basically means that conda will try to avoid any conflicts between package dependencies.
Note: conda stores all of your environments in one location on your computer, so it doesn’t matter what directory you are in when you create an environment.
2️⃣ conda activate myenv
This activates the myenv environment, such that you are now working in the myenv workspace.
In other words:
Note: Activating an environment does not change your working directory.
3️⃣ conda list
This lists all of the packages that are installed in the active environment (along with their version numbers). If you followed my commands above, you’ll see python, jupyter, pandas, matplotlib, scikit-learn, and all of their dependencies.
4️⃣ conda env list
This lists all of the conda environments on your system, with an asterisk (*) next to the active environment.
5️⃣ conda deactivate
This exits the active environment, which will usually take you back to the “base” environment (which was created by Anaconda or Miniconda during installation).
6️⃣ conda env remove -n myenv
This permanently deletes the myenv environment. You can’t delete the active environment, so you have to deactivate myenv (or activate a different environment) first.
If you want to learn more about conda environments, check out this section of the user guide:
If you want a broader view of conda and its capabilities, check out this section:
🔗 Common tasks
Or, just shoot me an email and I’m happy to help! 💌
Did you like this week’s tip? Please forward it to a friend, or share this link on social. It really helps me out! 🙌
See you next Tuesday!
- Kevin
P.S. How to Pass the Pepper While Social Distancing (YouTube)
Did someone AWESOME forward you this email? Sign up here to receive Data Science tips every week!
Join 25,000+ intelligent readers and receive AI tips every Tuesday!
Hi Reader, Here are your top AI stories for the week: ChatGPT can weaken your brain Claude shares nerve gas recipe Amsterdam ends AI experiment due to bias Read more below! 👇 Sponsored by: Brain.fm Transform Your Focus With Brain.fm I know you're always on the hunt for tools that genuinely improve your life—which is why I'm excited to introduce you to Brain.fm's groundbreaking focus music. Brain.fm's patented audio technology was recently validated in a top neuroscience journal, showing how...
Hi Reader, Last week, I invited you to help me test Google's Data Science Agent in Colab, which promises to automate your data analysis. Does it live up to that promise? Let's find out! 👇 Sponsored by: Morning Brew Business news you’ll actually enjoy Join 4M+ professionals who start their day with Morning Brew—a free daily newsletter that makes business, tech, and finance news genuinely enjoyable to read and hard to forget. Each morning, it breaks down complex stories in plain English—cutting...
Hi Reader, Today I'm trying something brand new! I wrote short summaries of the 5 most important AI stories this week, and also turned it into a video: Watch the video I'd love to know what you think! 💬 AI-generated TV ad airs during NBA finals Prediction market Kalshi just aired this AI-generated ad on network TV during the NBA finals. It was created in just two days by one person using Google's new Veo 3 video model, plus scripting help from Google's Gemini chatbot. Expect to see many more...