First time posting! Really stuck, need experienced help. I am a mechanical engineering student with a small amount of c programming experience, about to tackle a personal project using Python, which I will learn to use as-I-go.
Trying to add an interpreter to the Python Environment in MS Visual Studio 2015 (VS).
Downloaded Python 3.6, at the time I did not realize 3.5 was recommended by MS for use with VS. VS did not find Python 3.6 automatically, so I tried to add the path manually using "+ Custom...". 3.6 wasn't an option in the edition dropdown, so tried to type it in. When I "Applied", the program stopped working. After restarting VS, Python is still not added, and the "+ Custom" button is greyed out, not allowing me to add the proper Python 3.5 or any other interpreter not automatically recognized.
The only interpreter I have successfully added since is IronPython, which is automatically recognized. Python 3.6, 3.5, 3.4.4 were installed but not automatically recognized.
Web searches only provided this:
https://github.com/Microsoft/PTVS/issues/1760
The person had the same problem but only recovered use of the "+ custom" button by reinstalling his operating system and VS. I would like to avoid this extreme repair strategy.
I have restarted my computer and VS many times throughout troubleshooting. I am confident that once the "+ Custom..." button becomes active, the rest of the interpreter install will go fine.
Alternatively, If there is a lower-level way to add interpreters to the Python Environment, I would attempt that strategy if some guidance were provided.
Thank you for considering
Try to remove PTVS 2.2.5 and install an older version like PTVS 2.2 and you should be able to use the "+ custom" button again...
Related
The language interpreter is set to a Python 3.9 version:
But a Python scratch file is being parsed by some kind of 3.6 interpreter:
Note that I created in two different scratch files and the same error occurs. Why would this happen and is there a workaround [short of creating an entirely new project from scratch]?
I am on Pycharm Professional 2021.3.1
Update based on answer by #TurePaisson he though maybe the Code is compatible with specific Python were set. That was a shrewd guess - but turns out I have not set that:
Update The following snippet can be used to test python3.6 vs 3.8+
x = (y := 3) + 7
In the preferences dialog, search for "versions" and you will find, under Editor/Inspections, an inspection "Code is compatible with specific Python versions" with checkboxes for which versions to check against.
I ended up creating a new python interpeter with version 3.9 and selecting it for the project interpreter. There's clearly some bug within Pycharm that it does not always cleanly switch among interpeters/versions - so starting from scratch is sometimes apparently needed.
I'll start by saying that I tried googling the exact error message and there aren't any significant hits (that's reason alone to post this leaving it as a roadsign):
"Python version 3.6 does not support assignment expressions"
I tried this with PyCharm versions 2021.2.2, 2021.2.4 and 2022.1 Pro (switching between Python 3.6 and Python 3.9) but I wasn't able to reproduce the exact problem that's shown in the question (I was unable to update to the exact 2021.3.1) and there might be some Project setting that's not obvious.
So I have 2 hunches:
It's possible there's something stuck with the inspection profiles since the OP seems to be working from a repository.
From experience my next guess would be to try and change the interpreter version of the "run configuration" because it's not stated explicitly in the documentation if it supersedes the project-wide interpreter chosen in Settings > Project > Python Interpreter for linter inspections. From my tests it currently doesn't but apparently it worked for the OP... Maybe by rebuilding the index and refreshing the background linter process.
Following up on #bad_coder 's attempt to fix that will be paraphrased as:
check the Run Configuration for pointing to a different python interpreter than the project level one
That fix worked for me:
Bring up the Run [Context menu] | Edit Configurations
Change the Python interpreter to the appropriate one: Shown below is a case where the interpreter is said to the earlier language level. Go to the dropdown and select a correct [python 3.8+] interpeter.
I have been running Visual Studio code on the Mac for about 2 years now and I'm running into issues that I haven't seen before. I have not personally run any updates for Code for quite a while. lets say late November.
1) A message at the lower right of my Work space that says
The macOS system install of Python is not recommended,
some functionality in the extension will be limited.
Install another version of Python for the best
experience.
Unfortunately I can't update to Python 3.x and it shouldn't be up to Code to force me to update. Is there a way to turn this message off?
2) Related to above is that some classes or language keywords (JSONUtils, #unittest, requests, def) are no longer being recognized. Some constants that I have created and a variable defined to store a class.
sc = SomeClass()
This will be recognized at definition but later during usage it will not be recognized.
sc.SomeMethod( 1, 2, 3 )
sc won't be recognized. None of this is making sense to me as it is not a pure pattern. Everything is probably the same issue. Need to point Code to python 2.7.
This is a bug in VS Code. A new future version will have an ignore button.
VS Code Issue 4448
I still can't comment, so here it is an an answer instead...
This looks like a duplicate of How can I change python version in Visual Studio Code?
The short version that worked for me:
CTRL+SHIFT+P to open command palette
Choose "Python: Select Interpreter"
Point VS Code to the Python interpreter you wish to use.
I want to use winpython interpreter for Visual Studio 2017 community edition. I found settings for another IDE here: Using WinPython as Interpreter for PyCharm. Where can I find similar settings for VS 2017 community edition?
(finally my first post after so long following. It's a shame, because it's maybe not the best answer, but it's late here)
You have to add your WinPython as a custom python enviroment.
Following steps:
Open VS an look for Tools > Python > Python Enviroments and then hit "add custom..."
There are several fields to be filled, which are nearly self explained (Path of Interpreter, window-interpreter etc.). I think, if you enter the Interpreter-Path, you can hit the button "auto-fill" on the right side an VS will try to look for the other fields automatically.
That's it. But the more interesting question is "Does Intellisense recognizes the packages in WinPython like scipy?"
Yes. But Intellisense needs a first date with the packages. Otherwise you won't cross the doorstep.
Open Tools > Python > Python Enviroments
Click on your Custom Python environment (WinPython, I still guess) and then click the field, where "configure" is listed an look for the Option "Intellisense". Then VS will look vor all modules. Be patient, at my machine it took some time.
After recognizing all modules (no red ! sign anymore, a blue check), you can hit the new appearing button above "Update Database". This will take less time.
In my case (a few minutes ago) I had to restart VS. When I hit numpy.p either in editor or interactive console, there appears auto-complete with every info you wish to have (in a pythonic, not a general way).
good night!
Sources:
https://learn.microsoft.com/en-us/visualstudio/python/python-environments
Visual Studio How to add Python module to Intellisense
I recently upgraded to Python 2.7.10 on MacOSX Yosemite. I also added a Python 3.4.3 installation. At the time I upgraded Tcl/Tk with ActiveTcl 8.5.18 as was suggested on the Python for MacOSX installation page. There is also an ActiveTcl 8.6 package from last year that still shows up in the framework, but I was pretty sure that I said to delete that when I went back to an earlier version of 8.5. Path has settings for all three as well as usr/bin, etc.
At this point, Autocomplete and Call Tips stopped popping up. I checked the preferences and it seemed to be turned on. The delay was set to 2000, so I changed that to 2, but nothing happened. Pressing {ctrl}-Spacebar and then using the down arrow key lets me cycle through the the available functions, but putting a dot after an object has no effect, and if I open parentheses, I get no tips. This is both in the IDLE Shell and Editor windows.
I tried to redo everything by deleting all instances of Python from my drive. I reinstalled them, reloaded all packages, and Autocomplete and Call Tips still are not popping up. Is there any known issues or is there a workaround? Do I possibly need to add or change the new Tk path somewhere so that IDLE can find what it needs to popup autocomplete? Is there a way that I can initiate IDLE Autocomplete and Call Tips during the coding session to manually get them to work?
I have also raised this with ActiveState and Python, but I haven't gotten or found an answer yet that has gotten it to work. I like working with IDLE and would like to get Autocomplete and Call Tips up and running again.
Thank you.
I used to use my Netbeans 6.9 for Python development. As well as Java and PHP. I had a cool debugger in PHP with xDebug, good Python support. Have no complaints whatsoever. I moved to another computer downloaded the latest netbeans(7.1) and now I have no more python plugin. I tried the solution here but this caused NetBeans not to start at all after the loading splash screen is finished NetBeans crashes.
Is there any way I can still code in Python with netbeans?
Thank you in advance
Ok, I fixed this. Say you've screwed up your netbeans installation by installing the pythonplugin then this might just work for you, provided you're using a non-windows OS. This is because Windows uses precompiled binaries to start the Netbeans IDE.
The problem that I solved is that, by default, a set of classes is not added to the Java classpath, which results in a crash. You can find whether this is also your problem by inspecting .netbeans//var/log/messages. If it displays some ClassNotFoundExceptions then we might have the same problem. If not, then at least you've got some pointers on what's going wrong and perhaps you might come up with some solution yourself. ;)
The java classpath is constructed in the file:
/<path>/<to>/<your>/<netbeans>/<installation>/platform/lib/nbexec
On OSX, this could be:
/Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/platform/lib
In the main loop the function construct_classpath is called, which in turn calls the function build_classpath for two directories. I changed the function to this:
build_cp() {
base="$1"
append_jars_to_cp "${base}/lib/patches" "patches"
append_jars_to_cp "${base}/lib" "lib"
append_jars_to_cp "${base}/lib/locale" "locale"
# Added by me:
append_jars_to_cp "${base}/modules/ext" "ext"
}
After that modification, start your IDE and everything should work fine. Good luck!
The Solution for this problem could be found here
http://sahanlm.blogspot.com/2012/12/netbeans-7-2-crash-on-start.html
I am currently using the developer plugins on Netbeans 7.0.1 with no problem. Maybe they simply aren't compatible with the new version yet. I'd suggest just getting a 7.0 and using that.
Add org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar at
C:\Program Files\NetBeans 7.1.1\platform\lib\locale. Start NetBeans, remove the plugin or the reference with problem, later on, delete org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar
Please see the following link. It works for me:
http://wiki.netbeans.org/PythonInstall
Currently your NetBeans/Python choices are:
Try the latest development build updates against your current NetBeans version and mess with breakage at times as noted on the PythonInstall NetBeans wiki page or the link you gave.
Install the latest development version, but realize it's not a stable public release.
Wait for someone in the community to step up with continued development to keep the existing plugin in step with the latest public NetBeans release.
Install the NetBeans 6.9 (or older) version you were using with no complaints just for Python work.
I have had success with older versions and the development build. I am dabbling with other Python aware IDEs while I wait for main stream support, but I've stopped holding my breath.
If you can't change nbexec, like suggested by Bas Jacobs (e.g. on Windows), or don't want to do that, you can use the --cp:p startup parameter to append the necessary JARs to the classpath.
I only had to add the org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar file, so the complete command line under windows now looks like this:
"C:\Program Files\NetBeans 7.1\bin\netbeans.exe" --cp:a C:\\Users\\_YOUR_USERNAME_\\.netbeans\7.1\modules\ext\org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar