How to install previous version of Python extension for VSCode - python

I would like to install previous version of Python extension for VSCode (ms-python.python) to troubleshoot something, but when I am trying to use context menu with "Install another version..." I just have an error "server returned 404"

You need to install it from a .vsix file. You can find them here.
Download the .vsix file of the version you want. You may have to click assets to see them.
Then open VSCode, go to extensions -> click on the three dots -> install from vsix and select your file.
To install the .vsix you can also use the command
code --install-extension ms-python-release.vsix
sources :
- How can I install Visual Studio Code extensions offline?
- https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix

This can be done using "Install Another Version" option available with VS Code extension store.
Go to extensions.
Click on Gear Icon for the installed extension
Click on Install Another Version
And select the version you wish to install

The 404 issue is a bug in the VS Code marketplace. They are actively working to fix the problem.

Related

Python stopped working in VScode despite no changes have been made [duplicate]

Recently I reinstall my VS Code due to some errors. But I am not able to compile python files. I have installed all necessary extensions like python and code runner. But still I am getting this:
Same problem occurred to me! All I did was just disabled and then re enabled the python extension again.
OR
Please uninstall the extension, restart VS Code, and then install it again. This error is symptomatic of an extension install going badly.
I tried everything to fix this problem
1.Unistall VS Code.
2.Go to "C:/Users/{Whatever User}" and delete the .vscode Folder.
3.Go to "C:/Users/{Whatever User}/AppData/Roaming" and delete the "Code" Folder. This file stores all the VS Code Cache.
4.Restart you laptop and install VS Code again.
5.Install the python extension.
Yes they solve my other errors related to VS Code but this particular error was in my folder from which I was running my python program because when I execute some other python program saved in some other directory it worked successfully.
So I would suggest that you may try running your .py file by placing it in some new folder.
I've just had exactly the same issue. My intellisense wouldn't work too. Tried everything.. at the end I've downgraded Jupyter version. Went back to version from 6 days ago and everything is working. Python, Pylance, Intellisense extensions are the newest.
one of the solutions is you should downgrade python extension to lower extension.
please click extensions icon then choose manage button below python extension.and click install another version.
then choose older version.then select interpreter(ctrl+shift+p).
at the end restart vscode and run python file.
Help Link How to Downgrade Extension
Just Update or Uninstall and Reinstall Pylance and Python extension from Extensions...and Restart VSCode....
You may need to roll back the VS Code Python extension temporarily.
See command 'python.execInTerminal-icon' not found #3003.
Same problem. My solution is downgrade both Jupyter and Python to 2021.3.6xxx from current 2021.5
Version: 1.56.1 (user setup)
Commit: e713fe9b05fc24facbec8f34fb1017133858842b
Date: 2021-05-06T10:08:05.141Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19041
I was too lazy to follow the recommendations for reinstalling the program on the computer, so I went into the VSC extensions, uninstalled Python, restarted VSC, installed Python, restarted VSC and everything works now. If you are as lazy as I am, then you can try this method before taking drastic measures.
Even I had the same problem but I fixed it. To fix this you have to delete VS Code completely and then reinstall it. Follow the steps:
Unistall VS Code.
Go to "C:/Users/{Whatever User}" and delete the .vscode Folder.
Go to "C:/Users/{Whatever User}/AppData/Roaming" and delete the "Code" Folder. This file stores all the VS Code Cache.
Restart you laptop and install VS Code again.
Install the python extension.
This worked for me. Hope it helps you too.
Note: If you don't find the AppData folder in you users folder, you have to enable hidden items by going to the view section in the windows explorer taskbar.
Just uninstall python extension and then restart VS Code and then install python extension again and then you will not get this error anymore.
Just update or reinstall Pylance and Python extensions and restart VS Code.
Go to the python extension, hit the arrow next to uninstall and downgrade
I Tried uninstall Reinstall VS Code Windows 10 64 bit Not Worked.
Just Uninstall all extensions in VS code.
1.open any .py file
2.Then VS CODE will show automatically to install python extension.
3.Install It Now you can see the interpreter without any issue.
NOTE:(Tried uninstalling reinstalling Extensions one by one not solved the issue)
Same here. No I've tried to relaunch VS Code, but still no python, no terminal at all (neither "Code", "Problems", or other tabs), not even was able to load the extensions menu to reinstall python. But Relaunching the PC solved the issue :)
Just uninstall VS Code, go to C:\Users\whatever user\ and delete .vscode.
Restart pc and install latest version of VS Code.

Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information

