Search code examples
q#azure-quantum

Microsoft.Quantum.Oracles not found in VS Code in Azure Quantum SDK


My problem is that in Visual Studio Code, using Azure Quantum QDK (Q#) when I try to use Microsoft.Quantum.Oracles, it is not found.


  • I have a Windows 11 machine:
Edition Windows 11 Pro
Version 22H2
OS build    22621.2861
Experience  Windows Feature Experience Pack 1000.22681.1000.0
  • I installed VS Code:
Version: 1.85.2 (user setup)
Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681
Date: 2024-01-18T06:40:10.514Z
Electron: 25.9.7
ElectronBuildId: 26354273
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22621
  • In VS Code, installed Azure Quantum Development Kit (QDK) v1.0.33 extension

  • An easy qs file compiles and runs, but if I'd like to use Microsoft.Quantum.Oracles, compilation failes, although it should be available in the standard library according to Microsoft Q# document about standard library

namespace myTest {
    open Microsoft.Quantum.Math;
    open Microsoft.Quantum.Arrays;
    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;
    open Microsoft.Quantum.Measurement;
    open Microsoft.Quantum.Oracles;

    operation equalTest(elem: String, target: String) : Bool {
        return elem == target;
    }

    ...
 × name error
  ╰─▶ `Microsoft.Quantum.Oracles` not found

Actually, only the followings are available from Microsoft.Quantum:

  • Arrays
  • Cannon
  • Convert
  • Core
  • Diagnistics
  • Intrinsic
  • Math
  • Measurement
  • Random number
  • ResourceEstimation

Any idea what is missing? I spent quite some time with googling and asking Copilot without success.


Solution

  • Is this existing code or an example from somewhere you are trying to use?

    The latest QDK is a complete re-write (see https://devblogs.microsoft.com/qsharp/announcing-v1-0-of-the-azure-quantum-development-kit/ and the prior post it references) and doesn't include all of the libraries and APIs the prior versions did.

    You can see some details about language and API changes at https://github.com/microsoft/qsharp/wiki/Differences-from-the-previous-QDK#standard-library . Per the wiki, if there is a specific API you believe should be added [back], then please log an issue in the repo and provide the details.

    If it is and old project or sample that you don't want to migrate yet, then you can continue to use older versions of the QDK. Though I'd recommend the latest version when possible.

    p.s. Apologies for the outdated docs detailing the old APIs. We'll get those updated.