What is a "default Python installation"? - python

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.

Related

'python' points to anaconda installation

I've installed anaconda, but I still want to use python as normal within a Terminal window (zsh). At the moment, running which python shows /Users/USERNAME/opt/anaconda3/bin/python.
I don't want this command to point to my anaconda installation. I want to use python as I have in the past, and for it to point to my python 2.7 installation (/usr/bin/python).
The same issue is present with pip and with python3. How do I change these paths back to their default locations?
I want to start out by saying I personally have never used Anaconda, but I have many friends who have and they always seem to wind up getting into hot water as far as configurations go. If you don't need the data-science specific tools that Anaconda offers (most of which I imagine you can get just as easily by using pip install <package_name>), then I STRONGLY urge you to not use Anaconda. I would suggest you instead use homebrew to install python 3.7 and leave the system version of python 2.7 alone... Anyways...
I recently fixed an issue similar to the one you're describing for a friend. I ended up deleted his anacaonda build and reinstalling fresh from homebrew (link: https://brew.sh/), so this is how I helped him and hopefully this will help you too.
Firstly, I would check the configuration of your ~/.bash_profile (or potentially ~/.bashrc) file. Comment out any lines you find that have to do with Anaconda by preceding with the # character. I believe when anaconda installs it puts the location of the anaconda-version-of-python higher in the PATH hierarchy, therefore you computer sees it first before it has the chance to look in /usr/bin...
Secondly, you need to move the anaconda-python to the trash... I would start by trashing the whole '/Users/USERNAME/opt/anaconda3' directory. If memory serves me correctly anaconda stores other python related things in the /MacitoshHD/Library/Frameworks directory, but don't quote me on that. I would advise looking there and trashing whatever seems to be related to the anaconda install.
After that, in a new terminal (so that your PATH refreshes), I installed homebrew, and then ran the command brew install python3 to install python3. I think perhaps I ran the command recommended in the installer output, something like "brew link python3" to symlink python3 where it needs to be linked after the installation.
Finally, everything is done python2 and python3 are installed and working with no issues. python2 is the system default version and python3 is the homebrew installed version. Feel free to ask any questions and I will try to help more, hopefully those instructions will get you started though.

Installing Anacondas before 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.

How to reset `python` command to the pre-installed version on OS X?

I'd like to reset the python terminal command path to the pre-installed version 2.7 on OS X 10.11.3. I never had any path issues on my previous machine, whether it was installing packages to certain versions or avoiding breakages etc. The additions I made to my new machine shouldn't have altered how the python command is set (according to docs and the book I'm using). I don't consider myself a Terminal power-user. I appreciate any help. Details of those additions and what research I have already done follow:
Python 2.6 and 2.7 were pre-installed and the python command launched version 2.7 before I made any changes.
I installed Python 3.5.1 from python.org using python-3.5.1-macosx10.6.pkg, and at that stage python launched ver. 2.7 and python3 launched ver. 3.5.1. This is in-keeping with my previous machine and the book I'm using now: "Python 3 will be installed as /usr/local/bin/python3, leaving any existing Python 2 on your computer unchanged." (Introducing Python by Lubanovic)
I installed Anaconda 3 from continuum.io using the Python 3.5 graphical installer Anaconda3-2.5.0-MacOSX-x86_64.pkg, and following the walkthrough in Introducing Python: "Anaconda installs everything in its own directory (anaconda under your home directory). This means that it won't interfere with any versions of Python that might already be on your computer." The Read Me supports this: "The 'Install for me only' option will install anaconda to the default location, ~/anaconda."
While I am very familiar with certain packages within Anaconda, I have never used Anaconda before. Likewise I didn't think a second install of Python 3.5.1 in a unique directory would mask or conflict either of the other versions.
However, I suspect that this is where I went wrong. The Anaconda Read Me also states: "By default, this installer modifies your bash profile to put Anaconda in your PATH. To disable this, choose "Customize" at the "Installation Type" phase, and disable the "Modify PATH" option. If you do not do this, you will need to add ~/anaconda/bin to your PATH manually to run the commands, or run all anaconda commands explicitly from that path." Please bear in mind, this consideration is not found in the install walkthrough in Introducing Python. I didn't address this one way or the other, so the default was carried out by the installer.
At this stage, both python and python3 launch Python 3.5.1 from Anaconda 2.5.0; only python2.7 launches Python 2.7.
Perhaps there is some way to test how much trouble this might cause.
I haven't explicitly altered or created any aliases, any paths, or any other environment variables. Ned Deily provided thorough-going info in several QnAs. In QnA How to set default Python version in terminal on OS X 10.6.8? he specifies: "The python.org installers for Python 3.x on OS X do not select the shell script modification option by default. You can enable it at installation or you can later run the Update Shell Profile.command file in the corresponding Python x.x folder in the Applications folder. Or you can just manually edit the right profile." I haven't run Update Shell Profile.command of course. Moreover, this info is concurrent with the outcome from my initial 3.5.1 install, but seems contrary to the bash mod info provided in the Anaconda Read Me. But again, I don't know enough about the inner-workings to execute the correct prognosis.
I am to blame for not reconciling the Read Me with the walkthrough prior to the install. I have already researched uninstalling Anaconda, which looks like it creates breakages and hassles. Most of the related QnAs here are concerned with setting or changing the pre-installed system-friendly version to Python 3. After reading through a half-dozen of these QnAs I would be comfortable with performing that change, but I want to do the opposite. It's also possible that I should run tests or check the results of certain terminal commands prior to changing anything. I don't want to attempt anything (the inverse of instructions in a QnA, for example) without expert advice. For an expert I'm sure it's a minor point; thanks for your patience.
Using info provided by waitingkuo in QnA How to set default Python version in terminal on OS X 10.6.8? I have included the current state of my ~/.bash_profile:
# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
# added by Anaconda3 2.5.0 installer
export PATH="/Users/shawnchristopherburke/anaconda/bin:$PATH"
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"~/.bash_profile" 8L, 267C
In QnA how to change default python version? Adam Vandenberg said that altering which version python launches might not break things in OS X: "Any system software would be using the full path to the system provided Python." That makes me feel better, but I would like to put things back the way they were to ensure compatibility, especially with pre-existing pathnames. Why would Anaconda not default to exercising caution the way python.org installs of Python 3 do? Anxiety is a factor; it is a new machine.
I understand even though I've written at length here, likely there are key details missing. Please let me know if there's any other info I can provide. I'm accustomed to using multiple versions of Python at will, with as few low-level adjustments as possible (first time I've ever looked at .bash_profile for example). So thanks in advance for the education to overcome this hang-up.