Unable to run/debug run in my python file. I KNOW I downloaded python on my computer. I know I downloaded the extension in VS code. Every time I try to run even a simple print("abc") line of code I get nothing in the terminal and a message that reads
"Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information."
in addition to
"Python extension loading..."
and the extension never seems to finish loading its been hours.
How do I fix this I am working out of Windows
For example I have "Extension" named Python in the image below that gets updated or installed by vsCode automatically
You have to wait for the "Extensions" to be installed.
Make sure you have an internet connection.
make sure you have a fast internet connection so that it can be installed faster.
After installation restart "vsCode"
If it doesn't work for you, try uninstalling the extension and reinstalling it
This is all I know and it happened to me
Don't know the reason, for me I installed a pervious version for python EXTENSIONS, and issue fixed screenshot
Navigate to the extensions and you'll find the extensions whose reload is required. Press reload and wait for the extension to refresh. Check the error message at the bottom to see if it still persists.
For me this problem occurred when updating VS code to version 1.75.0 and python extension version was 2022.20.2, problem fixed when updating python extension to version 2023.2.0

command 'python.execInTerminal-icon' not found

Recently I reinstall my VS Code due to some errors. But I am not able to compile python files. I have installed all necessary extensions like python and code runner. But still I am getting this:
Same problem occurred to me! All I did was just disabled and then re enabled the python extension again.
OR
Please uninstall the extension, restart VS Code, and then install it again. This error is symptomatic of an extension install going badly.
I tried everything to fix this problem
1.Unistall VS Code.
2.Go to "C:/Users/{Whatever User}" and delete the .vscode Folder.
3.Go to "C:/Users/{Whatever User}/AppData/Roaming" and delete the "Code" Folder. This file stores all the VS Code Cache.
4.Restart you laptop and install VS Code again.
5.Install the python extension.
Yes they solve my other errors related to VS Code but this particular error was in my folder from which I was running my python program because when I execute some other python program saved in some other directory it worked successfully.
So I would suggest that you may try running your .py file by placing it in some new folder.
I've just had exactly the same issue. My intellisense wouldn't work too. Tried everything.. at the end I've downgraded Jupyter version. Went back to version from 6 days ago and everything is working. Python, Pylance, Intellisense extensions are the newest.
one of the solutions is you should downgrade python extension to lower extension.
please click extensions icon then choose manage button below python extension.and click install another version.
then choose older version.then select interpreter(ctrl+shift+p).
at the end restart vscode and run python file.
Help Link How to Downgrade Extension
Just Update or Uninstall and Reinstall Pylance and Python extension from Extensions...and Restart VSCode....
You may need to roll back the VS Code Python extension temporarily.
See command 'python.execInTerminal-icon' not found #3003.
Same problem. My solution is downgrade both Jupyter and Python to 2021.3.6xxx from current 2021.5
Version: 1.56.1 (user setup)
Commit: e713fe9b05fc24facbec8f34fb1017133858842b
Date: 2021-05-06T10:08:05.141Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19041
I was too lazy to follow the recommendations for reinstalling the program on the computer, so I went into the VSC extensions, uninstalled Python, restarted VSC, installed Python, restarted VSC and everything works now. If you are as lazy as I am, then you can try this method before taking drastic measures.
Even I had the same problem but I fixed it. To fix this you have to delete VS Code completely and then reinstall it. Follow the steps:
Unistall VS Code.
Go to "C:/Users/{Whatever User}" and delete the .vscode Folder.
Go to "C:/Users/{Whatever User}/AppData/Roaming" and delete the "Code" Folder. This file stores all the VS Code Cache.
Restart you laptop and install VS Code again.
Install the python extension.
This worked for me. Hope it helps you too.
Note: If you don't find the AppData folder in you users folder, you have to enable hidden items by going to the view section in the windows explorer taskbar.
Just uninstall python extension and then restart VS Code and then install python extension again and then you will not get this error anymore.
Just update or reinstall Pylance and Python extensions and restart VS Code.
Go to the python extension, hit the arrow next to uninstall and downgrade
I Tried uninstall Reinstall VS Code Windows 10 64 bit Not Worked.
Just Uninstall all extensions in VS code.
1.open any .py file
2.Then VS CODE will show automatically to install python extension.
3.Install It Now you can see the interpreter without any issue.
NOTE:(Tried uninstalling reinstalling Extensions one by one not solved the issue)
Same here. No I've tried to relaunch VS Code, but still no python, no terminal at all (neither "Code", "Problems", or other tabs), not even was able to load the extensions menu to reinstall python. But Relaunching the PC solved the issue :)
Just uninstall VS Code, go to C:\Users\whatever user\ and delete .vscode.
Restart pc and install latest version of VS Code.

