VSCode on discover tests Error: spawn python ENOENT

I am running a python project in vscode with virtualenv. Python interpreter is set right. When I’m trying to discover tests it gives me an error saying

python /Users/user/.vscode/extensions/ms-python.python-2019.10.44104/pythonFiles/testing_tools/ discover pytest -- -s project/
Test Discovery failed: 
Error: spawn /Users/<username>/apps/project/venv/bin/python ENOENT

My vscode settings.json looks something like this and I haven’t configured launch.json

    "python.pythonPath": "/Users/<username>/apps/project/venv/bin/python",
    "python.testing.unittestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestEnabled": true,
    "python.testing.pytestArgs": [

When I just type /Users/<username>/apps/project/venv/bin/python on terminal python shell opens up.

ENOENT Generally means that it’s an invalid path, but the path seems perfectly fine.

$echo $PATH

3 replies on “VSCode on discover tests Error: spawn python ENOENT”

Leave a Reply

Your email address will not be published. Required fields are marked *