Recently, the Nikola team asked the community about the Python versions used to run Nikola. We received a total of 138 responses. The survey results are as follows:
Most users already are on Python 3¶
Two thirds (66%) of Nikola users are already on Python 3. Some users run both versions concurrently (for example, on different operating systems)
A diverse selection of operating systems¶
The most popular operating system is Ubuntu (with 54 users), followed by Debian and Mac OS X (37 users each). There were also 27 Windows users taking part in the survey. This was a multiple–choice question — there were 211 data points in total)
There are multiple operating system versions listed in the second (optional) question about operating systems, ranging from Debian 6 squeeze (oldstable) to the newest versions
Switching is not a problem for the community¶
Out of all the participants, only 10 (7.25%) said that they would not install a Python 3 interpreter, even if Nikola were to require one. More than 76% of our users have a Python 3 interpreter installed already.
The future of Python 2.7 in Nikola¶
Taking the results of this survey into consideration, the Nikola developers decided that Python 2.7 support will be dropped in Nikola v8.0.0. This version will be released in early 2016. Before that date, we will migrate all our remaining infrastructure to Python 3.x. The next version of Nikola, v7.7.2, will be released on 2015-10-03 and will display a warning if the user is running Python 2.7. We might keep the compatibility hacks after v8.0.0, but we will not officially support using Python 2.7 with Nikola.
Motivation (added 2015-09-27)¶
Supporting two Python versions is a lot of work. We have to use various compatibility hacks to make Unicode work properly, and then there are still issues caused by the fact Python 2 was not built with Unicode in mind. The developers decided that it is time to let Python 2 go and thus make the development much easier.
Switching to Python 3.x¶
If you are running Nikola with Python 2.7, you should switch to Python 3.x soon. Doing so is simple and is a one–time process. You should follow the Getting Started Guide for more information, or read the instructions below:
- Install Python 3.5 from the official website (python.org)
- Install virtualenv using py -m pip install virtualenv
- Create a virtualenv and activate it (for more information, read virtualenv documentation)
- Install lxml and Pillow wheels from Christoph Gohlke’s website (using pip install c:\paths\to\the\two\files.whl)
- Install Nikola using pip install "Nikola[extras]"
Mac OS X¶
Follow the “Installing on OS X” section of the Getting Started Guide to install Nikola and Python from Homebrew, MacPorts or Fink.
To install Nikola using Python 3.x on Linux, you should first identify your installation method.
If you use a distribution package (eg. python-nikola from Arch Linux’s AUR, or Fedora’s packages), you should look for the Python 3 version of those packages. If those are not available, you should install Nikola manually and report a bug with your distribution.
If you installed Nikola manually, we recommend creating a virtualenv for it. Please follow the instructions in the Getting Started Guide (you might need to see the troubleshooting hints and adjust them for your OS/Python 3 package name)
(Note that Nikola requires Python 3.3 or newer; if you are running a really old distribution, it might not be available.)
Migrating a site¶
You can use your existing Nikola site with Python 3, without any special modifications to the code. However, you will likely receive this error when you run nikola build for the first time:
doit.dependency.DatabaseException: Dependencies file in '.doit.db' seems to use an old format or is corrupted. To fix the issue you can just remove the database file(s) and a new one will be generated.
In case you do, you can just remove the mentioned .doit.db file and run nikola build again. Note that this will lead to rebuilding your site from scratch — but this is a one–time process, and the next rebuild should be an incremental one.
PS. you can also see the results on the Google Forms results summary page. If you want to do your own data analysis, we can share the raw data (.csv) — contact me (Chris Warrick) if you would like to get access. The charts in this post were generated courtesy of pygal, using the :chart: directive, which is built into Nikola.