LangChain in Practice, Lesson 1: A Complete Guide to Setting Up Your Python AI Development Environment

Set up a clean, reproducible Python AI dev environment with Anaconda, PyCharm, and Jupyter for LangChain development.
This guide covers environment setup for a LangChain course, emphasizing the importance of a clean, reproducible Python environment for LLM development. It recommends Anaconda for managing virtual environments, using `conda create` to build an isolated `lumchainenv`, and configuring PyCharm with the correct Conda interpreter. It also walks through installing Jupyter Notebook and registering a kernel — essential since cloud compute platforms commonly use Jupyter as their access point. Practical advice on pip vs. conda and a balanced take on AI coding plugins round out the guide.
As the opening chapter of a systematic LangChain course, environment setup is often the most overlooked yet most critical step. As the saying goes, "a craftsman must first sharpen his tools." A clean, isolated, and reproducible Python development environment will save you from countless mysterious bugs down the road when building large language model applications. This article is based on the first chapter of the LangChain 1.3 beginner tutorial by Bilibili creator Loulan, systematically walking through the complete workflow — from installing Anaconda to configuring PyCharm and Jupyter.
Why Choose Python for AI Development
Developers coming from Java or C++ backgrounds often worry about Python's learning curve when first approaching LLM development. In reality, Python's design philosophy is all about simplicity and readability — there's almost no syntactic overhead.
More importantly, Python is one of the go-to languages in the research community (alongside R). Being a research favorite means an enormous ecosystem of third-party libraries has grown around it — covering everything from web development, games, and web scraping to file processing. When you have an idea, there's almost always a ready-made framework to help you validate it quickly.
One key reminder here: the language itself isn't the barrier to mastering Python application development — what truly needs to be trained is your software framework thinking. Once you can clearly break down "what needs to happen at each step" and combine that with Python's rich tooling ecosystem, you'll feel right at home.
Managing Python Virtual Environments with Anaconda
There are many ways to install Python, but the approach of manually configuring everything step by step — like you would with Java — is no longer recommended. A much more convenient approach is to use Conda, a package management tool.
MiniConda vs. Anaconda
Built on top of Conda, the community provides two integrated distributions:
- MiniConda: Conda + Python basics + a minimal set of base modules — lighter on resources;
- Anaconda: Everything in MiniConda, plus a large collection of commonly used research libraries like NumPy, Pandas, Matplotlib, and scikit-learn, along with graphical tools.
This tutorial recommends going straight with Anaconda for a very practical reason: not only does it come with more libraries, it also includes more complete tooling — less hassle overall. And when you're doing development, the extra disk space for a few packages is rarely a concern.
Installation is just like any other software — double-click the installer and follow the GUI. Once done, type conda --version (or conda -V) in your terminal and you should see a version number, confirming a successful install.
Quick Reference: Common Conda Commands
Creating and managing isolated environments is Conda's core value. A few key commands are worth memorizing:
# Create an environment named lumchainenv with Python 3.10
conda create -n lumchainenv python=3.10
# List all created environments (the one with * is currently active)
conda env list
# Activate a specific environment
conda activate lumchainenv
# View dependencies in the current environment
conda list
# Install / remove / update a package
conda install <package-name>
conda remove <package-name>
conda update <package-name>
# Deactivate the current environment
conda deactivate

Note: Dependencies across different environments are completely isolated — which is exactly why we use a unified lumchainenv throughout the course, ensuring a consistent environment for all experiments.
conda install vs. pip install: Which Should You Use?
Both can install Python packages, but there's a key difference:
- pip install: Downloads and installs the target package and its dependencies — fast and straightforward;
- conda install: Does all of the above, but also checks compatibility between new and existing dependencies — safer, but slower.
Practical advice: if you've used a dependency many times before and know it works, pip install is faster. If your environment is complex with many dependencies, or you're installing an unfamiliar library for the first time, conda install is the safer bet.
Three Major Development Tools: PyCharm, Jupyter, and VSCode
Once Anaconda is installed, Python is already runnable directly from the command line — type python to enter interactive mode and execute code line by line. This is one of Python's great strengths: unlike Java, there's no need to write a complete file and compile it before running anything.