VSCode: Using the MS Python extension cannot execute code

I have been using VSCode with the Microsoft Python extension for a couple of months now. However just today I found that the green button I had in the top right that executed my code is gone. I have tried uninstalling the python extension and reinstalling, I have deleted and redownloaded VSCode, I have tried installing code runner. None of these have fixed the issue.
This is the image of my VSCode, which may help to solve the issue:
When I tried to select the Python: select interpreter I got an error in the bottom right that says,
"Command 'Python: Select Interpreter' resulted in an error (command 'python.setInterpreter' not found)"
I have never experienced an issue like this before so any help is greatly appreciated. Thank you!
Image of the plugin I have installed.
Try the following. If that does not help create a new bug.
Do the following to remove stale versions of the extension:
1.Uninstall Python extension (if you have pylance uninstall it first) in visual studio code.
2.Close all instances of VS Code or close visual studio code.
3.Go to, %USERPROFILE%/.vscode/extensions (on windows) or ~/.vscode/extensions on Windows/Linux/Mac.
4.Go to Run and give %USERPROFILE%/.vscode/extensions (on windows). It will open extensions folder.
5.Delete any folder with the name starting with ms-python.python*
6.Start VS Code, and install Python extension again(also pylance if you uninstalled it in step 1).
So I had faced the problem and couldn't find solution until I stared at VS code and found at the bottom left corner that it was in restricted mode, you have to run it in trust mode and it will fix the problem.
If the option is not coming, there is an option to run the program on the left panel in vs code which looks something like this:
Then you need to click debug and run or whatever the option is, if that is blurred out then you've not saved the file, first save it and then again do the same options, and then it will run.
I figured it out!!! The most recent update for the Microsoft Python plugin on VSCode seems to be bugged or something, I'm not sure. However I installed an older version and everything works now, including bringing back the green run button. Thank you all so much for the help!
Yep it's an issue with the most recent releases of vscode. The quick fix right now is just to roll back to an older version. You can easily do this by pressing CTRL+SHIFT+X in vscode to get to the extensions menu, and then clicking the Python extension, and then clicking the little arrow to the right of "uninstall". Here, you can just click "Install Another Version".
For me v2020.10.332292344 did the trick.
https://github.com/microsoft/vscode-python/issues/14959
Many others are facing the issue right now too.
https://github.com/microsoft/vscode-python/issues/14977
I am using WSL2, and i encountered this error today. My VScode used to work fine until my version was automatically upgraded to 1.60. When i checked my extensions, it said that my Python extension is not installed in WSL2, so i clicked on install and the problem was solved.
It may also come from the restricted mode. Please make sure you're in a trusted window.
"Command 'Python: Select Interpreter' resulted in an error (command 'python.setInterpreter' not found)"
The error happened on the newer version 3.10.6 I installed on my new system.
I uninstalled the new python version. Then went to Microsoft store and installed the older version 3.9 directly from the store. When I tried adding the interpreter again on vscode, it was successful.
reloading or upgrading python extension worked for me.
Kindly install the Python interpreter from the following site:
https://www.python.org/downloads/
Then vs code will ask for permission to run the interpreter.
and then its done

