DEV Community

Tina L
Tina L

Posted on

How I Resolved Environment Issues Configuring Anaconda and VS Code on Mac M1

Introduction

Properly configuring a Python environment is essential for data analysis. On a Mac M1, the ARM architecture can introduce compatibility issues with packages and IDEs like VS Code. During my setup of Anaconda and VS Code, I encountered several unexpected environment-related challenges.

This post documents the issues I faced and the solutions I applied, covering interpreter selection, package loading, and VS Code configuration. It aims to help others set up a reliable Python environment for data analysis on Mac M1 without running into the same pitfalls.

Step 1: Installing Anaconda

To set up a reliable Python environment for data analysis, start by installing Anaconda. For Mac M1, select the 64-Bit Apple Silicon Graphical Installer, which ensures compatibility with the ARM architecture. Download the official Anaconda installer for Mac M1 from the Anaconda website.

By default, Anaconda is installed in:

/opt/anaconda3

Verify the installation in the terminal:

conda --version
Example output: conda 25.11.1

Step 2: Installing the Python Extension in VS Code

Open VS Code and install the Python extension by Microsoft from the marketplace. This extension enables Python syntax highlighting, code completion, linting, and integration with Anaconda environments.

A screenshot showing the setup process of Anaconda on a Mac, including installation options and configuration steps

Once the extension is installed, the Anaconda interpreter can be selected by opening the command palette:
Command + Shift + P → Python: Select Interpreter

Select the interpreter corresponding to the Anaconda base environment:
base (3.13.9) /opt/anaconda3/bin/python

Ensure the interpreter labeled (base) is selected — this links VS Code to the Anaconda environment.

If the interpreter does not appear, use Enter interpreter path and manually navigate to:
/opt/anaconda3/bin/python

Common Issues and How to Solve Them

1.Python Interpreter Not Appearing

When opening the command palette to select the Python interpreter:
Command + Shift + P → Python: Select Interpreter

Sometimes only node.js or system Python interpreters are listed, and the Anaconda environment does not appear.

Cause: VS Code may open the folder in Restricted Mode, which disables extensions and prevents the Python extension from fully activating.

A screenshot of VS Code with the Python extension installed, highlighting the Python interpreter selection and common errors

• Click the Trust button in the top notification, or
• Open the command palette:
Command + Shift + P → Workspace: Manage Workspace Trust → Trust

After trusting the folder, all Python features and extensions will be activated.

2. Interpreter Not Found
Sometimes VS Code defaults to system Python or Homebrew Python, instead of Anaconda.
• Always check the bottom-right corner — it should show (base)
• If the Anaconda interpreter is missing, manually enter the path:
/opt/anaconda3/bin/python

3. First-Time Package Loading
When importing pandas, numpy, or pyarrow for the first time, loading may take several seconds on Mac M1.
• Avoid pressing Ctrl + C during this process
• Wait until the prompt returns or output appears in the terminal

4. Verifying the Environment
Create a test script test.py:
`import pandas as pd
import numpy as np

print("pandas version:", pd.version)
print("numpy version:", np.version)`

Run the file using the ▶️ Run Python File button or in the terminal:

/opt/anaconda3/bin/python test.py

Correct output should display the versions of pandas and numpy, confirming that VS Code is correctly using the Anaconda environment.

Top comments (0)