Get AI summaries of any video or article — Sign up free
Day 1- Python Environment Setup, Industry Project Configuration And Package Management thumbnail

Day 1- Python Environment Setup, Industry Project Configuration And Package Management

Krish Naik·
5 min read

Based on Krish Naik's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Add Anaconda to the PATH during installation on Windows; otherwise conda won’t be recognized in the terminal.

Briefing

Python “industry readiness” starts long before writing code: it hinges on getting the environment right, keeping dependencies isolated, and packaging projects so they can be installed and shared cleanly. Day 1 lays out a practical setup path—installing Anaconda, configuring command-line access, setting up Visual Studio Code, creating virtual environments, and managing packages—then moves into how Python projects become reusable packages via setup.py and pyproject.toml. The payoff is fewer “works on my machine” failures and a workflow that scales from experiments to real ML/GenAI projects.

The session begins with an installation walkthrough focused on Anaconda on Windows, where the most common failure is forgetting to add Anaconda to the PATH. During installation, a checkbox labeled to add Anaconda to the environment variable is treated as non-optional; without it, the conda command won’t be recognized in the terminal. For people who already installed without that checkbox, the fix is to manually edit system/user environment variables and add the expected Anaconda paths (scripts, Library/bin, Library/user/bin, and the Anaconda root folder). After that, conda is tested from Command Prompt to confirm the setup is functional.

Next comes the tooling layer. Visual Studio Code is installed separately, and the workflow emphasizes using VS Code as the coding environment rather than starting in Jupyter or Google Colab. Once VS Code is running, the Microsoft “Python” extension is installed because it provides the kernel integration and core developer features like IntelliSense, debugging, formatting, and linting support. Anaconda Navigator is also introduced as a management interface for environments and installed packages, letting users select among multiple virtual environments for different projects.

The core concept—virtual environments—is then framed through a realistic scenario: one company may run multiple projects requiring different Python versions and different libraries (e.g., data science stacks, NLP libraries, agentic AI frameworks). Installing everything into a single environment leads to dependency clutter and conflicts. The recommended practice is one environment per project (or per dependency set), created with conda create -p <env_name> python=<version>. The session explains the meaning of -p (create the environment in the current working directory) and -n (create it under the Anaconda installation’s environment directory). After creation, conda activate <env_path> is required so that subsequent package installs land in the correct environment.

Package management follows. Dependencies can be installed directly with pip install, but the industry-standard approach is to list them in requirements.txt and install them with pip install -r requirements.txt. The session also covers Jupyter integration: creating .ipynb files inside the virtual environment is discouraged; instead, notebooks live in the project workspace, and the environment’s kernel must be available via ipykernel. The session recommends installing ipykernel manually rather than bundling it into production dependency lists.

Finally, the session transitions into project packaging. It introduces setup.py as a way to convert a project into an installable package, using setup tools find_packages and a get_requirements() helper that reads requirements.txt. It demonstrates the need for package structure via an __init__.py file so folders like src become importable packages. It then contrasts this with pyproject.toml, a modern configuration file used by packaging tools, showing how pip install -e . can trigger pyproject.toml-driven builds and create the same kind of package metadata more efficiently. The day ends with a preview that later sessions will focus on environment files and deeper project structure, including object-oriented programming and end-to-end ML project design.

Cornell Notes

Day 1 focuses on building an industry-style Python workflow: install Anaconda correctly, set up Visual Studio Code, create isolated virtual environments, and manage dependencies predictably. The session stresses that conda must work in the terminal—on Windows this requires adding Anaconda to the PATH during installation or manually fixing environment variables afterward. It then shows how to create project-specific environments with conda create -p <name> python=<version>, activate them, and install dependencies using requirements.txt via pip install -r requirements.txt. For Jupyter notebooks, notebooks should live in the project workspace, while ipykernel is installed so the notebook can use the environment’s kernel. Finally, it introduces packaging with setup.py and the modern alternative pyproject.toml for turning a project into an installable package.

Why does Anaconda installation often fail on Windows, and how is it fixed?

The most common issue is not adding Anaconda to the PATH during installation. If the checkbox “add Anaconda to my path environment variable” isn’t selected, the conda command won’t be recognized in the terminal. The fix is to edit environment variables (system/user PATH) and manually add the Anaconda paths such as Anaconda3 scripts, Anaconda3 Library/bin, Anaconda3 Library/user/bin, the Mingw-w64 bin path, and the Anaconda3 root folder. After updating PATH, conda should work from Command Prompt.

