Setting up Python Development Environment in Mac with Apple Silicon
Setting up a Python development environment is essential for efficient project management, especially in machine learning and data science. This guide covers using Anaconda for virtual environments, package management, and configuring a code editor like VS Code with useful extensions.

If you're working with Python for machine learning, data science, or any development work, setting up a proper development environment is crucial for managing projects effectively. This guide walks you through the process of setting up a python development environment using Anaconda, a popular distribution that simplifies package management and deployment.
What You Need for Your Python Development Environment
Here’s a basic overview of what you'll need for starting python development:
- Virtual Environment – Isolated spaces to manage dependencies for different projects.
- Code Editor – A tool to write and debug your code.
- Formatter – Ensures your code is well-structured and readable.
- Extensions – Plugins for your code editor to enhance your workflow.
- Auto Complete – Helps in writing code faster by suggesting methods, variables, and classes.
Let's discuss each of these in detail.
Virtual Environment Setup
Before we move in to setup virtual environments, we should know what exactly are virtual environments and why do we need them. Right ?
Virtual environments in Python are isolated environments that allow you to manage and maintain dependencies separately for each project. This isolation helps avoid conflicts between dependencies and ensures that each project has its own set of packages and versions, tailored to its specific needs.
Imagine you’re dealing with two distinct projects with varying requirements:
- Django Project: This is an older project that relies on Python 2.x to function correctly. Its dependencies and code are tailored for this version, and updating the Python version could potentially break its functionality.
- LangChain Project: This is a new and exciting project where you prefer to use the latest features and improvements in Python 3.x. You want to ensure you're always working with the most up-to-date version to leverage the latest enhancements and libraries.
Managing these two projects on the same system can be challenging due to their differing Python version requirements. This is where Anaconda’s virtual environments come to the rescue.
What is Anaconda ?
Anaconda is a comprehensive platform designed to make working with Python easier, particularly for tasks involving data science and machine learning. It simplifies the process of managing software and setting up your environment.
Anaconda comes with a wide range of useful tools and libraries pre-installed, so you can get started right away. Additionally, it provides access to a vast library of additional packages, allowing you to extend its capabilities to fit various needs.
Here is how you can set it up in your machine.
- First you need to download the Anaconda installer for macOS from the official website.
- Follow the instructions on the installer itself to install Anaconda. It's pretty straightforward.
- Once installed, you can check if Anaconda (and
conda
, its package manager) is properly installed by opening your terminal and typing:
conda
This will give us the following output that confirms that conda
is successfully installed.

After installation, your terminal prompt should show a (base)
environment at the start, indicating that the default Anaconda environment is activated.

If you don’t see (base)
it in your terminal, run the following command:
conda config --set auto_activate_base true
This ensures that every time you open your terminal, the base environment will be activated automatically.
Create a Virtual Environment
To avoid version conflicts between libraries across different projects, it’s a good idea to create a separate virtual environment for each project. Here's how you can create and manage a virtual environment using conda
.
We can create a new environment using the following command:
conda create --name ml python=3.10
Then, a new virtual environment will be created using a name called ml
. You must have noticed, we can also provide the python version as well.
You can view all the virtual environments that exists on your machine using this command:
conda env list

The result will include a list of all the virtual environments created, along with its path on our machine. The star mark indicates the current active virtual environment, which in this case is the base
.
Then, we can activate another environment using the following command:
conda activate ml

So, that is how you create and activate a virtual environment using conda
package manager. The dependencies you install in one environment won't clash the dependencies in other environments.
Finally, if you want to return to you base environment or deactivate your current environment, you can do so using this command:
conda deactivate
Code Editor Setup
Once you have your virtual environments in place, the next step is to set up your code editor. A good code editor will help you write and debug your code more efficiently. Some of the things you should look for in a code editor are syntax highlighting, debugging tools, and support for extensions to enhance your coding experience.
VS Code (Visual Studio Code) is a highly popular and versatile code editor that many developers turn to for their projects. It’s widely used across different fields of software development, and some people even refer to it as their default choice for all their coding needs. I'm sure most of you probably already have it, but just in case if you don't you can download it from here.

There are some pretty good alternatives to VS Code as well coupled with AI which can serve a great hand in your coding experience. But, I will go with VS Code for now.
You can take use of some of the extensions available for VS Code which will highly enhance your coding experience.
The very first extension that you should have is this extension from Microsoft. This provides code formatting and linting capabilities to the editor.

Then, you also might want to install Python Debugger, which is also from Microsoft. This extension gives the editor debugging capabilities.

If you're working in web development, you might find these extensions for VS Code particularly useful:
- Auto Close Tag:
- This extension automatically closes HTML tags as you type. For example, when you start writing an HTML tag, it will automatically insert the closing tag for you, which helps to keep your code neat and reduces errors.
- Auto Rename Tag:
- With this extension, when you rename an HTML tag, the corresponding opening or closing tag is renamed automatically. This feature helps maintain consistency in your code and saves you from having to manually update both tags.
These extensions can greatly simplify and speed up your HTML coding process, making your development work more efficient and enjoyable.
That’s a solid starting point for setting up your development environment. As you continue working on projects, you’ll likely discover additional extensions and tools that cater to your specific needs. Feel free to explore and refine your setup to keep improving your coding experience.
That's it for today. See you in the next one ✌️.