I am working on an open access model (NREL ReEDS). Its in Python API.
The model I ran with Python 3.6.5, Python 3.7, Python 3.9.7 and
GAMS 30.3, GAMS 37, GAMS 40, GAMS 41 with all the possible combinations. The model can run in all these versions. I am using a windows 10 machine.
I am trying to use GDXPDS package to transfer between GDX data and Pandas.
This is the python code.
[code#%% IMPORTS ###
import gdxpds
import pandas as pd
import os
import argparse
#%% direct print and errors to log file
import sys
sys.stdout = open(‘gamslog.txt’, ‘a’)
sys.stderr = open(‘gamslog.txt’, ‘a’)
Time the operation of this script
from ticker import toc
import datetime
tic = datetime.datetime.now()
#############
#DUPV
#############
dupv = gdxpds.to_dataframe(gdxfile,‘CFDUPV’)
dupv = pd.DataFrame(dupv[‘CFDUPV’])
dupv[‘c’] = ‘dupv_’ + dupv.k.str.strip(‘class’)
dupv.columns = [‘r’,‘h’,‘cl’,‘value’,‘i’]
dupv = dupv[[‘r’,‘i’,‘h’,‘value’]]`
I get the following error.
Traceback (most recent call last):
File “C:\Users\bs43384\Desktop\ReEDS_OpenAccess-main\input_processing\cfgather.py”, line 95, in
dupv = gdxpds.to_dataframe(gdxfile,‘CFDUPV’)
File “C:\Users\bs43384\AppData\Roaming\Python\Python39\site-packages\gdxpds\read_gdx.py”, line 143, in to_dataframe
df = Translator(gdx_file,gams_dir=gams_dir,lazy_load=True).dataframe(symbol_name)
File “C:\Users\bs43384\AppData\Roaming\Python\Python39\site-packages\gdxpds\read_gdx.py”, line 50, in init
self.__gdx = GdxFile(gams_dir=gams_dir,lazy_load=lazy_load)
File “C:\Users\bs43384\AppData\Roaming\Python\Python39\site-packages\gdxpds\gdx.py”, line 154, in init
NeedsGamsDir.init(self,gams_dir=gams_dir)
File “C:\Users\bs43384\AppData\Roaming\Python\Python39\site-packages\gdxpds\tools.py”, line 182, in init
self.gams_dir = gams_dir
File “C:\Users\bs43384\AppData\Roaming\Python\Python39\site-packages\gdxpds\tools.py”, line 190, in gams_dir
self.__gams_dir = GamsDirFinder(value).gams_dir
File “C:\Users\bs43384\AppData\Roaming\Python\Python39\site-packages\gdxpds\tools.py”, line 73, in gams_dir
raise RuntimeError(“Unable to locate your GAMS directory.”)
RuntimeError: Unable to locate your GAMS directory.
Exception ignored in: <function GdxFile.del at 0x00000243458964C0>``
Unable to load gdxcc with default GAMS directory ‘None’. You may need to explicitly call gdxpds.load_gdxcc(gams_dir) before importing pandas to avoid a library conflict.
][/code]