4

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?

dejanualex
4,4046 gold badges30 silver badges43 bronze badges
asked Jul 12, 2020 at 17:04

2 Answers 2

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/'))
answered Sep 10, 2021 at 19:45
Sign up to request clarification or add additional context in comments.

Comments

2

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'))

answered Jul 7, 2022 at 0:16

1 Comment

This is the right answer. Notice the path must end in a folder like that "ampl.mswin64"

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.