Hello,
I’m trying to import gams module into my python program and got the error:
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:
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:
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!
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_TUTORIAL.html#PY_COPY_GAMS_FILES_TO_PYTHON_INSTALLATION. 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:
cd C:\GAMS\wind64\apifiles\Python\api_39
Then:
python setup.py install
After that I tried to import the gams module in my python code:
from gams import *
And encountered the error above (no gdxcc module). I tried import gams2numpy and it also gave me an error
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'