How to set up VS Code IDE for AI (Super Quick, Intermediate)

Anish Mahapatra
3 min readFeb 7, 2024

--

This will be a quick one and to the point.

Download VS Code & Install

Download VS Code from the Downloads website here.

VS Code Downloads (Source)
Photo by Louis Hansel on Unsplash

Install Anaconda

Go to the Anaconda website, register and install Anaconda here.

Download Anaconda (Source)
Photo by Luke Jones on Unsplash

Install Python

Go to the Python Downloads page and install the latest version of Python using the Downloader here. You might see a different version of Python, don’t worry. Just remember the version of Python you are installing, you will use it later.

Download Python using the installer (Source)

Set up VS Code

Make a folder where you want to keep your code. Go to open folder and open the relevant folder.

Open the folder you made

Once it is open, open the Terminal. View -> Terminal.

Create Virtual Environment

Photo by julien Tromeur on Unsplash

Once the terminal is open, now we will create a virtual environment. Why? We do not want to mess with the base Python that we have, whatever packages we have, we would like only the relevant packages installed for that project. This can be done using a virtual environment.

Navigate to the folder where you are working on your project (working directory) in the terminal. Let’s say we want to create a virtual environment called langchain using Python 3.11. Remember, this is an example, make sure to input your version of Python and the name of the virtual environment that you want.

conda create -p langchain python=3.11 anaconda -y

Now, activate the virtual environment

conda activate langchain

Don’t do this now ~ but, in case you would like to deactivate a virtual environment, you can use

conda deactivate

Best Practices

Create a requirements.txt file on VS Code to remember the packages that you are using.

You can install the requirements for your project using the following command:

pip install -r requirements.txt

For example, my requirement.txt file for LangChain has the following text.

langchain
openai
huggingface_hub
langchain-openai
python-dotenv
streamlit
Photo by Folco Masi on Unsplash

Pro-tip to not leak API Secrets

In case you want to commit your code to GitHub, don’t leak your API secrets! Make a .gitignore file. I keep my environment secrets in a .env file. My .gitignore file just has “.env”. It looks like this.

Cheers! Follow me and connect with me if you would like to receive more content in AI. Post my series on MLOps & Data Engineering, we are now going to dvelve into the world of LLMs in details where we are going to cover AI Fundamentals, Code for AI and AI for Dummies next.

https://www.linkedin.com/in/anishmahapatra/

AI for Dummies — YouTube

--

--

Anish Mahapatra

Senior AI & ML Engineer | Fortune 500 | Senior Technical Writer - Google me. Anish Mahapatra | https://www.linkedin.com/in/anishmahapatra/