What problem do virtual environments solve, and why is one environment per project recommended?

Real teams run multiple projects with different Python versions and different dependency sets (e.g., one project uses Python 3.7, another uses Python 3.10, another uses Python 3.12 plus different libraries like transformers or LangGraph/LangChain). Installing everything into one environment causes dependency clutter and conflicts. Creating separate environments keeps dependencies loosely coupled: activate the right environment, install the right packages, and avoid cross-project breakage.

How do conda create -p and conda create -n differ in practice?

In the session’s explanation, -p creates the environment in the current working directory (the present working directory), using the provided environment name. -n creates the environment under the default Anaconda environments directory (inside the Anaconda installation’s managed location). The choice affects where the environment folder lives, but both support isolating dependencies per project.

What’s the recommended way to install dependencies for a project, and why use requirements.txt?

Instead of repeatedly running pip install <package>, dependencies are listed in requirements.txt and installed in one step with pip install -r requirements.txt. This supports reproducibility and collaboration: another developer can read requirements.txt to see exactly which packages are needed and install the same set. The session notes that pinning versions comes later (e.g., after freezing), but the workflow starts with requirements.txt.

How should Jupyter notebooks relate to virtual environments?

Notebooks (.ipynb) should be created in the project workspace, not inside the virtual environment folder. To run notebooks using the environment’s interpreter, the environment must appear as a Jupyter kernel. That requires installing ipykernel (manually into the active virtual environment). When the notebook runs, the kernel selection should correspond to the created environment.

How do setup.py and pyproject.toml help package a Python project?

setup.py uses setup tools with find_packages to locate modules and a setup() configuration that can read dependencies from requirements.txt (via a helper like get_requirements()). It also relies on __init__.py so folders like src become importable packages. pyproject.toml is a modern configuration file used by packaging tools; it defines build-system requirements and project metadata/dependencies. Using pip install -e . can trigger builds based on pyproject.toml and produce package metadata similarly to setup.py, often with a more standardized approach.

Review Questions

  1. What exact PATH-related steps are needed if conda is not recognized after installing Anaconda on Windows?
  2. Describe a complete workflow from creating a conda environment to running a Jupyter notebook with that environment’s kernel.
  3. Compare setup.py and pyproject.toml in terms of what configuration they provide and how dependencies are sourced.

Key Points

  1. 1

    Add Anaconda to the PATH during installation on Windows; otherwise conda won’t be recognized in the terminal.

  2. 2

    If Anaconda PATH was missed, fix it by editing system/user environment variables and adding the expected Anaconda paths (scripts, Library/bin, Library/user/bin, and the Anaconda root).

  3. 3

    Use Visual Studio Code with the Microsoft Python extension to get kernel support, debugging, formatting, and linting features.

  4. 4

    Create a separate conda environment per project to avoid dependency conflicts caused by different Python versions and different libraries.

  5. 5

    Install dependencies reproducibly by listing them in requirements.txt and running pip install -r requirements.txt inside the activated environment.

  6. 6

    For Jupyter, keep notebooks in the project workspace and install ipykernel into the target environment so the notebook can select the correct kernel.

  7. 7

    Package projects using setup.py (with setup tools and requirements.txt) or pyproject.toml to make projects installable and shareable.

Highlights

For Windows users, the conda command failing is usually a PATH checkbox problem during Anaconda installation—and it’s fixable by manually editing environment variables.
Virtual environments prevent “dependency clutter” when different projects need different Python versions and libraries.
requirements.txt plus pip install -r requirements.txt turns dependency setup into a repeatable, team-friendly process.
Jupyter notebooks should live in the project folder; ipykernel is what connects the notebook to the environment’s interpreter.
Packaging with setup.py or pyproject.toml converts a codebase into an installable unit, enabling distribution and reuse.

Topics

Mentioned

  • Krish Naik
  • PATH
  • ML
  • MLops
  • LLM
  • AI
  • NLP
  • EDA
  • VS Code
  • IDEs
  • GPU
  • IPython
  • pip
  • conda
  • ipykernel