adamgreenhall / minpower

power systems tools made beautiful
adamgreenhall.github.io/minpower
71 stars 33 forks source link

TypeError: long() argument must be a string or a number, not 'datetime.datetime' #19

Closed BjoernLaemmerzahl closed 8 years ago

BjoernLaemmerzahl commented 8 years ago

Hello,

I am having troubles getting started with minpower.

I followed the instructions on the website and successfully installed minpower/CPLEX. When trying to execute the sample UC case I receive the following output.

user@Computer C:\Users\user\minpower
$ pip install minpower
Requirement already satisfied (use --upgrade to upgrade): minpower in c:\python27\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): pyomo==4.0.9682 in c:\python27\lib\site-packages (from minpower)
Requirement already satisfied (use --upgrade to upgrade): pandas==0.16 in c:\python27\lib\site-packages (from minpower)
Requirement already satisfied (use --upgrade to upgrade): numpy==1.9.1 in c:\python27\lib\site-packages (from minpower)
Requirement already satisfied (use --upgrade to upgrade): ply in c:\python27\lib\site-packages (from pyomo==4.0.9682->minpower)
Requirement already satisfied (use --upgrade to upgrade): six>=1.6.1 in c:\python27\lib\site-packages (from pyomo==4.0.9682->minpower)
Requirement already satisfied (use --upgrade to upgrade): nose in c:\python27\lib\site-packages (from pyomo==4.0.9682->minpower)
Requirement already satisfied (use --upgrade to upgrade): PyUtilib>=5.0 in c:\python27\lib\site-packages (from pyomo==4.0.9682->minpower)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in c:\python27\lib\site-packages (from pandas==0.16->minpower)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in c:\python27\lib\site-packages (from pandas==0.16->minpower)
You are using pip version 8.0.2, however version 8.1.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

user@Computer C:\Users\user\minpower
$ minpower uc
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\minpower.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\minpower\solve.py", line 297, in main
    solve_problem(directory)
  File "c:\python27\lib\site-packages\minpower\solve.py", line 147, in solve_problem
    generators, loads, lines, times, scenario_tree, data = get_data.parsedir()
  File "c:\python27\lib\site-packages\minpower\get_data.py", line 201, in parsedir
    lines_data, init_data)
  File "c:\python27\lib\site-packages\minpower\get_data.py", line 137, in _parse_raw_data
    generators_data, loads_data)
  File "c:\python27\lib\site-packages\minpower\get_data.py", line 377, in setup_times
    timeseries[name] = get_schedule(joindir(datadir, load[fcol])) * \
  File "c:\python27\lib\site-packages\minpower\schedule.py", line 11, in get_schedule
    return ts_from_csv(filename)
  File "c:\python27\lib\site-packages\minpower\commonscripts.py", line 107, in ts_from_csv
    df.index = pd.DatetimeIndex(df.index)
  File "c:\python27\lib\site-packages\pandas\util\decorators.py", line 88, in wrapper
    return func(*args, **kwargs)
  File "c:\python27\lib\site-packages\pandas\tseries\index.py", line 332, in __new__
    subarr = cls._simple_new(subarr, name=name, freq=freq, tz=tz)
  File "c:\python27\lib\site-packages\pandas\tseries\index.py", line 502, in _simple_new
    values = com._ensure_int64(values).view(_NS_DTYPE)
  File "pandas\src\generated.pyx", line 115, in pandas.algos.ensure_int64 (pandas\algos.c:51102)
  File "pandas\src\generated.pyx", line 120, in pandas.algos.ensure_int64 (pandas\algos.c:50998)
TypeError: long() argument must be a string or a number, not 'datetime.datetime'

I tested it also with a fresh install of Anaconda, but I receive the same output.

I am using numpy-1.10.4. If I downgrade to numpy 1.9.1 I receive the following error.

RuntimeError: module compiled against API version a but this version of numpy is 9 ``

I apologize. Obviously the error is due to an outdated pandas version. I am still stuck with this error, but I guess I can figure that out:

$ minpower uc
Traceback (most recent call last):
  File "c:\anaconda2\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\anaconda2\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Anaconda2\Scripts\minpower.exe\__main__.py", line 9, in <module>
  File "c:\anaconda2\lib\site-packages\minpower\solve.py", line 297, in main
    solve_problem(directory)
  File "c:\anaconda2\lib\site-packages\minpower\solve.py", line 147, in solve_problem
    generators, loads, lines, times, scenario_tree, data = get_data.parsedir()
  File "c:\anaconda2\lib\site-packages\minpower\get_data.py", line 201, in parsedir
    lines_data, init_data)
  File "c:\anaconda2\lib\site-packages\minpower\get_data.py", line 140, in _parse_raw_data
    loads = build_class_list(loads_data, powersystems.Load, times, timeseries)
  File "c:\anaconda2\lib\site-packages\minpower\get_data.py", line 292, in build_class_list
    invalid_fields.tolist()))
ValueError: invalid fields in model:: ['p', 'type']
BjoernLaemmerzahl commented 8 years ago

Sorry, The field was not labelled correct.