So I have installed python 2.7 in cygwin and it runs without any problem. However, when I install new packages using cygwin's setup.exe, it will always select new version 2.6.8 for the python package by default, and if I don't switch back to 2.7.2, it will uninstall python 2.7 and install python 2.6. What's wrong with my cygwin? Is there any method to fix this problem?
Python 2.7.3 is currently experimental; the current supported version of Python for Cygwin is 2.6.8. Every time you run Cygwin's setup.exe, it sees that the version of Python you have installed isn't the latest supported version, and attempts to "upgrade" you to that version.
Noticing when you've intentionally selected an experimental version of a package, and not "upgrading" you to the stable version would be a nice feature for Cygwin's setup.exe to have. Sadly it doesn't; you just have to remember to change the install list every time you run setup.
(Although if you fancy it, I imagine such an enhancement to Cygwin's setup.exe would be gratefully received by the Cygwin community; it's an open source project and someone has to do the work!)
Jason Tishler, Cygwin's Python maintainer, announced the experimental package in December 2012. To quote his email:
I will update Cygwin to make 2.7.3-1 (or later) current on or about February 1, 2013.
That change will be announced on the "cygwin" and "cygwin-announce" mailing lists, if you fancy following them. Once that happens, the installer will work as you'd like it to.
I think I have figured out what the problem is. In the package selection window, there are three options above the package list, namely, keep, Curr and Exp. The default one is Curr, which means that cygwin will select the most stable version for each selected package. In some way, python 2.6.8-2 is considered more stable than 2.7.3-1, and then each time the 2.6 version is selected. The only way is to switch to Keep option, but then we will not update other packages as well. This is quite annoying.
Related
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.
Or where is there a published list of the supported versions of Python for Visual Studio Code?
Also if one's machine's OS makes a difference that would be helpful to know as well.
According to their documentation, if you link to what "a supported Python", is, the requirements are "whichever version of Python you want to use". And they explicitly include:
The built-in Python installation on Linux.
An installation through Homebrew on macOS using brew install python3 (the system install of Python on macOS is not supported).
A download from python.org.
A download from Anaconda (for data science purposes).
Of course python.org has versions all the way back to 0.9.1, although I suspect anything older than the 2.0.1 in the main downloads doesn't really count.
More realistically, they probably only test with current Python versions, which as of right now means 2.7, 3.5, 3.6, and maybe 3.7 prereleases. If you wanted to use 2.5 or 3.3, you might well get syntax highlighting and error fly-checking based on 2.7 or 3.5 grammar, etc. But actually running your code should still work.
Also, if you're on a Mac and thinking of Homebrew, it's worth noting that brew install python3 will give you an error; the package is just called python now, and you install python for 3.x and python#2 for 2.x.
Microsoft's Python Extension for VS Code actually let you select an interpreter from a list of detected or manually set environments (CMD-Shift-P/Ctrl-Shift-P -> Python: Select Interpreter), so it should work with latest version of any interpreter, as long as is supported by the OS (remember that VS Code and its extensions are hosted in Electron). Source
Supposedly Python 2.7 is included native to OSX 10.8 and above (if I remember correctly), but I recently installed Python 3.5 to use for projects while I work through UDacity. Lo and behold, the UDacity courses seem to use 2.7 - wups! So instead of trying to uninstall 3.5 (this procedure seemed to scary for neophytes such as myself), I simply installed 2.7 in addition to the recently installed 3.5 and just run the 2.7 IDLE and Shell. Is this ok, or will I run into problems down the road?
I have installed two versions, 2.7, 3.4 and I do not have any problem by now. 3.4 I am using for my work project in eclipse environment, 2.7 for udacity course, like You ;).
As long as you keep your installation folders organized, you should have no issues having both on your computer, besides one thing. The path environment variable for python will determine which version is used by default, so I would say stick to one version, or make sure to make your programs as backwards compatible as possible. I have run into this issue on Windows, since I installed Python 3.4 before 2.7, and therefore to run older code, I have to manually select the python executable. In terms of libraries, I believe that for each python version, the libraries are completely separate, so you should be good there.
As others have said, if the installation directory is different it should be no problem at all.
One thing that'll make your life easier for switching between the two is to use an IDE such as PyCharm, you just have to change a drop down to switch between the two versions.
It should be fine. Its actually pretty common to have multiple Python environments. It helps to prevent dependency conflicts between your projects. That is what is happening when you are using tools like pyenv and virtualenv.
Using tools like pyenv and virtualenv may also help you with the path problems that others mentioned. They have commands to set up the path so that their version of pip, python, etc are used.
Im not sure about OSX, but with windows 10 my environment variables for 2.7 were overwritten with the 3.5 path. Not a tough fix, but a little confusing, since it was months later when I needed 2.7 again.
You can also use Anaconda for maintaining two versions of Python:
Download Anaconda for both Python versions
Open .bashrc
Add the path to new Anaconda you have installed for, e.g.:
export PATH="/home/paras/anaconda3/bin:$PATH"
Now there will be 2 export paths: one for Python 2 and one for Python 3. Comment the one which you don't want.
I have the same problem and it is not necessary to uninstall on version of python. Please take care to not mix them up - When you search them up on the start menu. You can make a desktop shortcut saying 2.6 and 3.5.
I installed a fresh version of Python via
brew install python
Also
brew info python
tells me that it is at version 2.7.7.
I seem to remember that the python OSX Mavericks ships with is 2.5. So that
python --version
gives me 2.7.5 makes even less sense.
Also
which python
/usr/local/bin/python
should be the Homebrew version, correct?
I'm lost. Does anybody know, why my Python isn't version 2.7.7?
You have to explicitly tell brew that you want to switch to the version of python you just installed. To do that, type:
brew switch python 2.7.7
in your command line. This may not work if the version you installed is actually 2.7.7_2. In that case, just replace 2.7.7 with 2.7.7_2 above and run it again. Once this is done, you'll have to reload your environment to pick up the changes.
Python from my experience doesn't do an upgrade in the sense we would like it. Basically it will install python but not overwrite the old version. If you look in your main drive you will prolly see Python 2.7.7 and Python 2.7.5
usually in Windows its: C:\Python27
It doesn't really show the last digit (which from my knowledge refers to bugs fixed in the version), so it may overwrite unless it is an entirely new version. '
But I would check first if you have two files of Python. If you do then change your PATH variable environment to point to the latest and delete the old version.
That's my suggestion but I use Windows and pip install, so hopefully it is not too different.
Hi
I just want to install mercurial but for all versions it needs python 2.6, I tried to use .rpm file but the only thing I got is lots of lines full of error which tells: need old versions before 2.6 and after 2.5 which is installed on my linux. any help would be appreciated.
Bests
Go to ActiveState and download their versions: https://www.activestate.com/activepython/downloads
It's much easier than using the .rpms.
Which distribution are you using? I would recommend you to upgrade your system to a newer version of your linux distro, whatever it is. Modern Linux distros are using at least python2.6 now.
If you do not want to upgrade your system with various reasons, ActiveState's python version as stated in Jasie's answer is good for your cause. It installs python in your system without breaking anything, just you have to add some lines in your .bashrc to force system find your ActiveState python installation before the system's python.
Another alternative would be installing earlier version of mercurial which supports the python version installed on your system. But I would not recommend you to do so..
Among these, my suggestion is upgrading your system to a merely "up-to-date" version, so that python2.6 or higher is installed on your system.