Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Error with standalone opens in Q# notebooks #15

Closed
crazy4pi314 opened this issue Mar 30, 2019 · 3 comments · Fixed by #204
Closed

Error with standalone opens in Q# notebooks #15

crazy4pi314 opened this issue Mar 30, 2019 · 3 comments · Fixed by #204
Assignees
Labels
Area-Kernel Issue relates to the IQ# kernel. Kind-Bug Something isn't working Kind-Enhancement New feature or request

Comments

@crazy4pi314
Copy link
Contributor

I am super stoked about Q# notebooks, thanks for doing this! 😍

I was just trying out some of the snippets from the Intro To IQSharp notebook and found something I think might be a bug. If you use any open statement in a cell by itself, it returns the following error message: The given key was not present in the dictionary.. It seems to work fine if other operations are in the cell with it, even if they do not use anything from the open. I have included a screencap as well as code snippets and the %version from the notebook.
Thanks!
Sarah

Component Version
iqsharp 0.5.1903.2902
Jupyter Core 1.1.12077.0
open Microsoft.Quantum.Extensions.Math;
The given key was not present in the dictionary.
open Microsoft.Quantum.Extensions.Diagnostics;
The given key was not present in the dictionary.
open Microsoft.Quantum.Extensions.Math;
​
//operation HelloPi() : Unit {
//    let pi = Microsoft.Quantum.Extensions.Convert.ToStringD(PI());
//    HelloQ(pi);
//}
The given key was not present in the dictionary.
open Microsoft.Quantum.Extensions.Math;
​
operation HelloPi() : Unit {
    let pi = Microsoft.Quantum.Extensions.Convert.ToStringD(PI());
    HelloQ(pi);
}
HelloPi
open Microsoft.Quantum.Extensions.Math;
​
operation HelloPi() : Unit {
}
HelloPi

image

@bookRa
Copy link

bookRa commented May 17, 2019

I, too am having problems opening one Microsoft.Quantum namespace per code cell as mentioned in IntroToIQSharp/Notebook.ipynb .
Getting the same errors as @crazy4pi314 above.
Some more info:

➜  ~ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.107
 Commit:    2212cac826

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.2.107/

Host (useful for support):
  Version: 2.2.5
  Commit:  0a3c9209c0

.NET Core SDKs installed:
  2.2.107 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Any help would be appreciated. Thanks

-Edit- Also this might be related?
image

@tcNickolas
Copy link
Member

I agree, it would be extremely helpful to be able to open namespaces once in the beginning of the notebook and never return to this again, like we do in projects. In the notebook katas it is particularly painful - it is very hard for the learner to figure out that they need to open namespace in each cell, especially since the reference solutions in the project don't have this need.

@cgranade cgranade transferred this issue from microsoft/Quantum Jul 11, 2019
@cgranade cgranade added Area-Kernel Issue relates to the IQ# kernel. Kind-Bug Something isn't working Kind-Enhancement New feature or request labels Jul 11, 2019
@crazy4pi314
Copy link
Contributor Author

Wanted to bump this again, I really want using Q# in Jupyter to be a good platform for teaching. I am working on lots of notebooks with library use and it is super annoying to have to open the namespaces for each in every cell. If students have any experience with notebooks, its likely in Python where you can just have one cell with imports at the beginning. Not using this same model introduces a lot of confusion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area-Kernel Issue relates to the IQ# kernel. Kind-Bug Something isn't working Kind-Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants