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.

Error on dotnet iqsharp install

See original GitHub issue

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!

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
cgranadecommented, Feb 13, 2021

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.

0reactions
LM726commented, Dec 31, 2021

Very sorry for the even longer response time. I didnt log on github for a while. I have changed computers since and I dont need qsharp at the moment, so I wont try to reinstall it.

Nevertheless, thanks for all your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error installing iqsharp kernel · Issue #14
Typically, when you run a global tool using syntax like dotnet iqsharp , that looks for a dotnet-iqsharp executable. Can you run dotnet-iqsharp...
Read more >
dotnet iqsharp install gives error "FileNotFoundError
Quantum.IQSharp , close and re-open your command prompt, and run dotnet iqsharp install again?
Read more >
python - Jupyter Notebook not finding IQSharp
First, make sure iqsharp is installed. Run dotnet iqsharp --version to ensure that the tool exists. If not, run dotnet tool install -g...
Read more >
Set up the Quantum Development Kit - Azure Quantum
If you encounter a permission error in Linux, install the IQ# kernel in user mode instead with dotnet iqsharp install --user .
Read more >
Installation instructions for Windows. Anaconda
2. In the command prompt (or Anaconda command Prompt) type: pip install qsharp dotnet tool install -g Microsoft.Quantum.IQSharp dotnet iqsharp install.
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