I have recently installed Amplpy for python 3.6.5 (win 32 bit), but I am facing the following issue:
- Please make sure that the AMPL folder is in the system search path, or specify the path via:
AMPL(Environment('full path to the AMPL installation directory'))
RuntimeError Traceback (most recent call last)
<ipython-input-4-1768ae85d3ec> in <module>()
1 from amplpy import AMPL
----> 2 ampl = AMPL()
D:\Poulad\Program\myprog\lib\site-packages\amplpy\ampl.py in __init__(self, environment, langext)
83 if environment is None:
84 try:
---> 85 self._impl = amplpython.AMPL()
86 except RuntimeError as e:
87 from sys import stderr
RuntimeError: AMPL could not be started: The system cannot find the file specified.
I have also added amplpy and amplpython paths to the search paths through sys.path.append() but the error is poping up again.
Would you please help me to fix the problem?
2 Answers 2
You have to put the path of the ampl executable when you call ampl (line 2). So instead of:
ampl = AMPL()
you write:
ampl = AMPL(Environment('put/here/your/path/'))
Comments
You have to import the Environment class from amplpy. Then you have to specify where your amplpy file is located. It should be something like that:
from amplpy import AMPL,Environment
ampl = AMPL(Environment(r'C:\ampl.mswin64'))