MySQL-python installer doesn't find right version of Python

so I'm trying to install MySQL-Python thru the exe found here. only problem is, whenever I open up the exe, it only wants to use a version of Python that was installed when I installed ArcGIS a while back - I need it to use my regular Python path. This is all I see when I open the installer:
The usual way to fix stuff like this is fixing your environment variables, so I've looked at them, but the ArcGIS python install isn't even listed on there - my python path points to the right version of Python, so I don't understand why this installer insists upon the ArcGIS version, even after I've deleted the entire ArcGIS python folder.
I can't change it in the installer - any ideas?
The installer in your case is looking in the registry so check the registry for the installation path, specifically check:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python
and / or
HKEY_LOCAL_MACHINE\SOFTWARE\Python
The first is for 32 bit python versions that are installed in 64 bit platforms, the 2nd is for 64 bit python.
Here is a screenshot of my registry entry:
WARNING: Take a backup of your registry if you are going to make a change and tread carefully.

numpy python 3.4.1 : Python 3.4 not found in registry

I want to plot few graphs with matplotlib and I have a windows machine Firstly I need to install, so I download the file from http://matplotlib.org/downloads.html . Well, when I tried to run, it throws a pop up saying it failed to find the version 3.4 in registry. This is a bit strange because my python version is 3.4.1.
Of course, I did search through the forum. I happened to look into numpy python 3.4.1 installation: Python 3.4 not found in registry which is same as my problem. but my first question:
1) The matplotlib official page gives me a direct link to install ".exe" for windows with python version 3.4. If this is true then why this problem should occur in the first place.
2) My second question, how one can actually find whether the downloading package version is the right match for the current python version installed on local PC.
The windows .exe installer should work for all sub-versions of a given Python installation, this means that if you use the 3.4 installer it should work for 3.4.0, 3.4.1, and 3.4.2.
You need to check that you are using the correct version of the installer, 32-bit or 64-bit. The installer should match the Python version you are using, which may or may not match your system version. This is to say that if you had a 64-bit system and used 32-bit Python, you should use the 32-bit installer.
If it still doesn't work, I'd suggest you re-install Python and try again, it's possible that something has messed with your registry settings.
Originally I thought that the sub-version mattered, but in fact it does not. I raised an issue with matplotlib here and was corrected by Christoph Gohlke who maintains the .exe installations.
Incidentally (for someone reading this in the future as you know yours) if you need to find your current Python version you can simply type python -V in the command line and it'll return the details, for example mine returns:
Python 3.4.0
I had the same problem installing matplotlib-1.4.3.win-amd64-py3.4.exe on python 3.4.3: version 3.4 not found in registry. Looking in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\ there was no Python key, so matplotlib is right.
Further searching I found this SO article, Installing SetupTools on 64-bit Windows, that provided a registry script to add the necessary keys for Python 2.7. I modified the script for 3.4 and added the keys to the registry. Install of matplotlib then completed successfully. It seems the registry keys didn't get added when I installed Python 3.4.3 (sub-installer that installs registry keys is invoked at user privilege level??).
The modified registry key file I used. Save it to a text file with a .reg extension.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Python]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\Help]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\Help\Main Python Documentation]
#="C:\\Python34\\Doc\\python343.chm"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\InstallPath]
#="C:\\Python34\\"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\InstallPath\InstallGroup]
#="Python 3.4"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\Modules]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.4\PythonPath]
#="C:\\Python34\\Lib;C:\\Python34\\DLLs;C:\\Python34\\Lib\\lib-tk"
Then double click the .reg file to add the registry.
I had this problem with Python3.4.2 and went back and did a reinstall. This time I paid attention to what I was doing. While installing Python3.4.2 (or 2.7) a list of options popup. The last item on the list of options is "Add Python to path". On my installation this option was marked with an X and I assume it was on the first installation. I removed the X and continued the install of Python. When I installed numpy, it found Python in the registry and loaded okay.
Open regedit.
Find python in HKEY_LOCAL_MACHINE.
Export it to some location on your hard drive.
Open the exported file in any editor.
Replace all HKEY_LOCAL_MACHINE with HKEY_CURRENT_USER and save
the file.
Now just double click on the .reg file to add this key to registry.
If you go back to the registry using regedit, you will find python in
HKEY_CURRENT_USER as well.
I really wish 'pip install numpy' worked just like it did for python 2.7.

Categories