vscode-python: Invalid message: Found duplicate in "env": PATH when using virtual environment in Python 3.11

Type: Bug

I get this error “Invalid message: Found duplicate in “env”: PATH.” when I use a Virtual environment to debug python code, but when I switch to the global python interpreter it works fine.

Extension version: 2023.5.10681722 VS Code version: Code - Insiders 1.77.0-insider (b60db78000bfa99d1b290194ed4651c4ceef02cc, 2023-03-10T05:24:23.805Z) OS version: Windows_NT x64 10.0.22621 Modes: Sandboxed: Yes

A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256198
vstes627:30244334
vslsvsres303:30308271
pythonvspyl392:30422396
pythontb:30258533
vsc_aacf:30263846
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
pylantcb52:30590116
pyindex848:30611229
nodejswelcome1:30587009
pyind779:30611226
pythonsymbol12:30651887
6233i204:30659907
pythonb192cf:30661257
funwalk2cf:30682975
pythonms35:30671666
03d35959:30680466
7ij38806:30677315

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 10
  • Comments: 38

Commits related to this issue

Most upvoted comments

I just downgraded the Python plugin from version v2023.6.0 to v2023.4.1 -> solved the issue. Something is wrong in the current release.

Please keep in mind this can only be a workaround!

Thanks for reporting the bug, this is happening because both the Path and PATH variables are set with different values.

We are working on fixing the bug as soon as possible.

Thanks

I guess it is pretty established downgrading solves this issue now (and it has fixed the problem for me too), but the question is: is this a bug or a feature? Is there actually something wrong with the environments of the users experiencing this issue, this error message is correctly flagging it and the users should fix the problem on their side, or is it a “false positive”?

I downgraded the plugin, and the issue is gone. Thanks, svenmk

Thanks everyone for confirming, we’ll release a stable version with the fix very soon.

Fix should be out in the pre-release version of the extension, use the following to try it out:

image

I can confirm that downgrading to 2023.4.1 also fixed the issue for me. Hopefully this issue will be resolved soon…

same issue here

My launch config:

{
            "name": "project",
            "type": "python",
            "purpose": [
                "debug-in-terminal",
                // https://github.com/microsoft/vscode-python/issues/19030
                // "debug-test",
            ],
            "request": "launch",
            "program": "project/project.py",
            "args": [
            ],
            // Comment out to inspect additional output
            "console": "internalConsole",
            "justMyCode": false,
        },

Removing "console": "internalConsole" fixes the symptoms of the issue.

I have the same problem. Thanks a lot.

Does anybody have the vsix file for 2023.4.1? In my installation the “Install Another Version” button is greyed out and I cannot find the vsix neither in the github releases (last vsix was March 2022) nor on the marketplace (version history only goes back ~1 week).

Edit: Found the answer here and the download link is this

Downgrading to 2023.4.1 solved the issue for me as well !!!

Having the same issue, downgrading to 2023.4.1 fixed my issue.

Do you have a .env file somewhere specifying additional env vars? Please mention the contents if so.

C:\>dir .env /a /s /b
C:\Users\bers\.vscode\extensions\donjayamanne.python-environment-manager-1.0.4\pythonFiles\.env
C:\Users\bers\.vscode\extensions\ms-python.python-2023.6.0\pythonFiles\.env

C:\>more C:\Users\bers\.vscode\extensions\donjayamanne.python-environment-manager-1.0.4\pythonFiles\.env
PYTHONPATH=./lib/python

C:\>more C:\Users\bers\.vscode\extensions\ms-python.python-2023.6.0\pythonFiles\.env
PYTHONPATH=./lib/python

@javiermtl Downgrading should be no longer needed, try pre-release mentioned in #20828.

Thanks, @karrtikr, it worked for me 😃

Downgrading to 2023.4.1 solved the issue for me as well !!!

Me as well.

Also:

Having the same issue, downgrading to 2023.4.1 fixed my issue. It’s just a workaround …

Thanks for reporting the bug, this is happening because both the Path and PATH variables are set with different values.

We are working on fixing the bug as soon as possible.

Thanks

Thanks @paulacamargo25 !!! You’re going to spread a lot of happiness with your fix! I hope you realise that 😉

Downgrading to 2023.4.1 solved the issue for me as well.

Having the same issue; Downgrading to 2023.4.1 solved the issue for me as well.

Downgrading to 2023.4.1 solved the issue for me as well.

Having the same issue. I will try to downgrade.

Same issue, downgrading also worked.