cog-imperial / OMLT

Represent trained machine learning models as Pyomo optimization formulations
Other
281 stars 59 forks source link

Error with Linear Tree Formulation: "ModuleNotFoundError" despite module presence #134

Closed bahar239 closed 1 year ago

bahar239 commented 1 year ago

Hello,

While working with the 'Linear Tree Formulations' notebook, I always encounter the error: "ModuleNotFoundError: No module named 'omlt.linear_tree'". The module is visible in the directory structure. My environment is a MacBook Pro with an Apple M1 chip, 16 GB RAM, running Python version 3.9.13. Any assistance or solutions regarding this 'Linear Tree Formulations' error would be appreciated.

rmisener commented 1 year ago

@bammari, Are you able to take a look at this one? @bahar239 may be available to chat more about this and it's useful to get feedback on the linear tree components so quickly.

bammari commented 1 year ago

Hi @bahar239 and thank you for your comment.

Can you please give me more information on the Jupyter kernel you are using to run this notebook? Specifically, if you are using a virtual environment, how did you install omlt?

jalving commented 1 year ago

@bahar239 can you check if you have linear-tree installed? If not, try running pip install linear-tree I noticed this error came up when updating the docs. I think this line is the culprit since we do not check for linear-tree on import and it isn't an omlt requirement.

bahar239 commented 1 year ago

Hi @bammari, I'm running the Jupyter Notebook within a Conda virtual environment. I installed it using pip install omlt within this environment.

bahar239 commented 1 year ago

Hi @jalving. Yes, linear-tree is installed.

bammari commented 1 year ago

@bahar239

Although linear-trees have been merged into main, they will not be available until the next release of OMLT. That is, if you are running OMLT 1.1, you will receive this error.

Until the next release, please work by installing directly from OMLT main. You can do this easily by calling pip install git+https://github.com/cog-imperial/OMLT

bahar239 commented 1 year ago

@bammari thank you so much! Following your advice, I don't get that error anymore. Appreciate the guidance!

bammari commented 1 year ago

@bahar239 Glad to help!