How to install Python25 on my mac with Homebrew - python

I'm new to Mac's and Python. I want to install an older version of Python (2.5) on to the Mac (OS X 10.8.1).
I'm using homebrew as it's newer than MacPorts and I don't know enough to choose between them.
Following instructions I have installed Rails, mySQL, budle, pow - all sorts of stuff, but when I use the same technique to install python 2.5 it doesn't work.
I tried:
Axolotl:.pow neil$ brew search python25
homebrew/versions/python25
Axolotl:.pow neil$ brew install python25
Error: No available formula for python25
Axolotl:.pow neil$ brew install homebrew/versions/python25
Error: No available formula for python25
Where am I going wrong? Thanks.

python25 is available in the Homebrew-versions tap:
$ brew tap homebrew/versions
$ brew install python25

I think the brew tap homebrew/versions tip is no longer valid...
I have added that to my Homebrew, however it appears to point to this repo: https://github.com/Homebrew/homebrew-versions
...and that does not contain any Python versions.
$ brew search python25
No formula found for "python25".
So if you want to install a specific version other than latest 2.7.x or 3.x.x you need a different method, what worked for me is:
brew install pyenv
(complete the install instructions)
pyenv install 2.5
You can then switch Python versions either globally (default) or just in current shell session, see: https://github.com/yyuu/pyenv

Instead of using brew to install into the entire system a really old version of Python; consider using pythonbrew instead. It will isolate the python install - a bit like virtual environment, but for Python itself.

You're not doing anything wrong, I'm afraid you're just out of luck. Have a look on the list of formulae available: no Python2.5.
There could be a workaround: copy the python.rb gem and edit the lines mentioning a version number, switching from 2.7 to 2.5. Careful with line 31 (the sha1 signature), you'll want to edit that too.

Related

Monetdb Loader Function Issue - Embedded Python 3 has not been installed

This is the error when trying to run a Python loader function through mclient.
TypeException:user.main[4]:'pyapi3.eval' undefined: Embedded Python 3 has
not been installed. Please install it first, then start server with --set embedded_py=3
When typing monetdb get all I can see that embedpy3 is set to yes because I have already done the -- set embedded_py3=yes.
I have installed monetdb through homebrew on macos.
The homebrew version of MonetDB was built with the option -DPY3INTEGRATION=OFF, in other words, there is no Python integration in the homebrew version.
If you want, you can try to compile it yourself using the homebrew formula after changing that OFF into ON.
As Sjoerd said, the default homebrew build has the CMake option -DPY3INTEGRATION=OFF, which turns off embedded python3 functions.
To install it with this option turned on, you'll need to edit the brew formula and compile it from source (through brew).
First, uninstall the current package:
brew uninstall monetdb
brew cleanup -s monetdb
Then, edit the brew formula:
brew edit monetdb
Find "-DPY3INTEGRATION=OFF" and change it to "-DPY3INTEGRATION=ON"
Finally, install it from source, using the new formula:
brew install -s monetdb
Make sure you have python3 and numpy installed, otherwise it won't work.
NOTE: This still might fail if you have multiple python installations and the one used in the build process does not have numpy installed. In that case, reach out and we'll help you.

Updating Python3 and Pip3 on Mac

I have two versions of python3 installed on my computer. They are located here:
/usr/local/bin/python3
/usr/bin/python3
I have set my PATH variable to use the first version. Running "which python3" routes to this version: /usr/local/bin/python3 -- this is what I want.
Unfortunately, pip3, and yet another version of Python, are installed in a different location (I think the version that comes pre-installed with mac). When I run "pip3 --version" I get the below:
pip 20.1.1 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)
Shouldn't these match? Is there a way to make sure python3 uses the pip3 version via /usr/local/bin/pip3? Do I just need to change / add it to my path somehow?
Another option is to uninstall everything with homebrew (what I used to originally install python3), and then reinstall. However, apparently, per my co-worker, we need to stay on python3.7. I'm worried if I reinstall python3, it will default to 3.8 or higher.
Please help!
There are a few things that I have found increase the chances of success here:
don't mess with the Mac-installed default Python
don't use homebrew to install Python
use pyenv to install and manage Python versions
Here's a useful write-up on The right and wrong way to set Python 3 as default on a Mac.

