Cannot get gdxcc module in the right path (Python API)

Questions on using the GAMS APIs (Python, .NET, etc.)
Post Reply
gams_learner58
User
User
Posts: 8
Joined: 2 years ago

Cannot get gdxcc module in the right path (Python API)

Post by gams_learner58 »

Hello,

I'm trying to import gams module into my python program and got the error:

Code: Select all

ModuleNotFoundError: No module named '_gdxcc'
I know this probably has something to do with getting this module on the right path because when I pip install gdxcc, the requirement is already satisfied and the location of the gdxcc module is at:

Code: Select all

Requirement already satisfied: gdxcc in c:\users\<name>\appdata\roaming\python\python39\site-packages\gdxcc-8-py3.9.egg (8)
However, the code calls for gdxcc at:

Code: Select all

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'
I'd appreciate any help to resolve this issue. I tried everything I could find on the internet for hours and nothing worked. Thank you so much in advance!
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Cannot get gdxcc module in the right path (Python API)

Post by bussieck »

There is currently no "pip" for the GAMS modules. So not clear what you mean by "pip install". The install of the GAMS modules works by "cd <gams_sysdir>\apifiles\Python\api_39 && python setup.py install" as you can read from https://www.gams.com/latest/docs/API_PY ... STALLATION. Make sure you use the the python executable for installation that you use to actually import gdxcc with. After installation just start the python interpreter that you just used to install the packages and try an "import gams2numpy" that should work.

-Michael
gams_learner58
User
User
Posts: 8
Joined: 2 years ago

Re: Cannot get gdxcc module in the right path (Python API)

Post by gams_learner58 »

bussieck wrote: 1 year ago There is currently no "pip" for the GAMS modules. So not clear what you mean by "pip install". The install of the GAMS modules works by "cd <gams_sysdir>\apifiles\Python\api_39 && python setup.py install" as you can read from https://www.gams.com/latest/docs/API_PY ... STALLATION. Make sure you use the the python executable for installation that you use to actually import gdxcc with. After installation just start the python interpreter that you just used to install the packages and try an "import gams2numpy" that should work.

-Michael
Hello, thank you for your comments. I did already do:

Code: Select all

cd C:\GAMS\wind64\apifiles\Python\api_39
Then:

Code: Select all

python setup.py install
After that I tried to import the gams module in my python code:

Code: Select all

from gams import *
And encountered the error above (no gdxcc module). I tried import gams2numpy and it also gave me an error

Code: Select all

File "C:\Users\<name>\AppData\Roaming\Python\Python39\site-packages\gams2numpy-0.1-py3.9.egg\gams2numpy.py", line 26, in <module>
    import _gams2numpy
  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 '_gams2numpy'
Post Reply