How to install METIS package in python on windows?

I am currently running a source code in python which uses METIS. I wanted to run it using Jetbrains PyCharm, conda interpreter and these are installed on windows 10. Although I have installed METIS using conda, I could not enable shared libraries and I faced this error:
ModuleNotFoundError: No module named 'metis'
When I tried to run it without conda I faced the following error although I have added the metis.dll location to the environment variables.
RuntimeError: Could not load METIS dll
Could anyone please help me about it?
This question is old, but I ran into the same problem and after going down the rabbit's hole for.. too long... I have an answer that worked for me.
First, you should get the python metis wrapper using pip: pip install metis.
Second, You must install conda-metis, which you can find here. Although pip calls the metis python wrapper metis, it just the metis wrapper and does not have metis itself.
Place the files in conda-metis-master in some file path.
The installation requires some fixes. Make sure you have a recent version of Visual Studios (I used 2017). For me, VS had a problem running the instructions in BUILD-WINDOWS.txt, which landed me on this thread:
Why does MSBuild look in C:\ for Microsoft.Cpp.Default.props instead of c:\Program Files (x86)\MSBuild? ( error MSB4019)
Specifically, the answer For Visual Studio 2017 and 2019 on Windows 10 was what I went with. Run:
set VCTargetPaths=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets
in command prompt with full permissions to set the environment variable.
Also go to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ in regedit and change in 4.0 the variable MSBuildOverrideTasksPath and in ToolsVersion\4.0\ the variable MSBuildToolPath to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin.
For the python metis, we need a .dll, not .lib[1], so we must also look closer at the CMakeLists.txt (see the Linux version of this discussion here). We add on line 19: set(METIS_LIBRARY_TYPE SHARED).
You should follow the BUILD-WINDOWS.txt instructions, but run .\vsgen -G "Visual Studio 15 2017 Win64" inside your conda-metis file path in command prompt with full permissions instead of using Visual Studio 10.
Wait! We need another fix before following the instructions further on using VS to build the the library. Following what was said in:
rint() issue after creating VS Project using CMake
we have to edit the file path_to_your_metis_dir\GKlib\gk_arch.h by removing the line: #define rint(x) ((idx_t)((x)+0.5)). (Or the fix listed on this github exchange.)
Then go to path_to_your_metis_dir\build\windows\.
Open METIS.sln in Visual Studios, go to the top to Build and from the scroll-down go to Build Solution. Afterwards, the .dll file will be in path_to_your_metis_dir\build\windows\libmetis\Release\.
Last, we run in command prompt:
set METIS_DLL=path_to_your_metis_dir\build\windows\libmetis\Release\metis.dll
After this, python metis no longer failed on the step from metis import * for me.
[1] If we could use .lib, then conda install -c conda-forge metis would work to get this file, but setting METIS_DLL to the .lib file leads to a windows error.
After getting the error described by #XiaojianChen , this is how I solved it (VS Studio 2022). Continuing after the above fixes, to generate a .dll file after opening up the VS solution file, go to the Solution Explorer, right click on the metis project file -> properties.
In General Properties, change the configuration type to Dynamic Library (.dll)
Screenshot of General Properties window
Under Advanced Properties, change the Target File Extension from .lib to .dll
Screenshot of Advanced Properties window
Since we only need the metis.dll file, right click the metis project file in the Solution Explorer and click build. The .dll can be found in ..\build\windows\libmetis\Release.

Categories