TemoaProject / temoa

Tools for Energy Model Optimization and Analysis

Home Page:http://temoacloud.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migrate to python 3

gschivley opened this issue · comments

Longer-term issue, but most major scientific libraries are moving to require Python 3. Packages used in Temoa that will be dropping python 2 support include:

  • IPython
  • Pandas
  • Matplotlib
  • numpy

Looking through the codebase I noticed that cStringIO will have to be imported from io and most (but not all?) print statements will need to change. Not sure if there's anything else.

I might start trying to run with Python 3 and see what bugs come up.

Thanks for the heads up -- we agree this is an issue. For a long time, Pyomo relied on Python 2.7, and so that's what we've used. We'll investigate further, probably later in the spring. If you run and uncover other issues under Python 3, please let us know.

I’ve started a branch where I’ll be running Python 3. So far it’s just been

try:
    from cStringIO import StringIO
except ImportError:
    from io import StringIO

Sent with GitHawk

Some other comments.

  • I might try running futurize to automate conversion.
  • Temoa documentation says to use tabs in some instances. Python 3 won't allow a combination of tabs and spaces.

I'm running into unrelated issues (see #6) that have kept me from running code with Python 2 or 3.

Temoa has now been ported to Python 3. Thanks @gschivley for the help!