MiniZinc / MiniZincIDE

The MiniZinc IDE
http://www.minizinc.org
Mozilla Public License 2.0
144 stars 22 forks source link

Unable to load minizinc projects in ubuntu #195

Closed bluivy closed 11 months ago

bluivy commented 12 months ago

I installed minizinc in my ubuntu using sudo snap install minizinc --classic. I get the below error when I Open the mzp file image

OS version : Ubuntu 20.04.6 I did not observe the same when open projects in windows

cyderize commented 12 months ago

It looks like the IDE can't find the actual files the project refers to (the mzp is essentially just a list of file names to open).

If you downloaded the project as a zip file, make sure you extract all of the files first and then open the unzipped project (this error often happens if you just double click the mzp file from inside the zip viewer).

bluivy commented 12 months ago

Yes, I had extracted themfrom the zipfile and then clicked on the file. Additionally I have also tried opening within the IDE as well. Using the Open file option.

cyderize commented 12 months ago

Are you able to locate the .mzn files manually and open them in the IDE, or does that fail too?

bluivy commented 12 months ago

im able to open the .mzn files individually and run them individually

cyderize commented 12 months ago

In that case could you open a new IDE window, and use the File -> Open dialog to open some of the .mzn files, and then go to File -> Save Project and then save the project to the same folder as the original .mzp (but renamed to something else to not overwrite it).

Then could you see if closing the IDE and then reopening this newly saved project works?

And also if you could then open the two .mzp files in a text editor and paste the contents here that would be great.

bluivy commented 11 months ago

Sure, when i create a mzp file as mentioned I am able to launch projects. Here are the contents of the mzp files. This is mzp that was created by me { "openFiles": [ "../aeb9200c/army-plan-prod.mzn", "../9f765d7e/army.mzn", "../36c68929/armyd.mzn", "../7f251541/army-plan-prod.dzn" ], "openTab": 3, "projectFiles": [ "../36c68929/armyd.mzn", "../578dfd60/test_project", "../7f251541/army-plan-prod.dzn", "../9f765d7e/army.mzn", "../aeb9200c/army-plan-prod.mzn" ], "selectedBuiltinConfigId": "org.gecode.gecode", "selectedBuiltinConfigVersion": "6.3.0", "version": 106 }

This was the file that was shared in the assignment which I have trouble opening

{ "projectFiles": [ "models/beanscrying.mzn", "models/beanscrying.mzc.mzn", "models/caotest.mzn", "models/sevenpaces.mzc.mzn", "models/cuhkmelb.mzc.mzn", "models/sevenpaces.mzn", "models/cuhkmelb.mzn", "models/caotest.mzc.mzn", "data/empty.dzn", "_mooc" ], "openFiles": [ "models/beanscrying.mzn", "models/caotest.mzn", "models/sevenpaces.mzn", "models/cuhkmelb.mzn" ], "openTab": 0, "version": 106, "selectedBuiltinConfigId": "org.gecode.gecode", "selectedBuiltinConfigVersion": "6.3.0" }

cyderize commented 11 months ago

The project you saved has files like ../36c68929/armyd.mzn which look like they might have been saved to various automatically generated directories - could there be some sort of sandboxing happening which is changing the normal directory structure of the extracted zip?

The original error message looks like it was from the seven paces project. Could you re-download 01_sevenpaces.zip and place it in your home holder, and then right click it and choose Extract here and then go to 01_sevenpaces/ and confirm that you see a structure like

And then try opening project.mzp?

bluivy commented 11 months ago

as mentioned I have downloaded 01_sevenpaces.zip and placed it in home folder and extracted the file. I can see the same directory structure as above. I tried opening the .mzp file and got the same error. I have not tried to run the application in a sandbox. I installed it directly using sudo snap install minizinc --classic image

cyderize commented 11 months ago

On a fresh install of Ubuntu 22.04, these commands worked for me (after running sudo snap install --classic), could you try them and see if you still get the error?

mkdir sevenpaces_test
cd sevenpaces_test
wget https://coursera.minizinc.dev/01_sevenpaces.zip
unzip 01_sevenpaces.zip
minizinc.ide project.mzp &
bluivy commented 11 months ago

the above worked for me as well. I am able to access the files. I dont see the error dialogue box.
image.

Additionally I would like highlight that when i submit to coursera Im getting

Checking login and assignment token...
Error:
TLS initialization failed

Done.
cyderize commented 11 months ago

Good to see that worked.

The TLS bug is because of #189 which will be fixed in the next release shortly.

For now, you can switch to the edge snap channel which should resolve the issue.

bluivy commented 11 months ago

Yes, im able to access mzp file through comand line using minizinc.ide project.mzp and submit assignments to coursera. Thanks

cyderize commented 11 months ago

Great, I'm going to close this issue since saving a new project and reloading worked, and unzipping from the command line worked. It's likely that this is not a bug in the IDE, and is some problem with extracting the project files, or opening the wrong copy of a project.

Feel free to reopen if you believe this is not the case.