VS Code python extension recently started complaining about a Path error on Win10
Asked Answered
B

9

13

When I start Visual Studio Code with a python file I started getting the following error

The environment variable 'Path' seems to have 
some paths containing characters (';', '"' or ';;'). 
The existence of such characters are known to have 
caused the Python extension to not load. If the 
extension fails to load please modify your paths to 
remove these characters.

I checked my path and I did indeed have a ;; appearing. I removed it but, I'm still getting the error.

Here is my current path.

PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Common Files\Lenovo;C:\SWTOOLS\ReadyApps;C:\Program Files\Calibre2\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\IDM Computer Solutions\UltraEdit;C:\Users\Dave\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin;C:\Users\Dave\AppData\Local\atom\bin;C:\Users\Dave\AppData\Local\Microsoft\WindowsApps;C:\sqlite;C:\Python36\Scripts;C:\Program Files\Microsoft VS Code\bin;C:\Python36;
Barra answered 22/6, 2018 at 13:56 Comment(1)
Did you raise the issue here ? github.com/Microsoft/vscode-python/issuesNieves
T
12

Your local PATH contains the following folder paths in this order:

C:\ProgramData\Oracle\Java\javapath
C:\Program Files (x86)\Intel\iCLS Client\
C:\Program Files\Intel\iCLS Client\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files (x86)\Common Files\Lenovo
C:\SWTOOLS\ReadyApps
C:\Program Files\Calibre2\
c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\
C:\Program Files (x86)\Skype\Phone\
C:\Program Files\IDM Computer Solutions\UltraEdit
C:\Users\Dave\.dnx\bin
C:\Program Files\Microsoft DNX\Dnvm\
C:\Program Files\Git\cmd
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin
C:\Users\Dave\AppData\Local\atom\bin
C:\Users\Dave\AppData\Local\Microsoft\WindowsApps
C:\sqlite
C:\Python36\Scripts
C:\Program Files\Microsoft VS Code\bin
C:\Python36

So in local PATH there is no folder path included being surrounded by double quotes and there is also no path containing a semicolon nor are there two semicolons.

Folder paths in PATH should not end with a backslash. It is possible and Microsoft itself added PowerShell folder path with a trailing backslash by default to system PATH. But I recommend fixing that in advanced system settings of Windows system control panel.

There should be no semicolon after last folder path of system PATH and user PATH. Some not good coded applications or scripts append folder paths to local PATH with always a semicolon at beginning without checking first if PATH ends already with a semicolon. This results in local PATH containing finally ;;. The semicolon after C:\Python36 should be removed for that reason.

And the first four folder paths in system PATH should be always:

%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SystemRoot%\System32\WindowsPowerShell\v1.0

This means the system PATH as shown in environment variables dialog and stored in Windows registry should start always with:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0

Some not good coded installers insert folder paths before the most important folder path – the Windows system folder. That should be fixed by you, too.

I suppose the issue is caused by ; after C:\Python36 with a batch file containing just the command line:

set "PATH=%PATH%;C:\Folder Path"

Or a batch file contains the command line:

set PATH="%PATH%;C:\Folder Path"

That command line corrupts the local PATH environment variable because of changing the semicolon separated list of folder paths into one invalid folder path.

See also:

Thadthaddaus answered 25/6, 2018 at 17:16 Comment(0)
S
2

I had the same issue. Comes out I had an empty string "" in the paths. What solved it for me was, and might not be the case for all. In terminal

import sys
print(sys.path) # lists all the paths, "returns a list" 

Next: Find the index position and modify the list by removing the empty string using

del sys.path[index] #(for me del sys.path[0])

restart VSCode that worked for me.

Swett answered 8/2, 2023 at 19:16 Comment(0)
A
1

For me it was just a \ in the end of the Python path:

C:\Users\ME\AppData\Local\Programs\Python\Python37\Scripts\

The moment I removed the last \ the warning went off !

Alburnum answered 28/10, 2018 at 23:47 Comment(0)
P
1

I met this question and i don't know how to do: The environment variable 'Path' seems to have some paths containing the '"' character. The existence of such a character is known to have caused the Python extension to not load. If the extension fails to load please modify your paths to remove this '"' character.

Presbytery answered 20/1, 2019 at 3:56 Comment(0)
S
1

i have faced issue and just uninstalled all extensions in VS and installed again then working fine.

Schopenhauerism answered 26/11, 2020 at 15:39 Comment(0)
G
0

Check the INTERPRETER inside Visual Studio with the command CTRL +P and choose the correct PATH if you are in the enter image description hereCONDA environment choose it

Guertin answered 9/3, 2022 at 5:29 Comment(0)
S
0

error corrected somehow, just re-install the plugins. It won't show the path error again.

Shroud answered 4/4, 2022 at 17:51 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Levinson
E
0

I had a same problem and I used the @sandeep solution in this way:

From terminal

python 
import sys
print(sys.path)

the output was :

['', 'C:\Users\name\AppData\Local\Programs\Python\Python311\python311.zip', 'C:\Users\name\AppData\Local\Programs\Python\Python311\Lib', 'C:\Users\name\AppData\Local\Programs\Python\Python311\DLLs', 'C:\Users\name\AppData\Local\Programs\Python\Python311', 'C:\Users\name\AppData\Local\Programs\Python\Python311\Lib\site-packages']

The problem was the first empty path so i used same command

del sys.path[0]

and I fixed the problem.

Excommunicatory answered 21/5 at 6:57 Comment(0)
S
0
  1. Press Win + R

  2. input rundll32.exe sysdm.cpl,EditEnvironmentVariables and hit enter.

  3. Double click on Path.

  4. Click on Edit Text button and then OK

  5. copy the text and paste it into VSCode.

  6. Press Ctrl + F, choose regex mode, and then replace all ;$ with \n.

  7. Remove any incorrect characters, such as quotes. Maintain consistent formatting for all lines.

  8. (Optional) Remove all duplicate lines.

  9. Remove all empty lines.

  10. search and replace all \n$ with ; in regex mode.

  11. Copy this line and paste it back into Edit text Variable value, and click Okay for all windows.

  12. Do these steps for the system path too.

Sandiesandifer answered 3/6 at 9:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.