That said, the command line is ill-suited for building complex applications, so we need more professional development tools.
Configuring a Conda Interpreter in PyCharm
PyCharm is a full-featured IDE with built-in code suggestions, source code navigation, and much more. The free Community Edition is more than sufficient for learning purposes.
The key configuration step is selecting the correct Python interpreter: in PyCharm's interpreter settings, choose "Add Interpreter → Local Interpreter → Existing Environment → Conda," then select the lumchainenv environment we created from the dropdown. This ensures all future dependencies run within this isolated environment.
Installing Jupyter Notebook and Registering a Kernel
Jupyter is another widely used development environment, with source files in .ipynb format. Its biggest advantage is that it lets you mix code and notes (Markdown) in the same document — each cell can be Markdown, code, or plain text, making it ideal for experiment logging and teaching.

Configuring Jupyter takes a few steps:
# 1. Activate the environment
conda activate lumchainenv
# 2. Install Jupyter via pip
pip install jupyter
# 3. Install ipykernel and register it
pip install ipykernel
python -m ipykernel install --user --name py310lumchainenv
# 4. Start the server
jupyter notebook
After launching, a web interface opens at localhost:8888. In the top-right corner, you can switch kernels and select the lumchainenv environment we created. It's also worth noting that PyCharm itself can host a Jupyter server — you can open and run .ipynb files directly within it.
Why is Jupyter essential to learn? Because many cloud compute platforms (especially those used for LLM fine-tuning) come with a built-in Python environment and provide access through Jupyter Notebook or JupyterLab.
VSCode: The Lightweight, All-Purpose Editor
VSCode is a versatile editor that supports development in almost any language through plugins. It's completely free, which makes it popular in enterprise environments as well (PyCharm's Professional Edition requires a paid license). Compared to PyCharm's more turnkey integration, VSCode requires installing quite a few plugins manually, making setup a bit more involved.

Using AI Coding Plugins to Accelerate Learning — With a Balanced Perspective
Since we're learning AI development, it makes sense to install an AI coding assistant plugin in PyCharm (such as Tongyi Lingma). Once logged in, you can ask questions and request code restructuring directly from within the editor, significantly boosting your learning efficiency.
That said, the tutorial also offers a candid reminder: when it comes to rigorous coding work, treat AI-generated output with caution. Code from AI isn't guaranteed to run as-is, and may not suit your current environment. Whether the result meets your expectations is something you must verify yourself. Iterating back and forth with AI to debug can be extremely time-consuming — you might spend an hour and make no real progress.
This is also where a structured course adds value — it's far more targeted than aimlessly querying an AI, saving you from endless repetitive interactions. The overall stance is: embrace AI, but always verify and think critically.
Summary
Environment setup may be the very first step, but it determines how smoothly everything that follows will go. Key takeaways:
- Use Anaconda to manage isolated Python virtual environments
- Create a unified
lumchainenvto ensure environment consistency - Make PyCharm your primary workspace, while also getting comfortable with Jupyter Notebook
- Use AI coding plugins as a learning aid — thoughtfully
If you're new to Python, make sure to go through the installation process hands-on from start to finish. Even if you're an experienced developer, a quick walkthrough is recommended to ensure environment consistency. With this foundation in place, you're ready to begin the LangChain journey — from LLM fundamentals to Agents, and on to MCP tool calling.
Related articles

Insufficient Source Material to Generate a Valid Article
The provided source material is a single unrelated tweet with no AI or tech relevance — insufficient to support a complete, valid technical article.

Insufficient Source Material to Generate a Valid AI/Tech Article
This source material is a tweet about the ages of Underworld members — unrelated to AI or tech, and insufficient to support a full article.

Insufficient Material: Unable to Generate a Valid AI/Tech Article
The provided material is a condolence tweet about a San Diego mosque attack — unrelated to AI/tech and too limited to generate a valid technical article.