I am trying new Q# language on a Windows 10 machine.
I have three Windows 10 machines, all of them have WSL (Ubuntu).
Out of three, two were able to install latest .NET Core SDK and run Q#
code
as it is executed natively on Windows.
However, third machine fails to run (but compiles perfectly).
Somehow, installation of SDK is being corrupted and I get Runtime Exceptions at the moment C#
code calls methods from Microsoft.Quantum.*
.
I tried to reinstall Ubuntu WSL (clean), but the problem is still there.
It has something to do with the fact that on this machine the WSL lives since preview and before it was shipped to Win Store.
For the sake of experiment I downloaded Debian (from the Store), installed only .NET SDK and Q#
code worked fine.
Now the question is how can I PURGE the legacy Ubunut WSL and get a fresh install on that particular machine?
This is the output generated by the WSL on the dotnet run
command
Unhandled Exception: System.DllNotFoundException: Unable to load DLL
'Microsoft.Quantum.Simulator.Runtime.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.Init()
at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator..ctor(Boolean
throwOnReleasingQubitsNotInZeroState, Nullable`1 randomNumberGeneratorSeed,
Boolean disableBorrowing)
at Bell.Driver.Test_Simple() in
/mnt/c/Users/.../Programming/Temp/QS/Bell/Driver.cs:line 26
at Bell.Driver.Main(String[] args) in
/mnt/c/Users/.../Programming/Temp/QS/Bell/Driver.cs:line 12
This is the method from which I call Q#
-related code
private static void Test_Simple()
{
WriteLine($"\r\n{nameof(Test_Simple)}");
var header = $"{"Initial", -10}|{Result.Zero, -10}|{Result.One, -10}|";
WriteLine(new string('-', header.Length));
WriteLine(header);
WriteLine(new string('-', header.Length));
// --> Exception is thrown here <--
using (var simulator = new QuantumSimulator())
{
var nRuns = 10_000;
var initials = new [] { Result.Zero, Result.One };
foreach (var init in initials)
{
var (nZero, nOne) =
Quantum.BellTestSimple.Run(simulator, nRuns, init).Result;
WriteLine($"{init, -10}|{nZero, -10}|{nOne, -10}");
}
}
}
This exact same project runs fine on the same machine natively and on Debian subsystem, but fails on Ubuntu subsytem.
It may be that you are missing native libraries that the Microsoft.Quantum.Simulator.Runtime.dll
library depends on. Other users have reported, for instance, that they were missing libgomp1. To check if you have all of the dependencies you need, you can use ldd
to get a report of how each native runtime dependency is resolved. For instance:
$ ldd ~/.nuget/packages/microsoft.quantum.development.kit/0.2.1802.2202-preview/runtimes/linux-x64/native/Microsoft.Quantum.Simulator.Runtime.dll
linux-vdso.so.1 => (0x00007fffc4fab000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1d692d0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1d68fc0000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f1d68d80000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1d689b0000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1d69a00000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1d68790000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1d68570000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1d68350000)
This snippet shows us that libgomp.so.1
was successfully resolved to /usr/lib/x86_64-linux-gnu/libgomp.so.1
, whereas if that library were missing you'd get a different listing:
$ ldd ~/.nuget/packages/microsoft.quantum.development.kit/0.2.1802.2202-preview/runtimes/linux-x64/native/Microsoft.Quantum.Simulator.Runtime.dll
linux-vdso.so.1 => (0x00007fffc5103000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f713cfd0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f713ccc0000)
libgomp.so.1 => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f713c8e0000)
/lib64/ld-linux-x86-64.so.2 (0x00007f713d600000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f713c6c0000)
User contributions licensed under CC BY-SA 3.0