ImportError: DLL load failed while importing scip: No module found.
I'm trying test example:
from pyscipopt import Model
model = Model("Example") # model name is optional
x = model.addVar("x")
y = model.addVar("y", vtype="INTEGER")
model.setObjective(x + y)
model.addCons(2*x - y*y >= 0)
model.optimize()
sol = model.getBestSol()
print("x: {}".format(sol[x]))
print("y: {}".format(sol[y]))
but got
runfile('C:/Users/man_c/Downloads/ProHeatNet_Sim-master without Gurobi/ProHeatNet_Sim-master/untitled0.py', wdir='C:/Users/man_c/Downloads/ProHeatNet_Sim-master without Gurobi/ProHeatNet_Sim-master')
Traceback (most recent call last):
File "C:\Users\man_c\Downloads\ProHeatNet_Sim-master without Gurobi\ProHeatNet_Sim-master\untitled0.py", line 8, in <module>
from pyscipopt import Model
File "C:\Users\man_c\anaconda3\lib\site-packages\pyscipopt\__init__.py", line 11, in <module>
from pyscipopt.scip import Model
ImportError: DLL load failed while importing scip: No module found.
Have tried everything listed here: https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md
C:\WINDOWS\system32>set SCIPOPTDIR=C:\SCIPOptSuite 8.0.1
C:\WINDOWS\system32>python -m pip install pyscipopt
Collecting pyscipopt
Using cached PySCIPOpt-4.2.0.tar.gz (661 kB)
Requirement already satisfied: wheel in c:\users\man_c\anaconda3\lib\site-packages (from pyscipopt) (0.37.0)
Building wheels for collected packages: pyscipopt
Building wheel for pyscipopt (setup.py) ... done
Created wheel for pyscipopt: filename=PySCIPOpt-4.2.0-cp39-cp39-win_amd64.whl size=612019 sha256=a931e29e41d971e957d4ed3397b244ed4c3b6321512870493572c1c7f0a0bdd5
Stored in directory: c:\users\man_c\appdata\local\pip\cache\wheels\15\c8\80\0b7bc0e370527c3241b54ee3949698f0a06c5697eae6b60038
Successfully built pyscipopt
Installing collected packages: pyscipopt
Successfully installed pyscipopt-4.2.0
C:\WINDOWS\system32>pip install pytest
Requirement already satisfied: pytest in c:\users\man_c\anaconda3\lib\site-packages (6.2.4)
Requirement already satisfied: attrs>=19.2.0 in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (21.2.0)
Requirement already satisfied: iniconfig in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (1.1.1)
Requirement already satisfied: packaging in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (21.0)
Requirement already satisfied: pluggy<1.0.0a1,>=0.12 in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (0.13.1)
Requirement already satisfied: py>=1.8.2 in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (1.10.0)
Requirement already satisfied: toml in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (0.10.2)
Requirement already satisfied: atomicwrites>=1.0 in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (1.4.0)
Requirement already satisfied: colorama in c:\users\man_c\anaconda3\lib\site-packages (from pytest) (0.4.4)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\man_c\anaconda3\lib\site-packages (from packaging->pytest) (3.0.4)
C:\WINDOWS\system32>python -m pip install pyscipopt
Requirement already satisfied: pyscipopt in c:\users\man_c\anaconda3\lib\site-packages (4.2.0)
Requirement already satisfied: wheel in c:\users\man_c\anaconda3\lib\site-packages (from pyscipopt) (0.37.0)
C:\WINDOWS\system32>pip list
Package Version
---------------------------------- --------------------
...
PySCIPOpt 4.2.0
Got the same issue as described here: https://github.com/scipopt/PySCIPOpt/issues/467 by mariaeileen, but no solution available. The only difference is error itself:
ModuleNotFoundError: No module named 'pyscipopt'`
Is that important?
Do not take my word for it, but I would check if you have different python versions installed in your computer. What may happen is that you installed pyscipopt into a python version and are trying to use another. Do you think this may be the issue? Python not being able to find pyscipopt ("No module named 'pyscipopt'") seems to indicate that this may be the case.
It happened to me when I was trying to use anaconda for the first time. To make it easier for myself, I just uninstalled every version of Python I had, and procceded to install a single one.
I am closing the issue to clear the Issue page, but please re-open it if this didn't solve your problem!