4

I installed minizinc on python through anaconda prompt as normally with other packages.

pip install minizinc

The package says it was installed successfully and I can import the module. However, I'm following the basic example https://minizinc-python.readthedocs.io/en/latest/getting_started.html#a-basic-example but Once I run the first line

from minizinc import Instance, Model, Solver

and I'm getting the import error below:

    ImportError: cannot import name 'Instance' from 'minizinc' 
(C:\ProgramData\Anaconda3\lib\site-packages\minizinc\__init__.py)

This is the only package I have problems with. My current python version is 3.7 which according to https://minizinc-python.readthedocs.io/en/latest/getting_started.html#a-basic-example should support minizinc. If anyone has faced the same issue and fixed the problem I'll appreciate any feedback regarding this problem.

AGH
  • 300
  • 3
  • 12
  • 1
    Are you sure MiniZinc itself (the MiniZinc bundle) is installed on the running machine? – Dekker1 Jul 23 '20 at 00:28
  • well, I just did the pip install minizinc on anaconda prompt. Do I still need to install minizinc on my pc? I thought I could use minizinc just by installing the package. – AGH Jul 23 '20 at 21:08
  • oh I just did installed minizinc now I can run the example many thanks @Dekker1 – AGH Jul 23 '20 at 21:14

1 Answers1

4

The MiniZinc bundle (or at least the minizinc executable) should be installed in order to use MiniZinc Python. It is noted as one of the required dependencies in the installation documentation.

When the minizinc executable is not found, MiniZinc Python will output the following warning to indicate that the executable could not be located:

MiniZinc was not found on the system: no default driver could be initialised
Dekker1
  • 5,565
  • 25
  • 33
AGH
  • 300
  • 3
  • 12