Which version of python extension support python3.6 in vscode? - python

I'm shifting from pycharm to vscode for python development and want to check if most of functionality from pycharm such as debugging, gitlab integration, etc... Are possible in VScode.
I've learned that you could install python extension so I did install python v.2022.20.1 extension. However this debugging functionality does not work when I use python 3.6(it says in python extension that it supports python 3.7 and above). I want to find a version that support python 3.6, how can I find it?
I can click drop down beside uninstall block and install another version however there are lots of versions and it is cumbersome to click each one to check...

You can use 2022.08.* or previous versions, later versions no longer support python3.6.

Related

Why there is a python version besides the package version?

When I check the version of a package, I get a python version in parentheses. What does it mean?
This python 3.7.3 does not match with the PyCharm interpreter I am using (python 3.8). Is that the reason? Should I worry the version between parentheses is not the same as my python project interpreter?
It is possible that you have many python versions installed on your computer.
You probably need to pip install again the same package for the python version you are using with your Pycharm if you want them to work correctly.
if you are not sure how to do that with CMD commands,
you can access your Pycharm, look for "Python packages" at the bottom, and then search for your package.
You can see there is this package is installed already or not.
and if not - just hit the 'install' button.
after that, you are ready to go.

Failure importing openpyxl in Spyder 5.1.5

