FileNotFoundError when installing modules (ampl-3.0.0.dll) with amplpy.modules

Dear AMPL Support,

I have installed amplpy using pip, and the installation seemed to complete correctly:

pip install amplpy

Next, I tried to install modules for open-source solvers to use them through Pyomo. Following the documentation, I ran the following command:

python -m amplpy.modules install coin highs scip gcg -q 

However, this results in the following error:

File "<frozen runpy>", line 112, in _get_module_details
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python313\Lib\site-packages\amplpy\__init__.py", line 17, in <module>
    raise exp
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python313\Lib\site-packages\amplpy\__init__.py", line 15, in <module>
    ctypes.CDLL(dllfile)
    ~~~~~~~~~~~^^^^^^^^^
  File "C:\Users\Usuario\AppData\Local\Programs\Python\Python313\Lib\ctypes\__init__.py", line 390, in __init__
    self._handle = _dlopen(self._name, mode)
                   ~~~~~~~^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\Users\Usuario\AppData\Local\Programs\Python\Python313\Lib\site-packages\amplpy\amplpython\cppinterface\lib\amd64\ampl-3.0.0.dll' (or one of its dependencies). Try using the full path with constructor syntax.

I have checked, and the library ampl-3.0.0.dll does exist in that directory, so I am not sure what the problem could be.

Thank you in advance.

Best regards, Ángel

Dear Ángel,

it might be possible that the dependencies of the library ampl-3.0.0.dll cannot be found. Can you please provide the libraries that are shown as dependencies for ampl-3.0.0.dll using the tool dumpbin?

Best wishes,
Jürgen

Hi @angelmanuel.rueda,

Typically this happens when Microsoft Visual C++ Redistributable Package is missing. You can install it from https://aka.ms/vs/16/release/vc_redist.x64.exe as mentioned in the last paragraph of Introduction — AMPL API 2.1 (amplpy-0.15.0) documentation.