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 intellihack5Create a Conda environment
You can create the environment in two ways:
Project-specific environment (recommended):
conda create --prefix ./conda_env python=3.10Named environment (stored in Conda's central directory):
conda create --name project_name python=3.10Activate the environment
For project-specific environment:
conda activate ./conda_envFor named environment:
conda activate project_nameCreate a virtual environment
# On macOS/Linux
python3 -m venv .venv
# On Windows
python -m venv .venvActivate the environment
# On macOS/Linux
source .venv/bin/activate
# On Windows
.\.venv\Scripts\activateCreating a requirements.txt file
If you already have packages installed in your environment and want to create a requirements.txt file:
pip freeze > requirements.txtInstalling packages from requirements.txt
Using pip (works with both Conda and venv):
pip install -r requirements.txtUsing Conda (Conda environments only):
conda install --file requirements.txtA 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
.gitignoreto avoid committing it to version control. - Consider using a
setup.pyorpyproject.tomlfile for more complex projects. - For collaborative projects, ensure everyone uses the same Python version.