So I am trying to open a.xlsc file in Spyder using pandas. After importing pandas as pd, when using pd.read_excel() command in the console, it showed the error:
ImportError: Missing optional dependency 'openpyxl'. Use pip or.....
Then I installed the module with:
pip install openpyxl
successfully in CMD, but again Spyder shows the same error.
I tried to restart the kernel, close and reopen Spyder, and even restarted my machine to no avail.
Openpyxl is listed in both help ("modules") in python shell as well as in pip list in CMD.
When I tried to import the openpyxl itself in Spyder (import openpyxl)it says "Module not found error: No module named "openpyxl"."
I have only python 3 (3.9) not both 2 & 3 and Spyder is the only IDE I use with python.
I apologize if this question sounds stupid, I'm fairly new to Python.
I would appreciate any help regarding this.
Thank you.
Spyder has its own Python interpreter 3.7.9 so it loads only the modules installed for that Python.
Since I had a separate Python 3.9.7 installation, whenever I used pip via CMD it installed all the modules for the 3.9.7 Python, that's why my Python terminal & CMD were able to list openpyxl but Spyder said it isn't installed.
After ransacking through the internet I switched the Spyder interpreter to the 3.9.7 stand-alone installation by Tools > Preferences > Python interpreter > Use the following interpreter > navigate through your directory and select the stand-alone python 3.7.9 .exe. Afterwards, Spyder said "Your Python environment or installation doesn't have the spyder‑kernels module or the right version of it installed. Use pip install spyder-kernels==2.1. to install..."*. So back to CMD, I installed the spyder-kernels and now everything's fine.
Spyder IPython console shows Python 3.9.7 (Used to be 3.7.9, Spyder's own interpreter). Now I'm able to import openpyxl without any issues.
I had the same issue as Anoban, but the answer provided by Anoban didn't work for me. I was able to resolve it in two ways
1. Changing my Python environment
This is the better, quicker answer IMO. My Spyder environment was somehow using a custom Python environment as its default (see picture).
Once I changed the Python environment (Tools > Preferences> Python interpreter) from "Default" to the following path (it should have been the default Python interpreter in the first place IMO):
"C:\Users\username\miniconda3\python.exe"
...it worked (see image below to what it should look like in the IDE).
I still had to do an install of spyder-kernels=2.3 (see the next point in my post if you have trouble with that)
2. Creating a separate Python environment
I got this way to work before I figured out the method described in #1 above, so I am posting it too, since it may help someone.
I used the help provided on the Spyder website, followed the directions provided on their site exactly, and it worked for me.
FYI, my installation is slightly different than Anoban's - I didn't use pip. I installed miniconda and a stand-alone version of Spyder on my Windows machine. I used the Anaconda prompt as the terminal window, not the Windows Command Prompt.
Hope this helps someone.
update: when I changed the Python interpreter to the new environment, the Python console gave me the following error
The Python environment or installation whose interpreter is located at
C:\Users\rebecca\miniconda3\python.exe
doesn't have the spyder‑kernels module or the right version of it installed (>= 2.3.0 and < 2.4.0). Without this module is not possible for Spyder to create a console for you.
You can install it by activating your environment (if necessary) and then running in a system terminal:
conda install spyder‑kernels=2.3
But it couldn't find the correct channels for installation so I needed to use
conda -c conda-forge spyder-kernels=2.3
then it worked.
#rpinto73
I know it's tad late. I'm wondering how my answer differs from yours lol.
We faced the same issue and came up with the same solutions. The difference is you set the Python interpreter in a conda environment as default in Spyder whereas I set my standalone Python installation as default. Thus we both assigned an external Python interpreter to be used inside Spyder. Since the external interpreters we assigned (a global Python interpreter in my case (that's why I used pip) and a Python interpreter inside a conda virtual environment in your case (so you had to use conda, you could use pip inside a conda virtual environment as well but not a good practice since it could break dependencies) didn't have the spyder-kernels module we had to install it manually.
The major issue with Spyder is it is an IDE WRITTEN in Python. Thus it needs a Python interpreter to load & function; which is the reason for it being painfully slow during loading. Spyder packs some mundane data science libraries like pandas, numpy, scipy with itself, which you make use of when using Spyder's default Python interpreter. However Spyder does not allow users to manually install packages for its default interpreter (as far as I know). Which makes sense since any conflicts in dependencies introduced by users manually installing/upgrading packages might break the functionality of Spyder itself, making it dysfunctional. Thus the best solution is to leave the Spyder's interpreter to Spyder itself and use a custom Python interpreter where we can install and upgrade modules as we please!.
And a free advice, it's okay to use Spyder when you are starting out with Python as beginners, but it is useless when you have to do heavy computations. You will mostly find yourself facing memory errors. It is lightweight IDE best for learners & beginners. It's best to switch to a more general yet capable development environments like Visual Studio Code, Jupyter Lab.. or a full-fledged Python IDE like PyCharm (there is a free community edition) if you want the in-IDE variables pane & plots pane. But be warned PyCharm (generally any IDE from JetBrains) is notorious for having massive memory footprints.

Python & Windows: Where is the python launcher?

I'm trying to use different versions of python on win7, and I was told that I can use the python laucher.
I find the docs for it: https://docs.python.org/3/using/windows.html#launcher
But I don't know where is it. Someone say its called py.exe, but there is no file with this name on my computer.
I installed python 3.4.3 with Anaconda, https://store.continuum.io/cshop/anaconda/, comes with Scipy
===========
UPDATE:
Since there is no python launcer in Anacoda, how can I re-install it? Or if there is better way of using different version on Win7?
It should be in the root directory of Python 3.3 installs and higher. It is not available for Python2.
Go to C:\PythonXX\ and you should find py.exe for your version.
In Command Prompt or your favorite shell (like Cygwin), run:
py -3.3 -m path/to/myscript.py
However, this only works if you have a 3.3 or higher installed.
EDIT: Anaconda does not come with Python launcher. It is only available for an ActiveState, standard, or probably many other installs.
EDIT2: Here are two brand-new, Python 3.4 installs of ActiveState Python and Anaconda Python, screenshotted. Notice how Anaconda Python does not include py.exe and a lot of other (non-essential) executables?
EDIT3: After some "difficult" testing, just set anaconda as your default install for Python3.4 and grab the py.exe from another install. That is all. So you can install Python3.4 from another source, uninstall it, and save the py.exe, make sure it is in the system path, and the python launcher is fully installed.
EDIT4: Actually there's also a standalone installer available here:
https://bitbucket.org/vinay.sajip/pylauncher/downloads
If installing python from python.org's downloads and you select "[x] install pylauncher [x] install for all users", py.exe is installed in C:\Windows\py.exe.
I think if you don't install for all users, then it's in the python install root.
If you are able to run py from cmd.exe, then you can find out where it is with where py.exe.
It looks like the python executable is part of the conda command if you're using Anaconda, according to their website. According to Alexander Huszagh (see his answer), the python launcher doesn't come with Anaconda python.
Here is a blog post that is perhaps relevant.
I first tried everything Alexander Huszagh has written. But none of it helped.
It took me a really long time to find the Python Launcher. I had accidentally changed how to open .py-files. And once you change it, you can't do right mouse click "Edit with IDLE" anymore. I eventually found them in the C:\Windows\ directory named py.exe.
The experts gave a reply which seems relevant to one version of python but not the latest version. e.g. In my least favorite command line tool I entered:
C:\Program Files (x86)\Python36-32>dir py.exe /s
It replied:
File Not Found

Installing kivy on portable python

Im trying to install kivy in my portable python with this installer:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#kivy
(Its a pre-compiled version of kivy)
When executing the file, it says "Python 2.7 version required", but since the python version im using is portable, I guess this is normal.
So my question is, is there a workarround to install a precompiled package in portable python? By somehow registering the portable python installation?
More (maybe innecesary) information:
My guess would be registering portable python in the system (Windows 7
64), but I already tried by changing the "path" enviroiment variable to point all
the required python paths without success.
I cant use the kivy modules to install it by compiling it on my computer because its too hard for me,(cython wont work, or then another of the 7 different modules will give me problems, untill i destroy my python installation. I already destroyed my
previous python installation while doing so, and had to reinstall
windows to get python working again -_-
Thats why I want to migrate
into portable python, but if this is not possible I will just go back
to normal python and install kivy on it...
The Kivy package on windows includes a portable python installation with Kivy installed.
Double click on the kivy.bat.
You will have a console have easy_install and pip available. Compiler is set to Mingw, and cython is already installed. Everything will be installed in the portable installation, not your system installation.
Enjoy :)
Note: if you want to see how we do, just edit the kivy.bat.

system python versus user python

I've installed Python 2.7 using macports and because of my $PATH variable, that's the one I get when I type $ python. However, virtualenv defaults to using Python 2.6 unless I remember to force it to do otherwise with the -p flag.
On a related note, globally running yolk -l shows the following:
Python - 2.6.1 - active development (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload)
So my question is, should I do something to ensure the system is always using MacPorts' Python 2.7 or is it not worth worrying that Apple's Python 2.6.1 is apparently in the mix?
If you force python 2.7 globally on your system, things will break. You don't want to do that.
You should use virtualenvwrapper. It should choose your preferred python.
http://www.doughellmann.com/docs/virtualenvwrapper/install.html#python-interpreter-virtualenv-and-path
I have had similar problems, although not related specifically to virtualenv. I found that, after installing a particular version of python with macports, and having that version set as default, installing 3rd party modules that are build on or use python using macports solved all problems. You essentially end up with parallel builds, on top of different versions of python. I have a few, and switch between them using python_select. Also, see here on SO for how to get easy_install to work with your new python.

Categories

Resources