This document explains how to create a Conda environment for this project, install Python 3.9.13, confirm the installation of additional packages during environment creation, activate the environment, and install the remaining dependencies from requirements.txt.
Before getting started, make sure you have one of the following installed on your system:
You can verify that Conda is available by running:
conda --versionCreate a new Conda environment with Python 3.9.13. In the example below, the environment name is myenv:
conda create -n myenv python=3.9.13During the creation process, Conda may display a message similar to:
Proceed ([y]/n)?Type:
yand press Enter to allow Conda to download and install the required additional packages.
After the environment has been created successfully, activate it with:
conda activate myenvOnce activated, your terminal prompt should show the environment name, indicating that you are now working inside the new Conda environment.
With the environment activated, navigate to the project root directory if you are not already there, and install the required Python packages listed in requirements.txt:
pip install -r requirements.txtThis command will install the additional project-specific dependencies.
The complete setup process is shown below:
conda create -n myenv python=3.9.13
# type "y" when prompted to proceed
conda activate myenv
pip install -r requirements.txtTo confirm that the environment is using the correct Python version, run:
python --versionYou should see:
Python 3.9.13To view the packages installed in the current environment, use:
pip listor:
conda listWhen you are done working in the environment, you can deactivate it by running:
conda deactivateIf you want to delete the environment completely, use:
conda remove -n myenv --all- You may replace
myenvwith any environment name you prefer. - Make sure that
requirements.txtis located in the project root directory before running the installation command. - It is recommended to activate the Conda environment before installing any dependencies.
- If
pip install -r requirements.txtfails for certain packages, check whether system-level dependencies are required.
If your terminal says conda: command not found, Conda may not be installed correctly or may not be added to your system PATH. Please install Anaconda or Miniconda and restart your terminal.
If conda activate myenv does not work, try initializing Conda first:
conda initThen restart your terminal and run the activation command again.
If you see an error indicating that requirements.txt cannot be found, make sure you are in the correct project directory:
lsor on Windows:
dirYou should see requirements.txt listed in the current folder.
After installing the dependencies, you can run a few simple checks to verify that the environment and the project are set up correctly.
Run the following command:
python -c "import numpy, pandas; print('Environment is ready.')"If everything is installed correctly, you should see:
Environment is ready.If your project has an entry script, you can test it with:
python main.pyPlease replace main.py with the actual entry file of your project if needed.
This will help confirm that the code is functioning as expected after installation.
In short, the setup process is:
- Create the environment with Python 3.9.13
- Type
yto confirm package installation - Activate the environment
- Install dependencies from
requirements.txt
conda create -n myenv python=3.9.13
conda activate myenv
pip install -r requirements.txt