iqsharp: Error on dotnet iqsharp install

I am a newbie, so bear with me. I couldn’t get Q# to work using purely VS Code, as I was told by my tutorial. So, I wanted to install the python package and run my Hello World program that way, but it just gave a ModuleNotFoundError for from QuantumHello import SayHello.

Then I tried this python program for debugging: import qsharp qsharp.reload() print(qsharp.get_available_operations()) I started it using anaconda in the qsharp environment: (qsharp-env) C:\Users\User>python C:\Users\User\Documents\Q#\QH\start.py {'text/plain': 'Reloading workspace.', 'application/json': '{"LastUpdated":"2021-02-12T22:49:14.0484048+01:00","IsCompleted":false,"Description":"Reloading workspace","Subtask":null}'} []

Then I read somewhere I needed the dotnet iqsharp package too and this seemed reasonable enough, as python did not seem to recognize my qs-file I placed in the same folder. I then ran dotnet tool install -g Microsoft.Quantum.IQSharp and then wanted to proceed by running dotnet iqsharp install, but I got this error: System.ComponentModel.Win32Exception (5): Zugriff verweigert ("Access denied" in German) at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at Microsoft.DotNet.Cli.Utils.Command.Execute(Action1 processStarted) at Microsoft.DotNet.Cli.Utils.Command.Execute() at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient) at Microsoft.DotNet.Cli.Program.Main(String[] args)

The same error occurs if trying to run dotnet iqsharp --version or any other dotnet iqsharp-command. I even tried repairing dotnet and rerunning dotnet tool install -g Microsoft.Quantum.IQSharp, but that changed nothing.

When I tried to run a command starting with dotnet-iqsharp it only returned Zugriff verweigert (Access denied).

I dont know what I’ve been doing wrong and if I’ve been soing something wrong, but I hope someone here can help me. Thank you in advance!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

First of all, I have changed Q# to QSharp in the path. Unfortunately, that does not appear to be the problem.

I have two files in my folder, this is what they look like at the moment:

Operation.qs:

namespace QuantumHello {
    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;

    @EntryPoint
    operation SayHello() : Unit {
        Message("Hello quantum world!");
    }
}

One thing to note is that EntryPoint needs to have () following it:

namespace QuantumHello {
    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;

    @EntryPoint()
    operation SayHello() : Unit {
        Message("Hello quantum world!");
    }
}

When I execute the python file from the anaconda console, I get this error I mentioned previously:

(qsharp-env) C:\Users\Lenna>python C:\Users\Lenna\Documents\QSharp\QH\start.py
Traceback (most recent call last):
  File "C:\Users\User\Documents\QSharp\QH\start.py", line 2, in <module>
    from QuantumHello import SayHello
ModuleNotFoundError: No module named 'QuantumHello'

That’s what I would expect if there was an error compiling your Q# workspace; can you share the output from qsharp.reload? That should show what error is causing QuantumHello.SayHello to not be available.