# Problems Installing APOPT in Pyomo

I am trying to install the solver "APOPT" in Pyomo by following the guidelines laid out below:

*Instructions for usage:

1. Place apopt.py in an appropriate folder in the system path (e.g. Linux, /usr/bin/)
2. Set appropriate permissions to make the script executable (e.g. chmod 775 apopt.py)
3. In AMPL, Pyomo, or other NL file write, set solver option to apopt.py
4. Test installation by running apopt.py -test *

I essentially copy/paste the apopt.py script from the GitHub Repository into a .py file and have placed it in my project folder that I am working in. I think that the permissions should be okay. However, when I run step 3 at the command line I get the following errors:

WARNING: Failed to create solver with name 'apopt': Failed to set executable for solver asl. File with name=apopt either does not exist or it is not executable. To skip this validation, call set_executable with validate=False.

And when I try to do Step 4 I get:

'apopt' is not recognized as an internal or external command, operable program or batch file.

I am not sure why this is happening though?

It sounds like the APOPT executable is not in your system's PATH.

From your description, I suspect that the solver's name should be --solver=apopt.py instead of --solver=apopt.

• Hmm... When I make this adjustment I get "Error message: [WinError 193] %1 is not a valid Win32 application". Correct me if I am wrong here, but wouldn't the apopt.py file need to be apopt.exe for it to be an executable? – GrayLiterature Sep 3 '19 at 18:18
• On Linux this is valid Pyomo syntax, but on Windows you need a .exe file for Pyomo. If APOPT has an .exe, try --solver=apopt.exe. If not, you can convert the .py file to an executable (e.g. using py2exe). Another thing you can try is to make sure that the apopt binary is in your administrator user's PATH variable. – Nikos Kazazakis Sep 3 '19 at 18:27
• When you say "system's PATH", could you perhaps elaborate on this? I am not sure what you mean exactly? – GrayLiterature Sep 3 '19 at 19:34
• For Windows that would be the PATH environment variable (Google "set windows path variable). Add a semicolon at the end of your PATH and then append the path of your binary. – Nikos Kazazakis Sep 3 '19 at 19:40