Installing Anacondas before Python - python

I am brand new to Python. I recently installed python 3.7 and Visual Code. However, I learned that to manipulate data frames and other cool stats stuff, you need Anaconda. So I went and downloaded Anaconda from here. This link is the directory of Anaconda downloads with different versions for OS. I downloaded the 64-bit Windows .exe file.
In installing it, it is asking me two questions with check boxes:
Add Anaconda to my PATH environment variable
Not recommended. Instead open Anaconda with the Windows Start menu and select "Anaconda (64-bit)". This "add to PATH" option makes Anaconda get found before previously installed software, but may cause problems requiring you to uninstall and reinstall Anaconda.
Register Anaconda as my default Python 3.7
This will allow other programs, such as Python tools for Visual Studio PyCharm, Wing IDE, PyDev, and MSI binary packages, to automatically detect Anaconda as the primary Python 3.7 on the system.
I understand that Question 1 is asking me essentially do you want this version as your default version of Python. My first thought was yes, but then said no, what if Python gets updated.
For Question 2, does Anaconda install its own version of Python? Should I uninstall my version of Python 3.7? What is this asking?
In essence, what do people recommend I check? 1 and 2, just 2, just 1, or none? How do the options differ?

I understand that Question 1 is asking me essentially do you want this version as your default version of Python.
I guess that depends on what you mean by "default version of Python". This option will do exactly what it says, and as a result, the Python in the Anaconda distribution will be available to be found via a PATH search, and it will initially appear at the beginning of the PATH. Subsequent installation of other software could put another Python ahead of Anaconda in the PATH.
For Question 2, does Anaconda install its own version of Python?
Anaconda is Python. More precisely, Anaconda is a distribution of standard CPython that comes with a bunch of extra packages pre-installed and some convenient extra tools that are specific to it.
Should I uninstall my version of Python 3.7?
You do not need to uninstall your previous version, but if you select both of the options offered to you then it will probably go largely or completely unused. One thing to watch out for, though, is that you're installing Anaconda 3 (which packages Python 3) as opposed to Anaconda 2 (which packages Python 2).
What is this asking?
This alternative provides for a different sense of "default Python" than the other does: it adds or modifies entries in the Windows registry that identify Anaconda as the system's default Python.
In essence, what do people recommend I check? 1 and 2, just 2, just 1, or none?
I would suggest checking both. I would furthermore suggest not bothering with another Python, unless you need both a Python 3 and a Python 2.

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.

Should I reinstall all Python libraries if I install Anaconda's Python as primary in my system?

I have been using Python on Windows for some time to analyze survey data, usually available in the form of Excel files. For this reason I have installed several libraries, including pywin32, holoview, bokeh, pandas, numpy and so on.
Now I have found that there is a Python distribution called Anaconda which is a prerequisite for some artificial intelligence libraries that I would like to use.
I downloaded it, but when I install it, it recommends me to register the Python included in Anaconda as primary. This would mean that it would be seen as such by all the tools I use, such as PyCharm.
If I understand correctly, it is possible to have several Python installations on a PC, but what happens to the libraries? I mean, if I make Anaconda's Python primary, do I have to reinstall all the libraries I used before to run the programs I have already written?
I can't find an answer in the Anaconda FAQ, so before proceeding with the installation, I would need to better understand what conflicts I might possibly create on my system.
Here are the some answers from my side.
1. Will the libraries & files conflit?
No. - Both local & Anaconda will have separete site packages folders to store installed libraries.No matter how many different versions of python you install there will be separate site-packages folders named with respective versions to store installed libraries.
2. Should I need to re-install packages again that I'm alredy using in older python before I run a program on anaconda?
Yes. Local python will use - cmd -WIndows command prompot
Anoconda will use - Anaconda prompt - Which will be installed along with installation. Both Anconda and local python maintains separate storage locations in order to store & process data which includes libraries, settings, Environments, cache....
3.if we selects Anaconda as primary. This would mean that it would be seen as such by all the tools I use, such as PyCharm?
No. Pycharm will have old configuartion whatever you using currently
even thouh we install anaconda & make its a primary. But, still you
can use anaconda from pycharm by creating a virtual environmnet for it.

What is a "default Python installation"?

Upon installing Anaconda / Miniconda, there is a prompt that reads:
Where the second tick box has something about "Register Anaconda3 as my default Python 3._"
The image says 3.8 but that's just because I couldn't find an image that said 3.9.
I'm wondering what exactly this does to my system and what exactly it means by "default Python 3.8". Having selected that option, it doesn't seem like anything on my path is edited, and in fact, calling py in my terminal doesn't default to this unless I actually specify that I want Anaconda in my path, so I'm really unsure as to how this links to any other programs like mentioned, such as PyCharm.
Also, is there a point to having both Anaconda's Python 3.9 installed and having the classic Python 3.9 from the Python website installed at the same time? It seems to me like Anaconda's Python 3.9 is simply a better and more versatile version of the classic Python 3.9, but I could be wrong and am unsure as I'm really new to this. As far as I can see, however, Anaconda gives users the ability to install any other version of Python through the command line and use their own environment manager, which seems to just be an upgraded version of pip if I'm not wrong?
Windows uses a registry to manage system configuration, including entries determining what program will open files with a particular extension. It seems to me that Anaconda is offering to create a registry entry that will associate *.py files with the base Python in your installation.

What can I expect to change about how I write python on my Mac after I install conda?

Background
Currently, I have Python 2.7.17 and Python 3.8.1 installed on my Mac (v 10.14.6). Both Python versions were downloaded directly from Python.org using a "macOS 64-bit installer" .pkg file, in late 2019. Both were installed here:
python2: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
python3: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
Currently, I use only pip (either pip2 or pip3, depending) to install python packages, which are saved here:
python2: /Library/Frameworks/Python.framework/Versions/X.X/lib/python2.7/site-packages
python3: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
I am about to begin an online course which requires that I install miniconda in order to install the packages that I need for the course. But after having a very bad experience having Anaconda installed on my machine years ago, and it taking me months to remove it and re-create a clean Python install, I am nervous. I don't want my machine to become a mess again, rife with error messages that it can't find this or that python version or this or that python library.
Question(s)
Assuming there will now be multiple installations of Python on my machine (in addition to the versions that I already have, since I believe yet another version of python is installed along with conda), and there will be new places where python packages will be saved, what can I expect to change about how I write python after I install miniconda?
Is there anything I will need to do differently from what I am doing now when I write python code?
How can I ensure that everything remains working and compatible and I avoid the fate I suffered many years ago?
Happy to edit/clarify this question per user suggestions. Thanks!
Use conda environments and install Python into those environments. This ignores, by design, the versions of Python that are installed at the system level. Also, what's installed into environments (other than the one you're in) is ignored. As somebody who uses conda for all Python development, I don't even know what I have installed in /usr/local/bin/ or other places. Everything is in /path/to/miniconda3/envs/env_name_n. You don't have to uninstall other versions of Python you have elsewhere; the point of environments is to keep everything isolated.
What can I expect to change about how I write python after I install miniconda?
Is there anything I will need to do differently from what I am doing now when I write python code?
Use conda environments and use conda as your package manager. For almost every major project, it nearly a drop-in replacement for pip. Outside of managing dependencies, not much changes.

IDLE and python is different, not able to install modules properly

