简体   繁体   中英

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)

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)

For anyone coming to this after the answer from @johannes, the pycalphad Anaconda channel is no longer maintaining ipopt / cyipopt builds for Windows. Since early 2021, ipopt and cyipopt [2] are now being distributed by the conda-forge channel.

They can be installed using Anaconda by:

conda install -c conda-forge ipopt cyipopt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM