DCBIA-OrthoLab / SlicerAutomatedDentalTools

A 3D Slicer extension to use AMASSS, ALI-CBCT and ALI-IOS
Other
79 stars 22 forks source link

BUG: Fix AMASSS installation of torch for windows system #82

Closed Jeanneclre closed 4 months ago

Jeanneclre commented 4 months ago

Hello @allemangD

I changed the way the installation is done for torch in windows to troubleshoot the issue #81.

Thanks,

allemangD commented 4 months ago

I think there may be some more straightforward way to declare the dependencies, which would be easier to migrate to a constraint file in the future, but it's not clear to me how to also allow the separate libs_to_install and libs_to_upgrade lists that you have here. So I approved these changes, I think it's a fine compromise... but my sense is more problems will come up in the future.

Specifically, declare the list of dependencies by the platform:

if platform.system() == 'Windows':
  list_libs = ['torch', 'torchvision', ..., 'monai==0.7.0', ..., '--extra-index-url=https://download.pytorch.org/whl/cu118']
else:
  list_libs = [...

pip_install(list_libs)

Since this approach would not allow separate to_install and to_upgrade lists, you'd need to carefully set the version specifiers for each package. For example you could declare monai>=0.7.2,<0.8 - note this example is arbitrary, I'm not sure what the true constraints for this package are.

If an installed package already satisfies the listed constraints, then pip would not change the version. If an installed package doesn't satisfy the constraint, pip will upgrade to the most recent version that does.