Should we make NuPIC python 3 compliant?

So this issue got me thinking:

The bigger question is:

Should we have an initiative to make NuPIC python 3 compliant?

  • YES
  • NO
  • it’s not that simple!

0 voters

If you said “it’s not that simple”, please explain! :wink:

By the way, this is something I think we should do a bit at a time, tracking what has been updated as we go. It would be a long-standing issue, and we might want some rules to prevent giant pull requests.

Not updating to Python 3 eventually is not really an option, IMO. It must happen. It’s only a matter of when and that clock is already ticking. I suspect when the OS’s ship Python 3 by default it will be unavoidable, but it’d be nice if we gave ourselves a head start. To put that into perspective, Canonical reports their Python 3 priorities at https://wiki.ubuntu.com/Python and on windows, you must be running Python 3 to take advantage of the modern visual studio toolchain (https://www.visualstudio.com/vs/python/). Who knows what’s happening on macOS, but you can safely bet that a future release will abruptly and without warning switch to Python 3 as the default version. Lack of support for python 3 has already made our own efforts on windows more difficult.

3 Likes

I’d also like to see python 3 compliance. A few notes:

  • Python 3 has significant performance improvements.
  • Most popular libraries are now python 3 compliant
  • There’s a bunch of tools for automating large parts the conversion process
  • To be a relevant python tool, nupic will need to keep with the times.
5 Likes

Any news on this issue ?

I’m not aware that support for Python 3 has been formally prioritized. IPython [recently dropped support for Python 2] (http://ipython.readthedocs.io/en/stable/whatsnew/version6.html#ipython-6-0), so hopefully that will add some external pressure.

Ok, I hope too. Python is going to be EOL and as said all projects switch to python3.

Thanks for your fast reply!

Hey Matt, just completed Jeff’s book and your HTM school lectures. Awesome stuff. Could you please update us on Python 3. :slight_smile:

3 Likes

Unfortunately, there are no plans for Numenta to update NuPIC to python 3. We are focusing all our engineering efforts on research.

However, if someone wants to fork NuPIC into a python 3 compliant version, that would be fine!

2 Likes

I’m using NuPIC to learn Python, so I’ll take a crack at it. Should be a good way to help solidify my understanding of the language. Having a newb to a language to port code is probably not the best idea though :blush:. Could be at least a good starting point and have some seasoned Python experts come in and clean it up afterwards.

I can give a look if you are in trouble !

1 Like

I don’t use NuPIC, but my two cents as someone who does a very large amount of python programming: python3 compliance (i.e. making sure the code runs on python3) is a good idea. But requiring features unique to python3 is not. The compatibility differences between the two versions are the biggest source of friction in my workflow, when I’m integrating other machine learning researchers’ code with my own. So my opinion on these questions is that where at all possible (which is everywhere), write code that works in both versions of the language.

4 Likes

In case you needed more motivation to migrate to python3, numpy (used heavily by nupic) is losing py2 support in 2020:

1 Like

I’m exploring the possibility to move all python code to boost::python. I’m in contact with one of the developers and he told me that boost python supports version 2.7 and 3.x.

There even is a numpy extension:
http://www.boost.org/doc/libs/1_65_1/libs/python/doc/html/numpy/index.html

Does anyone have a good reason not to do that?

A post was split to a new topic: Proposal to introduce pybind for move toward Python 3 compatibility

Hey guys, sorry I’m 10 months late.

Is there someone still interested in making nupic compatible with python3? As a long-time python programmer and as systems dev, I highly recommend a python3 compat nupic. Here are my high-level whys in my opinion.

  1. Python 2 EOL is fast approaching. As we get closer to this, nupic’s development appeal will gradually decrease. Almost all my project as of this stage are mostly python 3 and most python devs love simplicity, that is why as much as possible we would prefer working only for one interpreter, if that is possible of course.

  2. The future of python is python 3. Some say it is best to support both python 2 and 3, however, I believe that this only applies to “uncontrollable” scenarios. For nupic, I believe that the friction and breakages that may be brought by the transition (python 2 to 3) will be less heavy than the benefits that it will bring.

  3. I do not know the details of the code as of this moment, however, nupic may benefit very much from python’s asyncio libraries.

Let me know if there is someone who’s keen to port nupic to python3 as I would be keen to help. I will take this as a challenge with my ulterior motive that is to also learn the internals of nupic, and hopefully understand HTM better.

2 Likes

I’m also still interested in helping with this effort. My Python skills are not up to par for tackling it myself, unfortunately.

3 Likes

My opinion, just my opinion of course, python is easy to learn, probably the easiest of all especially if the simplest path is taken during coding. My experience tells me that python will help you learn the code or logic more than learning the language itself. So it allows non-python programmers to understand python code in an effective way.

Thanks for the interest, now where should we start? :grinning: I hope there will be more people who’d join the party. For now, I will have a look at the nupic code and probably come up with a high-level conversion strategy (python 2 to 3).

2 Likes

Have you started working on this already? Let me know, keen to help. One of the things we need to know is that whether the conversion we will be pursuing is one of the following paths;

  1. python2.7 to python3.x
  2. python2.7 to python3.x (supports python2.7)
  3. python2.7 to python3.x (supports python2.7 and older versions)

#1 would be the easiest path, however in reality many ML practitioners out there still use 2.7 so supporting 2.7 would be more beneficial to everyone at least as of this stage. What are your thoughts?

1 Like

Hi Jose,

I worked on this a few months ago. The code here works with python 3. There are still a few tests that are failing and it’s mostly due to behavioral differences between python 2.7 and python 3. Have a look here here.

Hope this helps.

Christian

2 Likes