This guide explains how to activate a virtual environment (venv) and install all the required dependencies from the requirements.txt file.
- Python installed on your system (version 3.8 or higher recommended).
pip(Python package installer) included with your Python installation.
If you don’t already have a virtual environment set up, you can create one using the following command:
python -m venv venvTo activate the virtual environment, run the following command in your terminal or command prompt:
.\venv\Scripts\activateTo activate the virtual environment, run the following command in your terminal:
source venv/bin/activateOnce activated, your terminal prompt will change to show the name of the active virtual environment, e.g., (venv).
After activating the virtual environment, install the dependencies listed in requirements.txt by running:
pip install -r requirements.txtThis will ensure that all required packages are installed in the virtual environment.
To confirm that all packages were installed correctly, you can list the installed packages:
pip listYou should see all the packages specified in requirements.txt in the output.
When you’re done working in the virtual environment, deactivate it by running:
deactivateThis will return your terminal to the global Python environment.
In order to use the Jupyter Notebook using the virtual enviroment, run:
python -m ipykernel install --user --name=venv
In order to run a Notebook, simply type:
jupyter notebook