qupath / qupath-extension-djl

A QuPath extension for working with Deep Java Library (https://djl.ai)
Apache License 2.0
5 stars 4 forks source link

Cannot install Pytorch #17

Open lacan opened 6 months ago

lacan commented 6 months ago

This is related to the same issue as https://github.com/qupath/qupath-extension-wsinfer/issues/54

On a Win11 machine, with QuPath 0.5.0 I cannot install pytorch due to a java.nio.file.AccessDeniedException

I tried running QuPath as a standard user or as an administrator, with no success...

Unable to get engine PyTorch: Failed to download PyTorch native library
ai.djl.engine.EngineException: Failed to download PyTorch native library
    at ai.djl.pytorch.jni.LibUtils.downloadPyTorch(LibUtils.java:481)
    at ai.djl.pytorch.jni.LibUtils.findNativeLibrary(LibUtils.java:292)
    at ai.djl.pytorch.jni.LibUtils.getLibTorch(LibUtils.java:92)
    at ai.djl.pytorch.jni.LibUtils.loadLibrary(LibUtils.java:80)
    at ai.djl.pytorch.engine.PtEngine.newInstance(PtEngine.java:53)
    at ai.djl.pytorch.engine.PtEngineProvider.getEngine(PtEngineProvider.java:40)
    at ai.djl.engine.Engine.getEngine(Engine.java:190)
    at qupath.ext.djl.DjlTools.getEngine(DjlTools.java:255)
    at qupath.ext.djl.ui.DjlEngineCommand.checkEngineAvailability(DjlEngineCommand.java:403)
    at qupath.ext.djl.ui.DjlEngineCommand.lambda$checkEngineStatus$7(DjlEngineCommand.java:341)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.nio.file.AccessDeniedException: C:\Users\oburri\.djl.ai\pytorch\tmp8073059371695128563 -> C:\Users\oburri\.djl.ai\pytorch\2.0.1-cpu-win-x86_64
    at java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
    at java.base/sun.nio.fs.WindowsFileCopy.move(Unknown Source)
    at java.base/sun.nio.fs.WindowsFileSystemProvider.move(Unknown Source)
    at java.base/java.nio.file.Files.move(Unknown Source)
    at ai.djl.util.Utils.moveQuietly(Utils.java:132)
    at ai.djl.pytorch.jni.LibUtils.downloadPyTorch(LibUtils.java:478)
    ... 13 more

Any help is appreciated

alanocallaghan commented 4 months ago

Sorry Oli, missed this issue when you reported it. I can't reproduce on Win10 nor Win11, and my only suggestions would've been to try changing the permissions on the folder, try elevated permissions, or try a different folder.