How to use Homebrew to upgrade to a specific Python version?

I've been using Homebrew to install various packages on my Mac. Currently I have Python 2.7.13 installed via Homebrew but I'd like to upgrade to Python 3.5.x, not 3.6 which is brew's current default. At first, I just tried upgrading to Python 3:
brew install python3
Brew said "python 2.7.13 is already installed. To upgrade to 3.6.5, run brew upgrade python" which isn't the version I want.
I then tried to search to see what versions of Python brew has available:
brew search python
Now Homebrew tells me, "If you meant "python" specifically: It was migrated from caskroom/cask to homebrew/core."
I then looked at homebrew-core on Github but it doesn't appear to provide any instructions on how to do what I want to do. Does anyone know how to now display a list of Python versions that one can install using Homebrew and what command to use to install a specific version?
There are several discussions of this, here and elsewhere. There is no direct way to do what you want. The recommended approach is to install pyenv via brew, and use pyenv to manage the different versions of Python on your system.
The github repo has a very detailed and clear guide on usage:
https://github.com/pyenv/pyenv
To see the version of python use python --version, and for upgrade use sudo apt-get upgrade python.
I used this, and it's worked

Which version of Pip to use with my Python installs?

Being new to Python, I'd love to clear up a few points that I couldn't get from reading various articles and tutorials.
After using Homebrew to install Python3, I noticed that it had installed both Python3 and Python3.4. I was also a little surprised that there are now three versions of pip on my machine too; pip, pip3 and pip3.4.
I created a new virtualenv and told it to use Python3, using the following command:
virtualenv -p /usr/local/bin/python3 mysite
I was also surprised that the version of Python that it installed in my VM was 3.4.
Is it safe to have these multiple version of Python and Pip hanging around on my machine?
Am I right to assume that I should take extra care to use the matching version of pip with Python, for example, pip3.4 with Python3.4?
Yes, it is safe. Python uses this naming like python3.4, python3.5 etc to differentiate between releases. python3 is a symbolic link to the current python3.x version. Pip follows the same convention.
If you're using python3.4 explicitly, you should be using pip3.4 specifically as well. Otherwise, just use python3 and pip3. For Python 2, you can simply use python (which, unless you installed the Homebrew version as well), will be the system Python), and ditto for pip. python2.7 and pip2.7 may also work.
In general, to find out which Python version goes with which pip you're using, try:
pip --version
and you'll see the Python included in the result.
No need to worried about if you have multiple version of Python and Pip installed. just check your version by writing in terminal :
$ brew info python
or to check the version of pip write in terminal :
$ brew info pip
and make sure you have updated your both pip and python version (write in terminal $ brew upgrade pip/python)
and other way to install python is go to https://www.python.org/downloads/ and choose as your requirement, there is two version available 2.7.9 & 3.4.3 ,
after installing python write in terminal $ python -V to check its version :) Hope it will help :)

Python 2.6 in mac corrupted because of failled update

I'm a mac newbie and I tried to update my python version from 2.6 to 2.7. Unsuccessful, I changed my mind and uninstalled the python2.7 I had. I had a previous issue that if I typed something like:
python setup.py install
It would not install the package for python2.6, installing to the removed 2.7 version instead, to make it work I have to put
python2.6 setup.py install
And now when I try to install something with easy_install or pip (by the way, pip I have installed after 2.7 issue) I got the following huge message errors: here and here. I want to know how can I clean up my mess.
Since you were trying to install MySQLdb, how about you give ActivePython a try?
Install ActivePython 2.7 (it co-exists with Apple's System Python 2.6)
Open Terminal and type pypm install mysql-python (see PyPM Index) .. no compilation required
Make sure that /usr/local/bin/ is in front of your $PATH.
To uninstall ActivePython, you can do:
sudo /Library/Frameworks/Python.framework/Versions/2.7/Resources/Scripts/uninstall
Or, use sudo pythonselect 2.6 to switch the default Python in /usr/local/bin (if you have multiple versions of non-System Pythons installed)

Categories

Resources