Search code examples
pythonwindowsanacondaipopt

How to install ipopt for python on Windows using Anaconda


For my current project i needed a solver. My selection fell on IPOPT.

When trying to install IPOPT for Python using Anaconda i stumbled upon multiple problems.

For example:

conda install ipopt

installed the ipopt package formally but trying to import it afterwards in Python didn't work.

import ipopt

failed with:

No module named "ipopt".

Reading the docs of ipopt, cyipopt and pyipopt didn't bring any clarification.

System:

Windows 10 64bit, Anaconda 1.9.7, Python 3.7.5 (64bit)


Solution

  • This is what fixed the problem for me and allowed for a clean ipopt installation in a seperate environment:

    conda create -y -n ipopt_env
    conda activate ipopt_env
    conda install -y -c pycalphad cyipopt
    

    This should install ipopt into your current environment:

    conda install -y -c pycalphad cyipopt
    

    testing:

    python -c “import ipopt”
    

    should not return anything.

    Execute the following in python for access to the documentation:

    import ipopt
    help(ipopt)
    help(ipopt.problem)
    help(ipopt.minimize_ipopt)