This guide will help you set up a virtual environment for your Python project using either Conda or venv, and install dependencies from a requirements.txt
file.
First, clone the repository:
git clone https://github.com/Standord-AI/intellihack5.git
cd intellihack5
Create a Conda environment
You can create the environment in two ways:
Project-specific environment (recommended):
conda create --prefix ./conda_env python=3.10
Named environment (stored in Conda's central directory):
conda create --name project_name python=3.10
Activate the environment
For project-specific environment:
conda activate ./conda_env
For named environment:
conda activate project_name
Create a virtual environment
# On macOS/Linux
python3 -m venv .venv
# On Windows
python -m venv .venv
Activate the environment
# On macOS/Linux
source .venv/bin/activate
# On Windows
.\.venv\Scripts\activate
Creating a requirements.txt
file
If you already have packages installed in your environment and want to create a requirements.txt
file:
pip freeze > requirements.txt
Installing packages from requirements.txt
Using pip (works with both Conda and venv):
pip install -r requirements.txt
Using Conda (Conda environments only):
conda install --file requirements.txt
A basic project structure might look like this:
intellihack5/
├── .venv/ or conda_env/ # Virtual environment folder
├── ipynb/ # Source files
├── README.md # Project documentation
├── requirements.txt # Dependencies
└── .gitignore # Git ignore file
When you're done working on your project:
# For both Conda and venv
conda deactivate # For Conda
deactivate # For venv
- Add your virtual environment folder to
.gitignore
to avoid committing it to version control. - Consider using a
setup.py
orpyproject.toml
file for more complex projects. - For collaborative projects, ensure everyone uses the same Python version.