Install Anaconda+VSCode+Windows 11 environment: A Step-by-Step Guide

Data analysis in Python offers various advantages, such as an overwhelming increase in speed, a variety of data analysis methods, and the collection of a huge amount of data.

However, building an environment is the most difficult part for beginners, and it is hard to know which environment to choose.

In this article, I, as a researcher, will explain how to build a development environment for Python, which is the best tool for data analysis.

Using Anaconda, Visual Studio Code, and Windows 11, you will build the most suitable python environment for data analysis in 15 minutes.

Table of Contents

Installation of Python development environment for data analysis

black laptop computer turned on on table

Anaconda+Visual Studio Code (VSCode) is the most recommended Python development environment for data analysis!

VSCode includes all functions for writing Python code, executing it, and fixing errors.

It is very lightweight and crisp compared to other text editors, which is an overwhelming advantage.

Development environment for data analysis
Python

Anaconda (Python 3.9.12)

IDE, text editor

Visual Studio Code

OS

Windows 11

If you are using Windows, the procedure is basically the same as in this article

Install Anaconda

https://legal.anaconda.com/policies/en/?name=privacy-policy

Anconda can be installed in 5 minutes using the following procedure.

How to install Anaconda
  1. Download Anaconda Installer
  2. Install Anaconda

① Download Anaconda Installer

https://www.anaconda.com/download

Download from Anaconda Distribution

Click on the link below to access the official website and download the latest version of Anconda!

If you do not have Windows, please go to the bottom of the official site top page and select the installer.

https://www.anaconda.com/download

② Install Anaconda

Run the installer by either double-clicking or right-clicking and selecting Run.

Then proceed as shown in the image below.

Install Visual Studio Code

https://code.visualstudio.com/

VSCode can be installed in 5 minutes using the following procedure.

How to install VSCode
  1. Download VSCode Installer
  2. Install VSCode
  3. Restart PC

① Download VSCode Installer

https://code.visualstudio.com/

Download from VSCode

Click on the link below to access the official website and download the latest version of VSCode!

If you do not have Windows, please go to the bottom of the official site top page and select the installer.

https://code.visualstudio.com/

② Install VSCode

Run the installer by either double-clicking or right-clicking and selecting Run.

Then proceed as shown in the image below.

③ Restart PC

Restart your PC after the VSCode installation is complete.

Use Anaconda in VSCode

https://legal.anaconda.com/policies/en/?name=privacy-policy
https://code.visualstudio.com/

It takes 10 minutes to enable Anaconda in Visual Studio Code!

Anaconda+VSCode Installation Procedure
  1. Add extension for Python
  2. Set the Path of Anaconda’s python.exe
  3. Check Python and library operation

Now, let’s start VSCode and go through the steps in order

Press the Windows button on the taskbar and type “Visual Studio Code” to start it.

① Add extension for Python

VSCode comes with extension packs that add functionality and convenience.

Python extension for Visual Studio Code is an extension pack for Python.

② Set the path Anaconda’s python.exe

Click the Windows button on the taskbar to search for and launch Anaconda Prompt

In the Anaconda Prompt, type where python and it will return the location (path) of python.exe

where python
# C:\Users\User\anaconda3\python.exe

Search for Python: Default Interpreter Path and enter the path to python.exe.

To check the location, open Explorer and look in C:\Users\user\anaconda3.

If you do not see the Python: Default Interpreter Path, try restarting VSCode

③ Check Python and library operation

Create a Python file and test if it actually works with VSCode.

Operation check procedure
  1. Create a new folder
  2. Open a folder in VSCode
  3. Create a python file test.py in the folder
  4. Write the code and press F5 to run it.→Check Python operation
  5. Execute code including import with F5→Check the library operation

Check Python operation

Write the code in test.py

print('Setup complete')

Write the above code and run Python by pressing F5 on the keyboard or clicking the triangle in the upper right corner.

In the Terminal at the bottom of the VSCode, you could see the text “Configuration Complete

print('Setup complete')

# Setup complete

If it is displayed, the path setting for Anaconda’s python.exe is complete.

Check the library operation

Add import numpy to the very first line and run

import numpy

# Create a list of numbers
x = [1, 31, 56 , 74]
# Total value calculation with sum
print(numpy.sum(x))

# 162

If there are no errors, the setup is complete here.

Q&A: How to solve a problem

This chapter explains how to solve common problems

If you too are having trouble setting up your environment, please ask questions in the comments section!

Anaconda Problems

I want to make sure Anaconda is installed.

①Windows Settings/application/Installed Apps, ②Control Panel/Programs/Programs and Functions, ③Click the Windows symbol on the taskbar / Add or Remove Programs, Start up with one of the aforementioned
The following image shows Anaconda’s presence.

I don’t know the location (path) of Anaconda’s python.exe as described in this chapter

Click the Windows button on the taskbar to search for and launch Anaconda Prompt
In the Anaconda Prompt, type where python and it will return the location (path) of python.exe

where python
# C:\Users\User\anaconda3\python.exe

For Mac and Linux, which python

VSCode Problems

Python does not run in VSCode

Check that the path to python.exe in Python: Default Interpreter Path in this chapter is correct
(1) Is there double-cotation (“”)?
(2) Are the diagonal lines in the correct direction? (/ and \)
(3) Is the path the same as the path searched by Anaconda Prompt? (reference)

ImportError occurs in VSCode, and libraries such as numpy do not work

Make sure you have the path for the Anaconda libraries.
Click the Windows symbol on the taskbar, search for Edit Environment Variables, and check if the following path exists in Edit Environment Variables/User Environment Variables/Path, and if not, add it

C:\Users\User\anaconda3
C:\Users\User\anaconda3\Library\mingw-w64\bin
C:\Users\User\anaconda3\Library\usr\bin
C:\Users\User\anaconda3\Library\bin
C:\Users\User\anaconda3\Scripts

References

Anaconda

Visual Studio Code

numpy

I hope you will share it with me!

Comments

To comment

Table of Contents