Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Joplin CGE makes an error by not finding the correct solver path on Windows #444

Open
ywkim312 opened this issue Nov 7, 2023 · 1 comment

Comments

@ywkim312
Copy link
Member

ywkim312 commented Nov 7, 2023

When running the Joplin testbed notebook in the incore-docs, windows makes a following error due to not finding ipopt solver path correctly.

The error cell in notebook is

joplin_cge.run_analysis()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[93], line 2
      1 # Run Joplin CGE model analysis
----> 2 joplin_cge.run_analysis()

File ~\.conda\envs\pyincore\lib\site-packages\pyincore\baseanalysis.py:400, in BaseAnalysis.run_analysis(self)
    397         print("Error reading parameter: " + result[1])
    398         return result
--> 400 return self.run()

File ~\.conda\envs\pyincore\lib\site-packages\pyincore\analyses\joplincge\joplincge.py:1757, in JoplinCGEModel.run(self)
   1755 tmp = "tmp.py"
   1756 print("Calibration: ")
-> 1757 run_solver(filename, tmp)
   1759 '''
   1760 Simulation code below:
   1761 In each simulation:
   (...)
   1766 
   1767 '''
   1769 iNum = self.get_parameter("model_iterations")  # dynamic model iterations

File ~\.conda\envs\pyincore\lib\site-packages\pyincore\analyses\joplincge\joplincge.py:1672, in JoplinCGEModel.run.<locals>.run_solver(cons_filename, temp_file_name)
   1668 keepfiles = False  # True prints intermediate file names (.nl,.sol,...)
   1670 executable_path = self.get_parameter("solver_path") \
   1671     if self.get_parameter("solver_path") is not None else pyglobals.IPOPT_PATH
-> 1672 if not os.path.exists(executable_path):
   1673     print("Invalid executable path, please make sure you have Pyomo installed.")
   1675 opt = SolverFactory(solver, solver_io=solver_io, executable=executable_path)

File ~\.conda\envs\pyincore\lib\genericpath.py:19, in exists(path)
     17 """Test whether a path exists.  Returns False for broken symbolic links"""
     18 try:
---> 19     os.stat(path)
     20 except (OSError, ValueError):
     21     return False

TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
@ywkim312 ywkim312 changed the title [Bug] Joplin CGE makes an error by not finding the correct solver path [Bug] Joplin CGE makes an error by not finding the correct solver path on Windows Nov 7, 2023
@navarroc
Copy link
Member

navarroc commented Nov 8, 2023

This is not an IN-CORE issue, but a problem with ipopt not able to build solvers for windows after version 3.11.2. See conda-forge/ipopt-feedstock#55

One resolution is to download ipopt from here for windows:

https://github.com/coin-or/Ipopt/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants