NREL / gdx-pandas

Python interface to read and write GAMS GDX files using pandas.DataFrames as the intermediate data format.
BSD 3-Clause "New" or "Revised" License
43 stars 15 forks source link

Problem when importing #71

Closed DIUANA closed 4 years ago

DIUANA commented 5 years ago

Hi I am trying to use gdxpds in an python 3.4.5 environment however when I try to import I get the following error:

raise ValueError('_names_ are reserved for future Enum use')

ValueError: names are reserved for future Enum use

I tried to uninstall enum34 and it did not work, it did not work with enum34 installed either.

Have you faced this before? Is there any way to work around this?

Thanks in advance.

DIUANA commented 5 years ago

I found a way to work around this. I installed a previous version of gdxpds, however now it is Unable to locate my GAMS directory (I am having this issue using windows 10, and the gams directory is defined in the path system variable) I am trying this:

from gams import *
gw = GamsWorkspace()
print(gw.system_directory)
gams_dir = gw.system_directory
sys.path.append(gams_dir)
gdxpds.load_gdxcc(gams_dir)

Even though when I run this line: dfg = gdxpds.to_dataframes(gdx_file)

I got:

dfg = gdxpds.to_dataframes(gdx_file)
Traceback (most recent call last):

File "", line 1, in
dfg = gdxpds.to_dataframes(gdx_file)

File "D:\ProgFile\Anaconda3\envs\py34\lib\site-packages\gdxpds\read_gdx.py", line 116, in to_dataframes
dfs = Translator(gdx_file,gams_dir=gams_dir).dataframes

File "D:\ProgFile\Anaconda3\envs\py34\lib\site-packages\gdxpds\read_gdx.py", line 57, in init
self.__gdx = GdxFile(gams_dir=gams_dir,lazy_load=lazy_load)

File "D:\ProgFile\Anaconda3\envs\py34\lib\site-packages\gdxpds\gdx.py", line 171, in init
NeedsGamsDir.init(self,gams_dir=gams_dir)

File "D:\ProgFile\Anaconda3\envs\py34\lib\site-packages\gdxpds\tools.py", line 145, in init
self.gams_dir = gams_dir

File "D:\ProgFile\Anaconda3\envs\py34\lib\site-packages\gdxpds\tools.py", line 153, in gams_dir
self.__gams_dir = GamsDirFinder(value).gams_dir

File "D:\ProgFile\Anaconda3\envs\py34\lib\site-packages\gdxpds\tools.py", line 74, in gams_dir
raise RuntimeError("Unable to locate your GAMS directory.")

RuntimeError:` Unable to locate your GAMS directory.
jebob commented 5 years ago

gdxpds doesn't read PATH yet, there is an MR which fixes this https://github.com/NREL/gdx-pandas/pull/69 but that's waiting for review.

Alternatively, if you put the gams directory in the sytem variable GAMS_DIR that might work.

elainethale commented 4 years ago

Closing after today's changes to the gams directory finder