0

I am trying to set up my Q# environment in VSCode, yet I keep getting an error when running the boilerplate code. I have followed the instruction found here.

The error I am getting is the following:

Unhandled exception: System.DllNotFoundException: Unable to load shared library 'Microsoft.Quantum.Simulator.Runtime' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libMicrosoft.Quantum.Simulator.Runtime, 1): image not found
   at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator.InitNative()
   at Microsoft.Quantum.Simulation.Simulators.QuantumSimulator..ctor(Boolean throwOnReleasingQubitsNotInZeroState, Nullable`1 randomNumberGeneratorSeed, Boolean disableBorrowing)
   at Microsoft.Quantum.EntryPointDriver.Simulation`3.<>c.<Simulate>b__0_0()
   at Microsoft.Quantum.EntryPointDriver.Simulation`3.RunSimulator(TIn input, Func`1 createSimulator)
   at Microsoft.Quantum.EntryPointDriver.Simulation`3.Simulate(IEntryPoint entryPoint, TIn input, DriverSettings settings, String simulator)
   at System.CommandLine.Invocation.CommandHandler.GetResultCodeAsync(Object value, InvocationContext context)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__20_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass24_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__21_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseExceptionHandler>b__0>d.MoveNext()

[Done] exited with code=1 in 33.812 seconds

What could be the cause of this error? I've tried to find a solution online, but to no avail.

UPD: When I change the SDK version in my .csproj file from 0.28.263081 to some older ones (like 0.26.233415) the script runs just fine. I tried running

dotnet add package Microsoft.Quantum.Sdk --version 0.28.263081

but the error still remains. When I try to use Q# with Python I still get the same error because I haven't found a way to set a specific SDK version in Python. Preferably I would like a fix that allows me to use the latest version but a workaround that would allow me to run Python + Q# even in an older version would also be valuable.

Giorgos Giapitzakis
  • 628
  • 1
  • 4
  • 19

0 Answers0