Desktop VSCode vs Anaconda VSCode? - python

I have vscode installed on my computer already. I noticed a while back that it is now included with the anaconda distribution. Is there any benefit to using the vscode included with anaconda vs the vscode i already have installed?
FYI im a python developer if that makes a difference.

As far as I know, VS Code is an independent (in terms of your question!) software which is just shipped with Anaconda. It does not matter if you install them separately or first install Anaconda and install VS Code from there. Anaconda add some extensions by default to VS Code, but you can always install them yourself.
What you can do is updating your VS Code when new versions are released (see https://code.visualstudio.com/)
Also, VS Code is a code editor and one might use it with Python installed from for instance python.org or Anaconda distribution. You can tell VS Code what is your Python path in the settings.
And finally you may want to read this (quoted form https://docs.anaconda.com/anaconda/user-guide/tasks/integration/vscode/):
VS Code is free for both private and commercial use, runs on Windows, macOS and Linux, and includes support for linting, debugging, task running, version control and Git integration, IntelliSense code completion and conda environments.
VS Code is openly extensible and many extensions are available. When you install VS Code with Anaconda it comes with the Python Extension for Visual Studio Code for editing Python code, and the RedHat YAML extension for editing YAML files such as conda configuration files.
When installing Anaconda, you may select whether to install VS Code. VS Code is not offered during silent mode Anaconda installs, but you can easily install VS Code after the Anaconda install completes.

Related

how to make anaconda use my default python?

how to make anaconda use my default python?
Useful infos
I'm working on 2 pcs one having win10 and the other having a fresh win 11 pro installation.
alongside anaconda I'm using VScode to develop in python, Django, PHP, laravel, js, react. and help me synchronize my settings between both pcs
I installed python3.11 and everything is well configured with VScode (database connection, etc), I also installed pipenv
main
as u see I have 2 python environments already installed
I want to remove the python installed in anaconda and I found a way to do so(I will explain it)
but I don't know how to make anaconda use my global python located in Program Files\python311
however, anaconda has a lot of packages, and I don't know if replacing thepy3.9 installed with them by the systems py3.11 will work or not
removing the python package from anaconda
First of all, where did you get Python 3.11 from ? If it was from the built-in App Store from Microsoft, you should deinstall it. This installation is buggy as hell, and you should consider getting 3.11 from somewhere else.
Secondly, Anaconda will manage the packages for you, so you should install Anaconda once with 3.11 and re-download all the packages you need.

Setting up developement environment: PyCharm, python-gtk, windows

I want to develop with these tools:
MS-Windows 10
Python3
gtk
PyCharm
I installed PyCharm, but up to now Python and gtk are not installed up to now.
Sub questions:
use 32 or 64 Bit version of Python?
How to install gtk for python (pip or exe)?
Use virtual env in PyCharm or use "Existing Interpreter"?
AFAIK you cant install gtk for Python on Windows with pip.
Update
I follow this guide now: https://pygobject.readthedocs.io/en/latest/getting_started.html#windows-getting-started
Update2
gtk on windows seems to be hardly used. There were many strange things, and I use pyside2 (QT) now and I am happy
use 32 or 64 Bit version of Python?
The documentation suggests 32 bit for msys2, so this is the safest. However, if you have a 64 bit computer, the 64 bit version could allow some more processing power for larger tasks.
How to install gtk for python (pip or exe)?
Most definitely using the .exe available from this source. This tool is a package manager for Windows that will let you install gtk and its dependencies. Instructions there will walk you through setting up the default environment, then from that environment run pacman -Suy and pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python2-gobject mingw-w64-i686-python3-gobject.
Use virtual env in PyCharm or use "Existing Interpreter"?
Using the 'Existing Intepreter' is a must for this method of installation, as you need to point PyCharm to your msys2 Python, which actually has gtk available. It should be located at C:\msys64\bin\python.exe. Keep in mind that you might not be able to run some scripts directly through PyCharm this way, as Python will be running through a virtual bash-like environment. Save your scripts in the C:\msys64\home\<username> directory so that you can run them easily when you open msys2 with python3 script.py.
use 32 or 64 Bit version of Python?
You can pick any, it doesn't really matter.
how to install gtk for python (pip or exe)?
You should able to install it with pip: pip install pygtk.
Use virtual env in PyCharm or use "Existing Interpreter"?
If you don't know, you probably need "Existing interpreter".
There should be an option to select path to your python.exe
It should be there: Menu->File->Settings->Project->Project Interpteter
There two ways of doing what you want.
But first, lets set something straight, when you say gtk, you don't specify GTK-2 or GTK-3. GTK-2 python bindings aka PyGTK is quite an old package (but still possible to use). GTK-3 python bindings, included in PyGobject are, I imagine, what you want.
First option
So, I'll start with the more restrictive one.
You can install PyGObject through the PyGI AllInOne installer. This is a .exe installer that comes with a lot of stuff, from gtk3 and gstreamer, to gnome applications like Glade and Gedit, to non gnome applications. Why do I say it's restrictive? It only works with Python from version 2.7+ to 3.4+ (32 or 64 bits). So if you want to use Python 3.6, you can't use this. And it seems that it will never be updated.
Second option
The other way is using MSYS2, like someone advised before. This option lets you use the current versions of Python supported by mingw-64 repository. Which I believe right now is Python 3.7.
You can install following the steps as described in the PyGObject site. Or the way explained below (CLion).
I don't know how to use PyCharm with a MSYS2 python installation, but a bit of googling led me to this tutorial for CLion. Maybe there's an analog for PyCharm.
update a couple years later, in case someone else is stumbling down this path - pyGTK/pyGObject now only installs via msys2/mwing. This causes problems with several things.
Firstly, the whole msys python is incompatible with the more normal pip way of distributing tools. From what i've seen, most python tools are shared via pip and wheels now. I'm working with a network messaging library (pynng) which is available via source and pip. I really dont want to go thru the rebuild-from-source thing. That is so last century unix mods.
Secondly, when i tried using mwing's python with pyCharm it failed, saying there were various permission errors. mwing seems to like making things restricted. Maybe if i ran pyCharm as admin it might work.
Maybe I will go with the original post's update and ditch GTK for pyside/QT. I'm not really happy with the look/feel of GTK anyway. It was just the simple solution for the rPi project I was doing.
Step 1: Download the Python 3 Installer
Open a browser window and navigate to the Download page for Windows at python.org.
Step 2: Underneath the heading at the top that says Python Releases for Windows,
click on the link for the Python 3.x.x.scroll to the bottom and select either Windows x86-64 executable installer for 64-bit or Windows x86 executable installer for 32-bit.
The difference between 32bit and 64bit:
If your system has a 32-bit processor, then you should choose the 32-bit installer.
On a 64-bit system, either installer will actually work for most purposes. The 32-bit the version will generally use less memory, but the 64-bit version performs better for applications with intensive computation.source
Step 3: For PyCharm installation follow link
Using Existing Interpreter (pre-installed python)
Step 4: Launch PyCharam, go to settings and click on project interpreter, browse path python3 installed in above step 2.
Step 5: how to install PyGTK or any library in PyCharm selected python environment. Follow step 4 and then click on green + sign in search bar just name the library you want to be installed
.
Here onwards you can install any library just follow step 5, instead of doing pip install library-name each time.
You can also use the virtual environment option, the advantage is that some libraries can work only with the specific version of python.so you can set different version of python in different virtual environments on the same machine.
virtualenv really shines when you have a number of projects and don't want them to all share the same Python installation. For example, you could have two projects with conflicting requirements. virtual environment set-up
For the latest version of PyGTK instead of Step 5 follow this link

Is there danger in installing 2 versions of Anaconda for Python on one machine?

Some background: I have an intel Mac osx (running Yosemite) and use PyCharm community edition as my main IDE. I usually code in Python 3.4 however, I'm taking some MIT OCW courses which all use Python 2. To make it easier on myself when using MIT's skeleton files I have downloaded Python 2.7 and switch the PyCharm interpreter depending on my project.
Here's my question:
I'm wondering if I would run into any trouble downloading the 2.7 and 3.4 versions of Anaconda.
If this is ok, would I need to do anything special with my import commands depending on which version of Python I'm coding in?
Thanks! Happy to add clarity / more info if this isn't enough to answer my questions.
There's no danger, but it's also not the recommended way of achieving this. Rather, you should use conda, the package manager that comes with Anaconda, to create an environment for the other version of Python. For instance, if you started with Anaconda3,
conda create -n python27 python=2.7 anaconda
would create an environment called python27 in ~/anaconda/envs/python27 with Python 2.7 and all the packages from Anaconda. You would then point to ~/anaconda/bin/python or ~/anaconda/envs/python27/bin/python depending on what version of Python you want. In the terminal, use source activate python27 and source deactivate to switch between the two.
See http://conda.pydata.org/docs/ for more information on conda.

How do I change the kernel/python version for iPython?

I have installed iPython using pip in OS X 10.10, and it gave me the "ipython" and "ipython2" commands, which run great, but which use OS X's default python version 2.7.9. I downloaded and installed the latest release of Python3.4 and can load it with the command "python3," but cannot find a way to get iPython to use this version of python. The iPython Web site states the package can be used with python versions 3.3 and above, but I cannot find any instruction on how to change the default python version used.
So far I have found that the jupyter package for iPython has a kernel specification in /usr/local/share/jupyter/kernels/, which is just a folder called "python2" containing a json file that points to the system's python 2.7.6, but altering this to point to the new python3.4 installation does not work. My guess is this configuration is for the ipython notebook.
I've also tried the approach here: ipython reads wrong python version
In doing so I've duplicated the ipython2 command in /user/local/bin/ and edited it to use the python3 interpreter located at /Library/Frameworks/Python.framework/Versions/3.4/bin/python3, however, this gives me an error "ImportError: No module named 'IPython'," which suggests the python3 installation does not have ipython installed.
To tackle this, I've tried uninstalling ipython and reinstalling it using pip, but it just targets the system's Python 2.7 installation and does nothing for python3.
Does anyone know how to configure iPython to use a different python version, or even install a separate ipython installation for python3? Ultimately it would be nice to quickly switch back and forth depending on my needs.
I just found the answer. In essence, this stems from not understanding the python installation layout and how resources are separated between installed interpreters. It appears each python version will have its own repository of tools, and the current "pip" command I had installed on the system was mapped for use with python 2.7, so all libraries, tools, and other details it managed where available only to python 2.7. This included iPython.
I thought that installing python3 would make all these libraries available to the new interpreter by default, but it appears the system keeps them all separate (which makes sense). The main issue here was continuing to use "pip" which targeted the old installation, instead of the new "pip3" command included with python3. By using pip3 to reinstall iPython, I was able to get iPython3 installed properly.
Unfortunately this setup means needing to re-download other libraries, but that's not too difficult.
It might seem like a trivial issue in hindsight, but this had me completely stuck. I hope this helps someone else in this situation.

Pyscripter on Cygwin

Question: How to install Pyscripter on Cygwin?
Scenerio: I have installed portable apps on a usb, then installed cygwin portable version 0.9 on it. Under cygwin, I have installed Python 2.6. I am curerntly using it with the idle IDE but I would like to use Pyscripter instead.
I can not use portable python because I need to install additional modules on python such as pyevolve and Cantera. Alternatively, maybe someone could let me know how to add these modules to portable python.
You can create virtualenv in your usb. And just switch it on in any other computer via Cygwin from our usb. It is not a way to install Pyscripter. But it is way for add modules to your portable version of python.
For anyone else trying this, note that PyScripter is intended to run under Windows, not Linux. The steps are: (1) in Windows, install a python distribution from python.org, and (2) in Windows, install PyScripter.
Note, too, that PyScripter has the desired console (interactive python interpreter) window, and a pip-based package manager that allows adding packages. For example, to add Pandas to an app, do the following:
menu: Tools menu
submenu: Tools
menu item: Install packages with pip
Package Name: pandas
The correct pandas package with required dependencies will be installed. (At least, that is what happened in my case). I was then able to import pandas into my app and use it without any problem.
Cygwin is a Linux environment that installs/runs under Windows. One of its main claims to fame is that it allows you to use Linux commands at the Windows CMD prompt. It also allows you to install/run certain Linux apps, which you then run in the Cygwin (and/or Cygwin-X graphical) environment. For example, it is possible to install/run Eric6 (a graphical Linux python IDE) under Cygwin. (I tried that, it worked - but not as great as Pyscripter)
For my money, I found that Pyscripter under Windows works great - and is much, much nicer than Eric6 under Cygwin. I am a Notepad++ user for HTML/js/PHP and started out using Anaconda (Spyder) to code in Python. PyScripter is much closer to NPP than, for e.g., Spyder or IDLE or Eric6 - and is more like what I had hoped to find in the Python world - and it simply runs under Windows like any other Windows app.
References:
https://sourceforge.net/projects/pyscripter
https://github.com/pyscripter/pyscripter

Categories