Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97355

Visual Studio Code - Debug Only Works Once w/ Conda Virtual Environment

$
0
0

Visual Studio Code Version: 1.40.1 for macOS
I'm writing python code, and I am using an anaconda virtual environment.

When I hit F5 to run in debug, it will work as expected but only once after the VS Code app has been opened. Thereafter, terminal message "bash: env: command not found". Restarting the VS Code app corrects the problem, but only for the 1st attempt to debug. For reference, here is what launch.json looks like:

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

I am noticing for the automation associated with hitting F5, the first successful run issues terminal commands different than those issued for the subsequent unsuccessful attempts: 1st (successful):

bash-3.2$ source /anaconda3/bin/activatesource /anaconda3/bin/activate
/anaconda3/envs/mvtrade/bin/python /Users/<user.name>/.vscode/extensions/ms-python.python-2019.11.49689/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 53321 /Users/<user.name>/repos/mvtrade/scratch.py 
conda activate mvtrade
(base) bash-3.2$ /anaconda3/envs/mvtrade/bin/python /Users/<user.name>/.vscode/extensions/ms-python.python-2019.11.49689/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 53321 /Users/<user.name>/repos/mvtrade/scratch.py

all subsequent (unsuccessful)

(base) bash-3.2$ conda activate mvtrade
(mvtrade) bash-3.2$ cd /Users/<user.name>/repos/mvtrade ; env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 /anaconda3/envs/mvtrade/bin/python /Users/<user.name>/.vscode/extensions/ms-python.python-2019.11.49689/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 53349 /Users/<user.name>/repos/mvtrade/scratch.py 
bash: env: command not found

I have read this, which doesn't appear to have ever been resolved.

Why is the 1st attempt succeeding while the rest do not? Why are the bash commands different?


Viewing all articles
Browse latest Browse all 97355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>