Commit 864ae429ca461e960931be701c60287fd1d2228a

Authored by Thiago Franco de Moraes
1 parent 179cf74f
Exists in master

Plaidml was not working when installed in virtualenv on WIndows

Showing 1 changed file with 8 additions and 0 deletions   Show diff stats
invesalius/segmentation/brain/utils.py
... ... @@ -15,6 +15,14 @@ def prepare_plaidml():
15 15 if local_user_plaidml.exists():
16 16 os.environ["RUNFILES_DIR"] = str(local_user_plaidml)
17 17 os.environ["PLAIDML_NATIVE_PATH"] = str(pathlib.Path("/usr/local/lib/libplaidml.dylib").expanduser().absolute())
  18 + elif sys.platform == "win32":
  19 + if 'VIRTUAL_ENV' in os.environ:
  20 + local_user_plaidml = pathlib.Path(os.environ["VIRTUAL_ENV"]).joinpath("share/plaidml")
  21 + plaidml_dll = pathlib.Path(os.environ["VIRTUAL_ENV"]).joinpath("library/bin/plaidml.dll")
  22 + if local_user_plaidml.exists():
  23 + os.environ["RUNFILES_DIR"] = str(local_user_plaidml)
  24 + if plaidml_dll.exists():
  25 + os.environ["PLAIDML_NATIVE_PATH"] = str(plaidml_dll)
18 26  
19 27 def prepare_ambient(backend, device_id, use_gpu):
20 28 if backend.lower() == 'plaidml':
... ...