question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DLL loading issue

See original GitHub issue

I have a following script:

#r "nuget: libtorch-cpu, 1.8.0.7"
#r "nuget: TorchSharp, 0.91.52604"

open TorchSharp

[<AutoOpen>]
module Helpers = 
    let inline fscalar x = TorchScalar.op_Implicit (float32 x)

let torch_pi = fscalar 3.14

printfn $"{torch_pi.ToDouble()}"

Without explicitly configured LD_LIBRARY_PATH I get

#> dotnet fsi test.fsx 
System.DllNotFoundException: Unable to load shared library 'LibTorchSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libLibTorchSharp: cannot open shared object file: No such file or directory
   at TorchSharp.ScalarExtensionMethods.THSTorch_float32_to_scalar(Single value)
   at TorchSharp.ScalarExtensionMethods.ToScalar(Single value)
   at TorchSharp.TorchScalar.op_Implicit(Single value)
   at <StartupCode$FSI_0002>.$FSI_0002.main@()
Stopped due to error

…but with explicit paths, it works as expected:

#> LD_LIBRARY_PATH=/home/peter/.nuget/packages/libtorch-cpu/1.8.0.7/runtimes/linux-x64/native/ dotnet fsi test.fsx 
3.140000104904175

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
NiklasGustafssoncommented, Jun 10, 2021

I’ve submitted a PR for the fix to this problem. Most factories already had the initialization logic, but ToScalar() and the from() variant that takes a list of .NET scalars did not.

0reactions
pkesecommented, Jun 5, 2021

Yes. Sorry, I removed that comment because it didn’t add anything new to discussion.
Above, you already said: “before all tensor and scalar creation routines”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Methods to Fix Error in Loading DLL at Startup
Part 1. How to Fix Error in loading DLL at Startup · Solution 1: Reinstall the program · Solution 2: Clear and repair...
Read more >
Error in loading DLL when using Access wizard
Cause. This problem may occur if you have missing Microsoft Data Access Components (MDAC) files, corrupted MDAC files, or outdated MDAC files on ......
Read more >
Access Database Error in Loading DLL – Easy Solutions
How to Fix Access Database 'Error in Loading DLL'? · Solution 1: Try Registering the Dao360 and Msado15 DLL Files · Solution 2:...
Read more >
System DLL 'dll' could not be loaded (Error 298)
The file isn't on the proper path. Ensure the DLL is on the Windows System path. · The DLL is corrupted or was...
Read more >
Failed to load DLL file on Windows 11/10 computer
Failed to load DLL file on Windows · 1] Reinstall the program. Reinstall the program which is throwing this error. · 2] Check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found