Can't debug with Python virtual environment (virtualenv / pyenv)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
**Describe the bug**
**Prerequisites**
Have Python installed. Have a virtual environment manager installed. Have your root python installation be Python 3.9. Have Python 3.8 installed (not as your root Python). Have VS Code installed with Python & AWS ToolKit extensions installed.
**To Reproduce**
Steps to reproduce the behavior:
1. Open a shell
2. Create a virtual environment with Python 3.8
2. type sam init
3. In the questions, answer Python runtime 3.8, choose Zip format
4. For the type of application, choose hello-world
5. cd sam-app
6. code .
7. Inside VS code, open the hello_world directory and the app.py file
8. Inside VS code, hover to the handler function and choose attach a debugger
9. Choose the "no template" option for the debug configuration
10. Select your virtualenv correct interpreter in vscode (selecting interpreter path)
11. Inside VS Code, go to the debug tab and hit run with debug the configuration created just before
12. Observe the failure stating the debugger can't find a correct python interpreter (3.8)
**Expected behavior**
The debugger should be able to run Python with the virtualenv interpreter in my case Python 3.8. I have tested within the shell and it works, the python interpreter is 3.8.
I have tried changing the Python extension settings for virtualenvs locations to no avail.
**Screenshots**
**Desktop (please complete the following information):**
OS: Windows_NT x64 10.0.18363
Visual Studio Code Extension Host Version: 1.56.2
AWS Toolkit Version: 1.25.0
**Additional context**
Contributor guide
Research direction
Reproduce the Windows flow from sam init through app.py's handler and the VS Code AWS Toolkit attach-debugger configuration, using a Python 3.8 virtual environment with root Python 3.9. Start by inspecting the generated no-template debug configuration and interpreter selection. Done means the debug run launches the Python 3.8 virtual environment interpreter instead of reporting that it cannot find a valid executable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, vscode
- Domain
- cloud, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100