Error While Installing Python Extensions " Can't Open File 'directory + Filename': [errno 2] No Such File Or Directory "
Solution 1:
I got the same error when clicking the "Install ipykernel" on the pop-up window when trying to use Python Interactive mode in VS Code.
My problem was that I had git bash as my default shell while running VS Code on Windows, hence filepaths where not being processed properly.
I solved the problem by changing my Terminal's default shell:
- Type:
ctrl + shift + p
- In the dropdown, select
Terminal: Select Default Shell
- In the subsequent dropdown, select
Command Prompt C:\...
- Try running Interactive mode once again (e.g. add # %% above a line of code and then click
Run Cell
) - Now click "Install ipykernel" on the pop-up window that comes up on the bottom right corner.
The installation now executed from the cmd shell without any problems, and Interactive mode worked fine.
Solution 2:
what I did is to add an extra anti-slash and it worked fine :
c:/Users/Yourusername/Dev/django_project_boilerplate/env/Scripts/python.exe c:\\Users\\Yourusername\\.vscode\\extensions\\ms-python.python-2020.6.89148\\pythonFiles\\pyvsc-run-isolated.py pip install -U mypy
Solution 3:
For as I also use git bash as my default terminal in windows, I used the following command:
python /c/Users/uname/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/pyvsc-run-isolated.py pip install -U black --user
Whereas I was getting error like this, before:
C:/Users/uname/AppData/Local/Programs/Python/Python38/python.exe c:\Users\uname\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py pip install -U black --user
C:\Users\uname\AppData\Local\Programs\Python\Python38\python.exe: can't open file 'c:Usersigour.vscodeextensionsms-python.python-2021.3.680753044pythonFilespyvsc-run-isolated.py': [Errno 2]
No such file or directory
As you can see it is due to the way git bash handles the file location differently, which I fixed and it worked fine alter.
Honestly, I love to see windows start following the same directory structure like other Linux system(Hope some day this will become true).
Solution 4:
Change your vs code's terminal back to Default Shell > Command Prompt C:\Windows...
The error is due to PATH conflict while using git bash as default terminal on VS Code.
Post a Comment for "Error While Installing Python Extensions " Can't Open File 'directory + Filename': [errno 2] No Such File Or Directory ""