thanks for reading this. I am using macOS High Sierra. I am not very familiar with terminal or environment variables, but am trying to learn more. From reading other threads and google, it seems like I either have multiple pythons installed, or have pythons running from different paths. However I am not able to find a solution to resolving this, either by re-pathing my IDLE or deleting it entirely.
I do have python, python launcher, and anaconda (not very sure how anaconda works, have it installed a few years back and didn't touch it) installed. I am trying to install pandas (pip install pandas), which tells me that I have it installed, but when I run it on IDLE, it says module not found. Though if i run python3 on terminal and type my code in, it works (so pandas has indeed been installed).
When i run which python on terminal, it returns
/Users/myname/anaconda3/bin/python
(when i enter into this directory from terminal, it shows that in the bin folder, I have python, python.app, python3, python3-config, python3.7, python3.7-config, python3.7m, python3.7m-config)
When i run which idle on terminal, it returns
/usr/bin/idle (im not even sure how to find this directory from the terminal)
When i run import os; print(os.path) on IDLE, it returns module 'posixpath' from '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py'
Would really appreciate some help to figure out how to ensure that when i install modules from terminal, it would be installed into the same python as the one IDLE is using. Also, I would like to know whether it is possible for me to work on VSCode instead of IDLE. I cant seem to find suitable extensions for data science and its related modules (like statsmodels, pandas etc). Thanks a lot!
First of all, a quick description of anaconda:
Anaconda is meant to help you manage multiple python "environments", each one potentially having its own python version and installed packages (with their own respective versions). This is really useful in cases where you would like multiple python versions for different tasks or when there is some conflict in versions of packages, required by other ones. By default, anaconda creates a "base" environment with a specific python version, IDLE and pip. Also, anaconda provides an improved way (with respect to pip) of installing and managing packages via the command conda install <package-name>.
For the rest, I will be using the word "vanilla" to refer to the python/installation that you manually set up, independent of anaconda.
Explanation of the problem:
Now, the problem arises since you also installed python independently. The details of the problem depend on how exactly you set up both python and anaconda, so I cannot tell you exactly what went wrong. Also, I am not an OSX user, so I have no idea how python is installed and what it downloads/sets alongside.
By your description however, it seems that the "vanilla" python installation did not overwrite neither your anaconda python nor anaconda's pip, but it did install IDLE and set it up to use this new python.
So right now, when you are downloading something via pip, only the python from anaconda is able to see that and not IDLE's python.
Possible solutions:
1. Quick fix:
Just run IDLE via /Users/myname/anaconda3/bin/idle3 every time. This one uses anaconda's python and should be able to see all packages installed via conda install of pip install (*). I get this is tiresome, but you don't have to delete anything. You can also set an "alias" in your ~/.bashrc file to make the command idle specifically linking you there. Let me know with a comment if you would like me to explain how to do that, as this answer will get too long and redundant.
2. Remove conda altogether (not recommended)
You can search google on how to uninstall anaconda along with everything that it has installed. What I do not know at this point is whether your "vanilla" python will become the default, whether you will need to also manually install pip again and whether there is the need to reinstall python in order for everything to work properly.
3. Remove your python "vanilla" installation and only use anaconda
Again, I do not know how python installation works in OSX, but it should be reasonably straightforward to uninstall it. The problem now is that probably you will not have a launcher for IDLE (since I am guessing anaconda doesn't provide one on OSX) but you will be able to use it via the terminal as described in 1..
4. Last resort:
If everything fails, simply uninstall both your vanilla python (which I presume will also uninstall IDLE) and anaconda which will uninstall its own python, pip and idle versions. The relevant documentation should not be difficult to follow. Then, reinstall whichever you want anew.
Finally:
When you solve your problems, any IDE you choose, being VScode (I haven't use that either), pycharm or something else, will probably be able to integrate with your installed python. There is no need to install a new python "bundle" with every IDE.
(*): Since you said that after typing pip install pandas your anaconda's python can import pandas while IDLE cannot, I am implying in my answer that pip is also the one that comes with anaconda. You can make sure this is the case by typing which pip which should point to an anaconda directory, probably /Users/myname/anaconda3/bin/pip
First: This would be a comment if I had enough reputation.
Second: I would just delete python. Everything. And reinstall it.
To repeat and summarized what has been said on various other question answers:
1a. 3rd party packages are installed for a particular python(3).exe binary.
1b. To install multiple packages to multiple binaries, see the option from python -m pip -h.
To find out which python binary is running, execute import sys; print(sys.executable).
3a. For 3rd party package xyz usually installed in some_python/Lib/site-packages, IDLE itself has nothing to do with whether import xyz works. It only matters whether xyz is installed for 'somepython' (see 1a).
3b. To run IDLE with 'somepython', run somepython -m idlelib in a terminal or console.
somepython can be a name recognized by the OS or a path to a python executable.

Categories