I'm very new to python and biopython, currently using a mac. I have python v2.7 and v3.7, and I would like to be learning with python3. Biopython only works on v2.7. Is it worth installing python V3.4 as well as these other 2 versions so I can learn python3 and use biopython? Or remove python3.7 and add 3.4? Even if I install python3.4 will biopython work if it was installed prior? Very confused biologist here.
Firstly, check out this page: https://biopython.org/wiki/Download
You don't have to worry about biopython being bound to a specific version of python - you can use it with either v2.7 or v3.4/v3.5/v3.6. You can also have multiple version installed on your system but I recommend you to focus on digging deeper into one of them. Personally, I work now for several years with python3.x (at the moment 3.6) but I know a lot of people sticking to v2.7.
Having also a bioinformatics background, one thing that I can highly recommend you at the beginning of your journey is taking a course such as:
https://www.coursera.org/specializations/python
There is also a bunch of free tutorials on youtube - you will easily find one that fits your needs by searching for "python tutorial" or "python getting started".
Get yourself comfortable with the language, check out the basics such as data structures, databases, and data visualization. Check also some "python cheat sheets" - they can help you pick up the basic concepts of the language.
All the best and keep on coding!
From the biopython installation document:
Biopython is designed to work with Python 2.5 to 2.7 inclusive. Python 2.7 is the final 2.x series release, and this would be our recommended version (assuming all other Python libraries you plan to use support it).
Upgrading bug-fix releases (for example. 2.6.1 to 2.6.2) is incredibly easy and won’t require any re-installation of libraries.
Upgrading between versions (e.g. 2.6 to 2.7) is more time consuming since you need to re-install all libraries you have added to python.
As of Biopython 1.62 we officially support Python 3, specifically Python 3.3. Python 3.0, 3.1 and 3.2 will not be supported.
Also from the Biopython website:
Python 2.7, 3.4, 3.5, or 3.6 or PyPy, including the Python development header files like python.h
So biopython is inconsistent with their documentation.
I think your best option is to download either the latest version of Python 2 or 3 and see if it works.
Related
I am a beginner and I want to learn computer programming. So, for now, I have started learning Python by myself with some knowledge about programming in C and Fortran.
Now, I have installed Python version 3.6.0 and I have struggled finding a suitable text for learning Python in this version. Even the online lecture series ask for versions 2.7 and 2.5 .
Now that I have got a book which, however, makes codes in version 2 and tries to make it as close as possible in version 3 (according to the author); the author recommends "downloading Anaconda for Windows" for installing Python.
So, my question is: What is this 'Anaconda'? I saw that it was some open data science platform. What does it mean? Is it some editor or something like Pycharm, IDLE or something?
Also, I downloaded my Python (the one that I am using right now) for Windows from Python.org and I didn't need to install any "open data science platform".
So what is this happening?
Please explain in easy language. I don't have too much knowledge about these.
Anaconda is a commercial python and R distribution. It aims to provide everything you need (Python-wise) for data science "out of the box".
It includes:
The core Python language
100+ Python "packages" (libraries)
Spyder (IDE/editor - like PyCharm) and Jupyter
conda, Anaconda's own package manager, used for updating Anaconda and packages
Your course may have recommended it as it comes with these extras but if you don't need them and are getting on fine with vanilla Python that's OK too.
Learn more: https://www.anaconda.com/distribution/
Anaconda is a Python distribution that makes it easy to install Python plus a number of its most often used 3rd party libraries in a flexible way on a Windows or Linux machine.
My experiences with it are very positive, both on Windows and Linux. It is quite complete and avoids problems in building libraries that you need from source code, that frequently plague one by one installations of those libraries by tools like pip.
By the way: It's very wise to start with 3.5 or 3.6 since 2.7 is approaching the end of its lifecycle, though many applications still depend on it.
As for tutorials: Pythons own docs are quite suitable for learning the language.
https://docs.python.org/3/tutorial/
Anaconda is a Python-based data processing and scientific computing platform. It has built in many very useful third-party libraries. Installing Anaconda is equivalent to automatically installing Python and some commonly used libraries such as Numpy, Pandas, Scrip, and Matplotlib, so it makes the installation so much easier than regular Python installation. If you don't install Anaconda, but instead only install Python from python.org, you also need to use pip to install various libraries one by one. It is painful and you need to consider compatibility, thus it is highly recommended to directly install Anaconda.
I will try to port my Python 2.7 with Django to Python 3. But now my question is what version is the most stable one today? I've heard people use 3.2 and 3.4 and recommend it. But now I'm asking you guys.
What version is the most stable one today?
If you go to their downloads page, you will find the following statement (my emphasis):
We recommend using the latest version of Python 3 [...]
I've been using Python 3.4.3+ in a Django 1.8.2 project without issues and I don't see why you should run into problems here.
However, if you do run into issues, you should file a bug.
What version is the most stable one today?
Whatever version shows up as the recommended download in the python homepage should be considered stable. If that happens to be v3.5, then you should use that.
Python's version are quite stable, but you have to check is virtualenv on your OS is handled already by particular Python's version eg. 3.5.0 is not yet prepared for it. I recommend you 3.4.x, which I use on my own without any problems.
You may check for 'What Python version can I use with Django?' in official documentation here and here faq which lists which Python version is supported to which Django version
I have an open source project that works fine with python 2 and I am trying to make it work on python 3 as well.
I tried one approach that is using if statements in the code to check sys.version_info.major but this seems to be messy.
Is it possible to specify the interpreter version in setup.py to that when folks use pip install, it automatically pick up a compatible package?
This way, I can branch the code and the packages on github.
so lets say I have
x1.2 for python < 3
x1.1 for python >= 3
if the user has python3, pip should grab x1.1 (not the latest but the latest package for python3)
There is no way for you to specify what version pip should install, no. You can specify Python compatibility in the Trove classifiers, but pip will not differentiate on those, let alone pick a different version based on that.
You are stuck with writing a version that works on both Python 2 and 3. I recommend you read through the Porting Python 2 Code to Python 3 guide and use a compatibility layer support library like six. You can use the Modernize tool to help you rewrite your code here.
You can use 2to3 :
2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code.
and as #Martijn says in comment you can find the best recipe in Porting Python 2 Code to Python 3
I'm looking at two different guides for Windows HgWeb installation on IIS. The first from mercurial developers says:
On Windows, your Python version must
match the version used to compile
Mercurial. Otherwise, you'll get
"Invalid Magic Number" errors when
trying to run the CGI.
The second guide says:
Don’t waste time monkeying around with
the installers. You need a version of
Mercurial matching your Python install
so get the source code!
This is all great, except nobody wants to tell you how to match versions of Python and Mercurial. I see no guide that gives a map correlating version numbers. That is my primary need. For example, I'm using Mercurial 1.9. I have no idea what version of Python goes with that. The second guide says my version of PyWin32 must match as well. Great.
If the version-match info is not available online, is there a command I can issue to Hg that will dump all this info on me?
In the mean time, I've found that I can't build the Mercurial source code (is this because I don't have a properly matching version of Python?).
HgWeb
For HgWeb, this Mercurial download page recommends using the version that installs Mercurial as python modules, requiring Python 2.6.
From that, you would select a build of PyWin32 and choose the download for Python 2.6, as they build it for several versions.
Both decisions also have 32bit and 64bit versions.
Building
The main Mercurial download page hints that Python 2.4 through 2.7 are supported, so you might try building with 2.6 or 2.7 if you still wish to build it yourself. The wiki page for building on Windows is dated, mentioning Mercurial 1.3, but also mentions Python 2.6.
Is there an easy way to tell if a Python package will work if not matched to my Python release? For example, I cannot get PyGreSQL for Python 2.7 on Win (only 2.6) and I can't get ZODB for Win any more recent than Python 2.4. Does the version mismatch guarantee incompatibility, or do I just need to rename the package directory?
There's no way to tell for sure if the package will work on another Python version, but using older packages on newer Python 2.x's is much much more likely to work than the other way around.
One thing to watch out for: if you're installing a Windows kit, it may only install in the version it was meant for, due to registry look-ups and the like.