0

I'm having trouble with importing gams module into python program. I'm using python 3.9 via Anaconda. The problem seems to be due to gdxcc is not on the right path, but I do not know how to fix it.

To create the gams module I simply run setup.py from the python API folder of gams. In my case, that is:

cd C:\GAMS\40\apifiles\Python\api_39\
python setup.py install

That created the gams module. However, when I tried to

from gams import *

I got this error:

ModuleNotFoundError: No module named '_gdxcc'

So I tried to:

pip install gdxcc

But it looks like gdxcc is already installed. Its location is:

C:\Users\<name>\appdata\roaming\python\python39\site-packages\gdxcc-8-py3.9.egg (8)

But I cannot import it because the python code tries to import it from:

"C:\Users\<name>\AppData\Roaming\Python\Python39\site-packages\gams2numpy-0.1-py3.9.egg\gdxcc.py"

The full error is:

File "C:\Users\<name>\AppData\Roaming\Python\Python39\site-packages\gams2numpy-0.1-py3.9.egg\gdxcc.py", line 11, in <module>
    import _gdxcc
  File "C:\Program Files\JetBrains\PyCharm 2019.3.4\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named '_gdxcc'

What should I do to make python recognize gdxcc path? Thank you very much in advance!

user496181
  • 141
  • 7

0 Answers0