# Setup virtual environment and debugger

1. If you have an existing virtual environment, proceed to step 2. Otherwise, to create a new virtual environment:

   ```bash
   python3 -m venv my_env
   source my_env/bin/activate
   # Install packages manually or from requirements.txt file
   pip install -r requirements.txt
   ```
2. Search for `Python.VenvPath` as shown in the picture below:

   ![VSCode Settings screen, with "Python.VenvPath" in the search bar](https://4272811953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LcWJ6pKCQH6l3rl9IQa%2Fuploads%2Fk2f1uOItkMgC9Qtf7ufO%2FScreen%20Shot%202022-02-09%20at%209.08.40%20AM.png?alt=media\&token=5fe40a2e-0cd2-4143-9cb9-cee1a97278fc)
3. VSCode expects you to have multiple virtual environments for each of your different python projects, and it expects you to put them all in the same directory. Pointing to the parent directory lets it scan and find all expected virtual environments, and then you can easily toggle between them in interface.

   ![VSCode "select interpreter" menu with Python 3.7.4 selected](https://4272811953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LcWJ6pKCQH6l3rl9IQa%2Fuploads%2FJY9lqfGAgjfoNwi2yChi%2FScreen%20Shot%202022-02-09%20at%209.12.41%20AM.png?alt=media\&token=1984de4b-e141-42cd-9cf1-d904a36dd0f5)
4. Once you have the virtual environment selected, the debugging capabilities should work.

   ![VSCode debugger window, showing debugger menu, debuger controls, and a selected variable](https://4272811953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LcWJ6pKCQH6l3rl9IQa%2Fuploads%2Fb4Fgy6uVCtKulap4Ysxc%2FScreen%20Shot%202022-02-09%20at%209.26.35%20AM.png?alt=media\&token=a609a674-e0d2-4038-9f37-190d8ea17346)
