Welcome to the RL Bootcamp Tutorial! This guide will help you set up a Python environment using requirements.txt to ensure you have all the necessary dependencies to run the tutorials smoothly. Follow the steps below to get started.
- Prerequisites
- Step 1: Install Python 3.11.9 or Higher
- Step 2: Clone the Repository
- Step 3: Create a Virtual Environment
- Step 4: Activate the Virtual Environment
- Step 5: Install Dependencies
- Step 6: Verify the Installation
- Step 7: Deactivate the Virtual Environment
- Additional Tips
- Troubleshooting
- Further Assistance
Before you begin, ensure you have the following installed on your system:
- Git: Install Git
- Python 3.11.9 or higher: Download Python
- pip: Comes bundled with Python. Verify installation with
pip --version
-
Download the Python Installer:
- Visit the Python Downloads for Windows page.
- Download the latest Python 3.11.x installer (e.g.,
python-3.11.9-amd64.exe).
-
Run the Installer:
- Locate the downloaded
.exefile and double-click to run it. - Important: Check the box that says
Add Python 3.11 to PATH. - Click on
Install Now. - Follow the on-screen instructions to complete the installation.
- Locate the downloaded
-
Verify the Installation:
- Open Command Prompt (
Win + R, typecmd, and pressEnter). - Run:
You should see:
python --version
Python 3.11.9
- Open Command Prompt (
-
Download the Python Installer:
- Visit the Python Downloads for macOS page.
- Download the latest Python 3.11.x installer (e.g.,
python-3.11.9-macosx10.9.pkg).
-
Run the Installer:
- Locate the downloaded
.pkgfile and double-click to run it. - Follow the installation prompts, agreeing to the license and selecting the installation location.
- Locate the downloaded
-
Verify the Installation:
- Open Terminal (
Command + Space, typeTerminal, and pressEnter). - Run:
You should see:
python3 --version
Python 3.11.9
- Open Terminal (
Clone the RL Bootcamp Tutorial repository to your local machine using Git.
-
Open Terminal or Command Prompt.
-
Run the Clone Command:
git clone https://github.com/SARL-PLUS/RL_bootcamp_tutorial.git
-
Navigate to the Project Directory:
cd RL_bootcamp_tutorial
Creating a virtual environment isolates your project's dependencies from other Python projects on your system.
-
Run the Following Command:
python3 -m venv venv
- Explanation:
python3: Specifies the Python interpreter. Usepythonifpython3is not recognized.-m venv: Uses thevenvmodule to create a virtual environment.venv: The name of the virtual environment directory. You can name it differently if preferred.
- Explanation:
Before installing dependencies, activate the virtual environment.
-
Run the Activation Script:
venv\Scripts\activate
-
Confirmation:
- Your command prompt should now be prefixed with
(venv)indicating that the virtual environment is active.(venv) C:\Path\To\RL_bootcamp_tutorial>
- Your command prompt should now be prefixed with
-
Run the Activation Script:
source venv/bin/activate -
Confirmation:
- Your terminal prompt should now be prefixed with
(venv)indicating that the virtual environment is active.(venv) your-mac:RL_bootcamp_tutorial user$
- Your terminal prompt should now be prefixed with
With the virtual environment activated, install the required Python packages using the requirements.txt file.
pip install -r requirements.txt- Notes:
- Ensure that the
requirements.txtfile is present in the project directory. - This command installs all packages listed in
requirements.txtinto the virtual environment.
- Ensure that the
To confirm that all dependencies are installed correctly, list the installed packages.
pip listExpected Output:
A list of installed packages along with their versions, matching those specified in requirements.txt.
Package Version
--------------- -------
numpy 1.23.1
pandas 1.4.2
...
-
pipNot Found:- Ensure that the virtual environment is activated.
- Verify that Python and
pipare correctly installed and added to your system's PATH.
-
Permission Issues:
- Avoid using
sudowithpip. Instead, use a virtual environment. - If necessary, add the
--userflag:pip install --user -r requirements.txt
- Avoid using
-
Virtual Environment Activation Issues:
-
macOS/Linux:
- Ensure that the activation script has execute permissions.
- If you encounter a "permission denied" error, run:
chmod +x venv/bin/activate
-
Windows:
- If you receive an execution policy error, open PowerShell as an administrator and run:
Set-ExecutionPolicy RemoteSigned - Then, try activating the virtual environment again.
- If you receive an execution policy error, open PowerShell as an administrator and run:
-
-
Incompatible Python Version:
- Ensure that the active Python interpreter is 3.11.9 or higher.
- You can specify the Python version when creating the virtual environment:
Replace
python3.11 -m venv venv
python3.11with the path to the desired Python executable if necessary.
-
Missing
requirements.txt:- Ensure that you are in the correct project directory.
- If
requirements.txtis missing, you may need to generate it or obtain it from the repository.
- Official Python Documentation: https://docs.python.org/3/
- Git Documentation: https://git-scm.com/doc
- Virtual Environments (
venv): https://docs.python.org/3/library/venv.html - Pip Documentation: https://pip.pypa.io/en/stable/
- Community Support: