Giter Club home page Giter Club logo

iqsharp's Introduction

DEPRECATION NOTICE

This repository is deprecated.

For the Modern QDK repository, please visit Microsoft/qsharp.

You can also try out the Modern QDK in VS Code for Web at vscode.dev/quantum.

For more information about the Modern QDK and Azure Quantum, visit https://aka.ms/AQ/Documentation.

Classic QDK

This repository contains the IQ# kernel for the Quantum Development Kit. This kernel provides Q# support for the Jupyter platform, as well as the backend used by the Python client for Q#.

  • src/Core/: Core of the IQ# kernel.
  • src/Kernel/: Assembly used to interoperate between Jupyter and the rest of the IQ# kernel.
  • src/Python/: Python package for accessing IQ#.
  • src/Tests/: Unit tests for IQ#.
  • src/Tool/: .NET Global Tool used to install and launch IQ#.
  • src/Web/: Provides a RESTful API into IQ#.

New to Quantum?

See the introduction to quantum computing provided with the Quantum Development Kit.

Getting Started

The Jupyter kernel provided in this repository is built using .NET 6.0 and the compiler infrastructure provided with the Quantum Development Kit. Please see the getting started guide for how to get up and running.

You may also visit the microsoft/quantum repository, which offers a wide variety of samples on how to use this kernel to run Q# in Jupyter Notebooks, or from Python.

Building IQ# from Source

To obtain prerequisites, ensure that Node.js is installed, and then run npm install from the src/Kernel/ folder:

cd src/Kernel/
npm install

To build IQ# from Visual Studio 2017 or later, please use the iqsharp.sln solution file. To build using the .NET SDK, please run dotnet build iqsharp.sln.

In either case, the IQ# kernel can be installed by using dotnet run:

cd src/Tool/
dotnet run -- install

Optionally, you can install IQ# in development mode, which instructs the Jupyter platform to rebuild IQ# whenever a new kernel is started:

cd src/Tool/
dotnet run -- install --develop

This can cause some issues, especially when running multiple instances of IQ#, such that we recommend against using development mode in general usage.

Note that when building IQ# from source, this repository is configured so that .NET will automatically look at the Quantum Development Kit prerelease feed in addition to any other feeds you may have configured.

Using IQ# as a Container

This repository provides a Dockerfile that includes the .NET SDK, Python, Jupyter Notebook, and the IQ# kernel.

The image built from this Dockerfile is hosted on the Microsoft Container Registry as the quantum/iqsharp-base repository. The iqsharp-base image can be used, for instance, to quickly enable using Binder with Q#-language repositories, or as a base image for Visual Studio Code Development Containers.

To use the iqsharp-base image in your own Dockerfile, make sure to begin your Dockerfile with a FROM line that points to the Microsoft Container Registry:

FROM mcr.microsoft.com/quantum/iqsharp-base:latest

To use the iqsharp-base image as a development container for Visual Studio Code, add a .devcontainer folder that points to the Microsoft Container Registry:

{
    "image": "mcr.microsoft.com/quantum/iqsharp-base:latest",
    "extensions": [
        "quantum.quantum-devkit-vscode",
        "ms-vscode.csharp"
    ]
}

In either case, you can also use a Quantum Development Kit version number (0.8 or later) in place of latest to point to a specific version.

Build Status

branch status
main Build Status

Feedback

If you have feedback about IQ#, please let us know by filing a new issue! If you have feedback about some other part of the Microsoft Quantum Development Kit, please see the contribution guide for more information.

Legal and Licensing

Telemetry

By default, IQ# collects information about the runtime performance of IQ#. To opt-out of sending telemetry, create an environment variable called IQSHARP_TELEMETRY_OPT_OUT set to a value of 1 before starting IQ#. The telemetry we collect falls under the Microsoft Privacy Statement.

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

For more details, please see CONTRIBUTING.md, or the contribution guide.

iqsharp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iqsharp's Issues

Azure Functions: Exception: (jupyter) NoSuchKernel: No such kernel named iqsharp

As the first step in my project, I'm trying to run the Q# HelloWorld sample to verify that I have basic Q# functionality in my Azure Function running in a docker container with linux on Azure. (While I'm not new to Q#, this is the first time I've used Azure Functions so the chance for user error is high.)

Running in Azure, when MyHttpTrigger is called an exception is thrown when jupyter cannot find the iqsharp kernel:

Exception: NoSuchKernel: No such kernel named iqsharp
...
 File "/home/site/wwwroot/MyHttpTrigger/__init__.py", line 3, in <module>
    import qsharp
 File "/usr/local/lib/python3.7/site-packages/qsharp/__init__.py", line 119, in <module>
    client = _start_client()
  File "/usr/local/lib/python3.7/site-packages/qsharp/clients/__init__.py", line 28, in _start_client
    client.start()
...

Expected behavior
It is expected that the qsharp initialization would succeed. Perhaps I don't have an ENV var set correctly?

dockerfile
This is the dockerfile used to build the docker image.

FROM mcr.microsoft.com/quantum/iqsharp-base:latest

USER root
RUN dotnet iqsharp install

FROM mcr.microsoft.com/azure-functions/python:2.0-python3.7

COPY requirements.txt /
RUN pip install -r /requirements.txt

When RUN dotnet iqsharp install is executed above during docker build, this message is displayed:
[InstallKernelSpec] Installed kernelspec iqsharp in /usr/local/share/jupyter/kernels/iqsharp

I verified that the iqsharp kernel is indeed in /usr/local/share/jupyter/kernels/ I had to use USER root prior to the call because previously I was getting access denied when running dotnet iqsharp install.

Thanks for your help.

Allow configuration of DumpMachine output format from IQ# and Python

Is your feature request related to a problem? Please describe.
The new DumpMachine outputs (visual version in Q# Notebooks and different text version in Python-driven invocations) look really neat, but the difference of formats across different mediums can be confusing. It can also cause issues if any automated tools or any educational content rely on the specific output format.

Describe the solution you'd like

  1. It would be great to document the different available formats of the output at https://docs.microsoft.com/quantum.
  2. If would be great to make different formats configurable from the user interface (for example, so that a Q# Notebook user can choose whether they want a visual format, a neat text format or an old-style text format). I believe some parts of the output are already configurable (such as little endian vs big endian vs bit string), but it's really hard to discover that without documentation.
  3. It would also be helpful to keep numeric representation of state phase (possibly also configurable) - arrows look nice but without the base information about which direction corresponds to what phase they are less informative than I'd like them to be.

Intellisense in notebook cells

Is your feature request related to a problem? Please describe.
I do a lot of development and exploration in the Q# notebooks and the editing/writing experience is sad compared to the great intellisense in other IDEs like VS Code and VS.

Describe the solution you'd like
I would love to have those same (or some subset of) features that we have in the IDEs in the notebook cells as well.

Describe alternatives you've considered
I sometimes will just write all the code in separate Q# files alongside the notebook and constantly reload from there, but that is not ideal.

Additional context
The intellesense features are so great, I really want them where I am working <3

Metadata in autogenerated docs cause warnings

Describe the bug
As noted in MicrosoftDocs/quantum-docs-pr#805, the autogenerated IQ# docs cause some warnings about metadata. While these warnings don't adversely affect renderings, we should probably make sure to fix them if only to reduce noise in documentation builds.

To Reproduce
Steps to reproduce the behavior:

  1. Build documentation using the build_docs.py script in this repo.
  2. Upload docs to MicrosoftDocs/quantum-docs-pr via a PR.

Expected behavior
Documentation PR completes without warnings.

Screenshots

image

Warnings for already open namespaces in cell

Describe the bug
When opening namespaces in Q# Jupyter notebooks, sometimes you get warnings that namespaces are already open. In particular this holds for the Microsoft.Quantum.Canon and the Microsoft.Quantum.Intrinsic namespaces which are probably already opened by some other process.

To Reproduce
Steps to reproduce the behavior:

  1. Open a Q# Jupyter notebook.
  2. Run the following code:
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Diagnostics;

The Diagnostics namespace is included to show you don't get a warning opening that namespace. You should get the following warning messages:

/snippet_.qs(1,90): warning QS6003: The namespace is already open.
/snippet_.qs(2,6): warning QS6003: The namespace is already open.

Expected behavior
I would expect this to either not have any message if they are already open, or to make you to open them and not have namespaces opened with out a user explicitly asking for them.

Screenshots
You can see the warnings that result here, and I included opening the diagnostic namespace to show no other warnings occur from opening that one.
image

System information
This can be reproduced in the current Q# kernel found at aka.ms/try-qsharp
image

`qsharp.compile` not returning callables in the same order

Describe the bug
The compile function provided by the qsharp package seems to be alphabetizing the callables it returns, which doesn't always match the order in which they are provided in the string argument to compile.

To Reproduce
Steps to reproduce the behavior:

  1. Open a Python Jupyter notebook in an environment/system that has the pre-requisites for the qsharp package installed. (included my environment.yml below)
  2. Run the following code in the first cell:
import qsharp

[zaz, alpha, foo] = qsharp.compile(
"""
operation Zaz() : Unit {
    Message("Zaz");
}
operation Alpha() : Unit {
    Message("Alpha");
}
operation Foo() : Unit {
    Message("Foo");
}
"""
)
  1. Once that has run, check to see what python has stored for the output of the compile by running the following:
[zaz, alpha, foo]

What you will see is that the compile operation changed the order of the callables that it returned such that the python variable names do not match the callables they represent.

Expected behavior
I expect the callables to be returned from the compile step in the same order they were written in the code snippet argument to qsharp.compile.

Screenshots
image

System information

  • OS: Windows 10
{'iqsharp': LooseVersion ('0.10.2002.2610'),
 'Jupyter Core': LooseVersion ('1.2.36563.0'),
 '.NET Runtime': LooseVersion ('.NETCoreApp,Version=v3.0'),
 'qsharp': LooseVersion ('0.11.2004.2825')}

Additional context
The conda environment below is where I was testing this:

name: bug-report
channels:
- conda-forge
dependencies:
- notebook
- numpy
- scipy
- qutip
- matplotlib
- pip
- pip:
    - qsharp

Unclean exit from ipython on MacOS

Describe the bug

Hi, I have installed the qsharp package as described here: https://docs.microsoft.com/en-us/quantum/install-guide/python?view=qsharp-preview and have successfully run the Python examples given on my machine in an IPython environment. Hoewever, on exit I receive the following traceback:

Exception ignored in: <function Socket.__del__ at 0x1041b4290>
Traceback (most recent call last):
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/socket.py", line 67, in __del__
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/socket.py", line 105, in close
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/context.py", line 153, in _rm_socket
TypeError: 'NoneType' object is not callable
Exception ignored in: <function Socket.__del__ at 0x1041b4290>
Traceback (most recent call last):
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/socket.py", line 67, in __del__
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/socket.py", line 105, in close
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/context.py", line 153, in _rm_socket
TypeError: 'NoneType' object is not callable
Exception ignored in: <function Socket.__del__ at 0x1041b4290>
Traceback (most recent call last):
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/socket.py", line 67, in __del__
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/socket.py", line 105, in close
  File "/Users/mlxd/qstmp/qs_conda/envs/qs_env/lib/python3.7/site-packages/zmq/sugar/context.py", line 153, in _rm_socket
TypeError: 'NoneType' object is not callable

To Reproduce
To attempt to rule out my python environment, I set up a clean miniconda build and ran the example from there:

cd ~ && mkdir qstmp && cd qstmp
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
chmod +x ./Miniconda3-latest-MacOSX-x86_64.sh
./Miniconda3-latest-MacOSX-x86_64.sh -b -p ./qs_conda
source ./qs_conda/bin/activate ;
conda create -n qs_env -y python
conda activate qs_env
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install
dotnet iqsharp --version
dotnet tool update -g Microsoft.Quantum.IQSharp
pip install qsharp --upgrade
conda install ipython -y
ipython -c "import qsharp"

The result was as listed above. Running ipython -c "import zmq" gave no output.

Expected behavior
There should be no output/traceback from importing the qsharp module and exiting.

System information

  • OS: MacOS 10.14.6
  • iqsharp: 0.9.1908.2906
  • Jupyter Core: 1.1.14623.0

If I can give any more input, feel free to let me know.

Thanks,
Lee.

dotnet iqsharp install fails to install on 5.0.100-preview.3.20216.6

Describe the bug
dotnet iqsharp install and dotnet-iqsharp fails to install on 5.0.0-preview.3.20215.14

To Reproduce

(jp) [sharpuser@localhost dotnet_install]$ dotnet tool install -g Microsoft.Quantum.IQSharp

Welcome to .NET 5.0!
---------------------
SDK Version: 5.0.100-preview.3.20216.6

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. The data is anonymous. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Since you just installed the .NET SDK, you will need to logout or restart your session before running the tool you installed.
You can invoke the tool using the following command: dotnet-iqsharp
Tool 'microsoft.quantum.iqsharp' (version '0.11.2004.2825') was successfully installed.
(jp) [sharpuser@localhost dotnet_install]$ logout
Connection to 127.0.0.1 closed.
PS C:\Users\sharpuser> ssh -p 2222 [email protected]
[email protected]'s password:
Last login: Sat May 16 13:30:09 2020 from 10.0.2.2
[sharpuser@localhost ~]$ conda activate jp
(jp) [centy@localhost ~]$ dotnet-iqsharp
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found.
  - The following frameworks were found:
      5.0.0-preview.3.20215.14 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=x64&rid=centos.8-x64

(jp) [sharpuser@localhost ~]$ dotnet iqsharp install
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found.
  - The following frameworks were found:
      5.0.0-preview.3.20215.14 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=x64&rid=centos.8-x64

Expected behavior
It should install as the docs https://docs.microsoft.com/en-us/quantum/install-guide/qjupyter say .NET Core SDK 3.1 or later

Screenshots
If applicable, add screenshots to help explain your problem.

System information

(jp) [sharpuser@localhost ~]$ uname -a
Linux localhost.localdomain 4.18.0-147.8.1.el8_1.x86_64 #1 SMP Thu Apr 9 13:49:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

(jp) [sharpuser@localhost ~]$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   5.0.100-preview.3.20216.6
 Commit:    9f62a32109

Runtime Environment:
 OS Name:     centos
 OS Version:  8
 OS Platform: Linux
 RID:         centos.8-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.100-preview.3.20216.6/

Host (useful for support):
  Version: 5.0.0-preview.3.20214.6
  Commit:  b037784658

.NET SDKs installed:
  5.0.100-preview.3.20216.6 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.0-preview.3.20215.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.0-preview.3.20214.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

Additional context

I cannot install iqsharp.

I am using visual studio code (python) and have the necessary .NET installed (3.0) and I have installed the Quantum tool but when i get to the next line: dotnet iqsharp install, I obtain the following error:

Traceback (most recent call last):
File "c:\users\michael m harmse\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\michael m harmse\appdata\local\programs\python\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Michael M Harmse\AppData\Local\Programs\Python\Python37\Scripts\jupyter.exe_main
.py", line 7, in
File "c:\users\michael m harmse\appdata\local\programs\python\python37\lib\site-packages\jupyter_core\command.py", line 247, in main
command = _jupyter_abspath(subcommand)
File "c:\users\michael m harmse\appdata\local\programs\python\python37\lib\site-packages\jupyter_core\command.py", line 134, in _jupyter_abspath
'Jupyter command {} not found.'.format(jupyter_subcommand)
Exception: Jupyter command jupyter-kernelspec not found.

Error installing iqsharp kernel

I'm trying to follow the guidelines mentioned in https://docs.microsoft.com/en-us/quantum/install-guide/python?view=qsharp-preview to install the iqsharp kernel, but I get a No executable found matching command "dotnet-install" when installing it (using dotnet iqsharp install).

ayush99@ayush99:~/quant$ dotnet tool install -g Microsoft.Quantum.IQSharp
Tool 'microsoft.quantum.iqsharp' is already installed.
ayush99@ayush99:~/quant$ dotnet install iqsharp
No executable found matching command "dotnet-install"

Expose Chemistry library to Python

The chemistry library is not available to use from Python due to the inability to load broombridge schema and/or do JordanWigner encoding from the FerminonHamiltonian.

Need work to make this avaialble on our IQ# kernel and expose it as a submodule on the qsharp package.

Error trying to invoke Q# operation from Python file.

Describe the bug
Calling an 'Operation.qs' from a host python program in the same folder fails with the following error:

Preparing Q# environment...
fail: Microsoft.Quantum.IQSharp.Workspace[0]
QS5022: No identifier with that name exists.

Same files and same folder were working correctly on the same computer. Weirdly, they don't work now.

System information

  • OS: Windows 10
  • Python 3.7.4 (64bit)
  • Version: 10.0.17763

IQ# kernel fails to start when "Application Data" folder is inaccessible

Originally opened by @n33r4j:

I recently updated my iqsharp(from 0.10 to 0.11) for jupyter notebooks (via Anaconda) and ever since, the Q# kernel stopped connecting when I open a new or existing Q# notebook(Python works fine). I have tried uninstalling and reinstalling jupyter notebook as well as iqsharp but nothing seems to have changed.
I think it may have something to do with "Access to the path 'C:\Users\neera\Application Data' is denied".

No such kernel named iqsharp

Describe the bug
Python is unable to run commands after import qsharp, probably because the attempt to dot iqsharp install from the command line failed (see Screenshot 1)

I suspect there is some jupyter configuration error.

To Reproduce
Following the instructions on Develop with Q# and Python:

  1. Freshly install prerequisites
    i. python & pip, .NET Core 3.1 SDK (v3.1.101) - Windows x64
  2. Install qsharp
    i. py -m pip install qsharp
  3. Successfully install Microsoft.Quantum.IQSharp
  4. Fail on dotnet iqsharp install
  5. Fail on python Hello World

Expected behavior
I expected no errors to be raised. Also, the Hello World application in Develop with Q# and Python should have successfully output. Instead, iqsharp was not found, as seen in Screenshot 2.

The screenshot errors still occurs even if py -m pip install jupyter is run successfully.

Screenshots

image

[ERROR] Could not install iqsharp into your Jupyter configuration, as jupyter was not found on your PATH. Please make sure that Jupyter is installed and is on your PATH. If you are using conda or venv, please make sure that you have the correct environment activated.

Full exception details:
System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.Jupyter.Core.KernelApplication.InstallKernelSpec(Boolean develop, LogLevel logLevel, String prefix, IEnumerable1 extraInstallArgs, IDictionary2 additionalFiles, IEnumerable`1 additionalKernelArguments, String pathToTool)

Screenshot 2
image

Traceback (most recent call last):
  File "hii.py", line 3, in <module>
    import qsharp
  File "C:\Users\Juucation\AppData\Local\Programs\Python\Python38\lib\site-packages\qsharp\__init__.py", line 119, in <module>
    client = _start_client()
  File "C:\Users\Juucation\AppData\Local\Programs\Python\Python38\lib\site-packages\qsharp\clients\__init__.py", line 28, in _start_client
    client.start()
  File "C:\Users\Juucation\AppData\Local\Programs\Python\Python38\lib\site-packages\qsharp\clients\iqsharp.py", line 75, in start
    self.kernel_manager.start_kernel(extra_arguments=["--user-agent", f"qsharp.py{user_agent_extra}"])
  File "C:\Users\Juucation\AppData\Local\Programs\Python\Python38\lib\site-packages\jupyter_client\manager.py", line 246, in start_kernel
    kernel_cmd = self.format_kernel_cmd(extra_arguments=extra_arguments)
  File "C:\Users\Juucation\AppData\Local\Programs\Python\Python38\lib\site-packages\jupyter_client\manager.py", line 170, in format_kernel_cmd
    cmd = self.kernel_spec.argv + extra_arguments
  File "C:\Users\Juucation\AppData\Local\Programs\Python\Python38\lib\site-packages\jupyter_client\manager.py", line 82, in kernel_spec
    self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name)
  File "C:\Users\Juucation\AppData\Local\Programs\Python\Python38\lib\site-packages\jupyter_client\kernelspec.py", line 236, in get_kernel_spec
    raise NoSuchKernel(kernel_name)
jupyter_client.kernelspec.NoSuchKernel: No such kernel named iqsharp

System information

  • OS: Windows 10

Additional context
Problem likely unrelated to microsoft/Quantum#176, as there is no space in my username

Swagger / Swashbuckle for HTTP API

The HTTP API could have a pretty UI. Developers would be able to manually test the different available methods quite easily through a single interface rather than reading controller code. Could foster more interoperability projects and generally make the server easier to use.

We could use swagger / swashbuckle to automatically generate this interface. It might look something like this in case you are not familiar with swagger: https://petstore.swagger.io/

I wouldn't want to pollute your solution but this is probably something I'll add for myself anyway - let me know if you think it would be useful.

Support passing NumPy arrays from Python host library

Often times, it will be convienent for Q# operations called from Python to directly accept NumPy arrays as input. While this doesn't confer any performance advantage, given the serialization to JSON and back, it is a significant enough usability improvement that it might be worth adopting.

iqsharp install seems to copy entire drive

when running the command

dotnet iqsharp install

it seems to cosume all avilable diskspace
upon inspection it copies the entire user home directory to
C:\Users\A User\AppData\Roaming\jupyter\kernels\iqsharp

i.e. C:\Users\A User\ is copied into C:\Users\A User\AppData\Roaming\jupyter\kernels\iqsharp

Can't install iqsharp if user's home directory has spaces

Arguably this is not a bug but a limitation that would not be encountered if best practices were followed (i.e. not creating users, or in fact any filenames, with spaces in them). If so, let us know and we can document this behavior.

Describe the bug
When there are spaces in the user's home directory iqsharp cannot be installed, giving errors like the ones shown in this ticket:

MicrosoftDocs/quantum-docs-pr#617

I reproduced the error on a Windows 10 machine, with a user with spaces in the name.

To Reproduce

Problem

My Windows10 account folder name is 'C:\Users\Sirius B'.
But when I install it (dotnet iqsharp install), it doesn't recognize 'C:\Users\Sirius B', but it tries to recognize 'C:\Users\Sirius' Perhaps spacing is a problem.

Error message

C:\Windows\system32>dotnet iqsharp install
Traceback (most recent call last):
File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Sirius B\AppData\Roaming\Python\Python37\Scripts\jupyter-kernelspec.EXE_main.py", line 9, in
File "C:\Users\Sirius B\AppData\Roaming\Python\Python37\site-packages\traitlets\config\application.py", line 664, in launch_instance
app.start()
File "C:\Users\Sirius B\AppData\Roaming\Python\Python37\site-packages\jupyter_client\kernelspecapp.py", line 273, in start
return self.subapp.start()
File "C:\Users\Sirius B\AppData\Roaming\Python\Python37\site-packages\jupyter_client\kernelspecapp.py", line 143, in start
replace=self.replace,
File "C:\Users\Sirius B\AppData\Roaming\Python\Python37\site-packages\jupyter_client\kernelspec.py", line 346, in install_kernel_spec
shutil.copytree(source_dir, destination)
File "c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\shutil.py", line 318, in copytree
names = os.listdir(src)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\Users\Sirius'

Expected behavior
IQ# should install correctly.

System information

  • OS: Windows
  • Browser N/A
  • Version
    • Windows 10
    • Python 3.8
    • QDK 0.10

Unable to import operations from Q# namespace in python host file

I am using a python host file from which I call Q# operation from a Q# file in the same folder. A week ago it was working fine but today whenever I run the the host file I get the following error:

Error

I am using Visual Studio Code

  • OS: Windows 10

Below is a screenshot giving the relevant version information:
VersionInfo

Installation of Q# dependants in linux mint

I am trying to install Q# python in linux mint 19.
While passing command: "dotnet iqsharp install", I am getting the following error: The required library libhostfxr.so could not be found. Do I need windows operating system only. I am using Linux Mint 19.3.

Misc syntax highlighting errors.

Describe the bug
Syntax highlighting in IQ# exhibits several small issues:

  • Parens before types are colored with the types.
  • The newtype keyword is not colored.
  • The % operator is treated as a comment.

Screenshots
image

System information

  • OS: Windows 10
  • Browser: Chromium Edge

Additional context
Add any other context about the problem here.
image

Python error: module 'qsharp' has no attribute 'clients'

Follow the operation guide and pip install qsharp
(on Azure Machine Learning Studio Python3 Notebook)
result in :

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-eeaf4e1dca22> in <module>
----> 1 import qsharp

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/qsharp/__init__.py in <module>
    117 ## STARTUP ##
    118 
--> 119 client = _start_client()
    120 packages = Packages(client)
    121 

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/qsharp/clients/__init__.py in _start_client()
     22     if client_name == "iqsharp":
     23         import qsharp.clients.iqsharp
---> 24         client = qsharp.clients.iqsharp.IQSharpClient()
     25     elif client_name == "mock":
     26         import qsharp.clients.mock

AttributeError: module 'qsharp' has no attribute 'clients'

Not sure how to solve this problem

Installing MS QDK to run Q# with python on Ubuntu 18 — “dotnet iqsharp install” step fails

Copied from a StackOverflow question.

Here's the original question and repro steps:

Using the instructions in https://docs.microsoft.com/en-us/quantum/install-guide/pyinstall

I get following:

dotnet iqsharp install

It was not possible to find any compatible framework version The framework 'Microsoft.AspNetCore.App', version '3.0.0' was not found. - No frameworks were found.

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at: - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.0.0&arch=x64&rid=ubuntu.18.04-x64

It seems you cannot get AspNetCore.App 3.0.0 anymore but I have 3.0.3 installed - See below here for my setup .....
dotnet --info

.NET Core SDK (reflecting any global.json): Version: 3.1.102 Commit: 573d158fea

Runtime Environment: OS Name: ubuntu OS Version: 18.04 OS Platform: Linux RID: ubuntu.18.04-x64 Base Path: /usr/share/dotnet/sdk/3.1.102/

Host (useful for support): Version: 3.1.2 Commit: 916b5cba26

.NET Core SDKs installed:

3.0.103 [/usr/share/dotnet/sdk]

3.1.102 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:

Microsoft.AspNetCore.App 3.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

PATH=/home/dramsay/Qcomp-env/bin:/home/dramsay/bin:/home/dramsay/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/dramsay/.dotnet/tools:/snap/dotnet-sdk/63/host/fxr/3.1.2:/snap/dotnet-sdk/63/sdk:/snap/dotnet-sdk/63/host/fxr/3.1.2:/usr/share/dotnet/shared/Microsoft.AspNetCore.App:/usr/share/dotnet/shared/Microsoft.NETCore.App

Thanks in advance for any pointers

Error with standalone opens in Q# notebooks

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

Cannot install iqsharp

Describe the bug
While installing dotnet iqsharp through dotnet iqsharp install, I get an error saying

The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/home/$USERNAME/.dotnet/tools/.store/microsoft.quantum.iqsharp/0.11.2004.2825/microsoft.quantum.iqsharp/0.11.2004.2825/tools/netcoreapp3.1/any/].

I made a search on / for the file, found it in the snap installation of dotnet-sdk at /snap/dotnet-sdk/86/host/fxr/3.1.4, pasted it in the above mentioned folder. Now I get another error when I run dotnet iqsharp install again.

It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found.
No frameworks were found.
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=x64&rid=solus.4.1-x64

Since there is no direct package, I have to use linux binaries. Snap only has 3.1.4. Binaries only has minimum 3.1.0. I think this shouldn't be a problem since the docs mention .NET Core SDK 3.1?

To Reproduce
Steps to reproduce the behavior:

  1. Run dotnet tool install -g Microsoft.Quantum.IQSharp
  2. Run dotnet iqsharp install
  3. See error

Expected behavior

Installed successfully!

System information

dotnet --info returns

.NET Core SDK (reflecting any global.json):
Version: 3.1.300
Commit: b2475c1295
Runtime Environment:
OS Name: solus
OS Version: 4.1
OS Platform: Linux
RID: linux-x64
Base Path: /snap/dotnet-sdk/86/sdk/3.1.300/
Host (useful for support):
Version: 3.1.4
Commit: 0c2e69caa6
.NET Core SDKs installed:
3.1.300 [/snap/dotnet-sdk/86/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.4 [/snap/dotnet-sdk/86/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.4 [/snap/dotnet-sdk/86/shared/Microsoft.NETCore.App]

Additional context
I'm trying to install iqsharp for working with jupyter notebooks (Quantum Katas to be specific), for the codeforces challenge.

Can run but with exception

Running
https://docs.microsoft.com/en-us/quantum/install-guide/?view=qsharp-preview

On Azure JupyterLab
Only change ipynb to py for running

I can get the result correctly (see line 1)

but what are those exception means?
Is there any missing package?
Thanks!!

Hello from quantum world!
Exception ignored in: <bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x7f3c0319f2b8>>
Traceback (most recent call last):
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/socket.py", line 67, in __del__
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/socket.py", line 105, in close
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/context.py", line 153, in _rm_socket
TypeError: 'NoneType' object is not callable
Exception ignored in: <bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x7f3c0319f388>>
Traceback (most recent call last):
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/socket.py", line 67, in __del__
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/socket.py", line 105, in close
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/context.py", line 153, in _rm_socket
TypeError: 'NoneType' object is not callable
Exception ignored in: <bound method Socket.__del__ of <zmq.sugar.socket.Socket object at 0x7f3c0319f1e8>>
Traceback (most recent call last):
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/socket.py", line 67, in __del__
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/socket.py", line 105, in close
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/zmq/sugar/context.py", line 153, in _rm_socket
TypeError: 'NoneType' object is not callable

Import Q# files _not_ located in same directory

Is your feature request related to a problem? Please describe.
It seems that when importing functions and operations from a *.qs file namespace to Python, everything must be in the same directory. There also doesn't seem to be a way to change where qsharp is looking for those files.

Describe the solution you'd like
It would be really helpful to be able to import things from other locations, so that code need not be duplicated local to each project I am working on. I would like to have a repo with common Q# code I want to reuse, that I can then in multiple other Python projects import stuff from the common Q# repo. That requires that there be a way I can tell Q# where to look for stuff to import, other than the default local directory (which is a fine default).

Describe alternatives you've considered
Currently, I can duplicate the Q# code everywhere, but that is really not maintainable.

Additional context
n/a

Provide convenient method to execute magic commands from Python

The _execute(f'%magic.name {dumps(args)}') pattern occurs enough and it's useful for wrappers so it is worth adding a method to the public client API for executing magic commands given a name and a set of arguments. That would also make it a lot easier to stub out a mock client.

Query Regarding Installation of iqsharp on windows 10.

Describe the bug
How can I install the iqsharp kernel for using qsharp module in python?

System information

  • OS: Windows 10 Home

Additional context
When I'm running 'import qsharp' in python, it's showing an error as 'iqsharp kernel not found'.

Unable to install iqsharp OSX

Hi,

I'm getting the following error when trying to install iqsharp on OX

:~/quantum/qs $ dotnet iqsharp install
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Jupyter.Core.KernelApplication..ctor(KernelProperties properties, Action`1 configure)
   at Microsoft.Quantum.IQSharp.Jupyter.IQSharpKernelApp..ctor(KernelProperties properties, Action`1 configure) in D:\a\1\s\submodules\iqsharp\src\Jupyter\KernelApp\IQSharpKernelApp.cs:line 15
   at Microsoft.Quantum.IQSharp.Program.Main(String[] args) in D:\a\1\s\submodules\iqsharp\src\Tool\Program.cs:line 68

To Reproduce
Steps to reproduce the behavior:

  1. Using system python
  2. Install dotnet core using Homebrew cask brew cask install dotnet-sdk
  3. Install sharp pip install qsharp
  4. Begin iqsharp installation dotnet tool install -g Microsoft.Quantum.IQSharp
  5. Error here dotnet iqsharp install

As per the instructions here: https://docs.microsoft.com/en-us/quantum/install-guide/pyinstall

System information
Python 3.7.2 (default, Jan 13 2019, 12:50:01)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
DotNet Core SDK Version: 3.1.201
OS: OSX Catalina 10.15.4 (19E266)
PATH="$PATH:/Users/myuser/.dotnet/tools"

Tool 'microsoft.quantum.iqsharp' was reinstalled with the latest stable version (version '0.11.2003.3107').

DumpMachine() Meas. Pr. bars do not rendered correctly

When using Dumpmachine() the Meas. Pr. bars are not rendered correctly. When running the Qubit tutorial kata, only the first two bars are rendered correctly and the look is inconsistent over different browsers. I have attached screenshots for different browsers.
On Binder the bars are rendered correctly.

System specs:
Notebook server: 6.0.2
Python: 3.7.3
iqsharp: 0.11.2003.3107
Jupyter Core: 1.2.36563.0
.NET Runtime: .NETCoreApp,Version=v3.1

Chrome:
image

Old edge:
image

Chromium edge:
image

Python package should not find .qs files recursively.

Currently, the Python qsharp module recursively tries to find all .qs files in all subdirectories of the current working folder, which is causing some confusion as that's not normal Python behavior.

We should just load the .qs files under the current working folder and find some other mechanism to import/load files from other folders.

Project references

Is your feature request related to a problem? Please describe.
Similar to the current %package magic in IQ# (exposed as qsharp.packages in the Python client), it would be nice to have a %project magic that adds a reference to a .csproj file containing Q# code.
This would make it easier to use Visual Studio or Visual Studio Code intelliSense features with Python hosts by providing the appropriate information to the language server about Q# compilation units.
This feature would also make it easier to package Q# code along with Python hosts without having to depend on assumptions about the current working directory.

Describe the solution you'd like
A magic command of the form %project ../path/to/project.csproj would cause the following to occur:

  • project.csproj would be added as a project reference to the current IQ# session.
  • If project.csproj is not up to date, it would be rebuilt and its build artifact (assembly) added as a reference to all future snippets.
  • Upon %workspace reload, referenced projects would be rebuilt if out-of-date.

Incorrect syntax highlighting for non-word character immediately preceding a keyword

Describe the bug
Syntax highlighting in IQ# exhibits several issues:

  • Type names at the end of operation names are highlighted as types
  • Characters before reserved words are highlighted as part of those words
  • Reserved words at the beginning of the line (without whitespace before them) are not highlighted

To Reproduce
Add the following Q# code to a Q# notebook:

operation SyntaxHighlight () : Unit {

// Type names at the end of operation names are highlighted
ControlledOnInt();
AssertQubit();
ApplyPauliFromBitString(PauliX, true, negate, inputs);

// Characters before reserved words are highlighted as part of those words
{let b =Length(array);}
ApplyToEach(X, array);
ApplyPauliFromBitString(PauliX,true, negate, inputs);
let array = [false, false];

// Reserved words at the beginning of the line (without whitespace before them) are not highlighted
let a = Length();
Adjoint Z(qubit);
Message("Hi");
}

Screenshots

image

System information

  • OS: Windows 10
  • Browser: Firefox

Additional context
image

Katas taking 4+ mins to execute on binder

For some reason, after updating to the latest QDK and launching the Katas in Binder, trying to run a %kata cell takes 4+ minutes.

We're currently investigating this.

Passing arguments to operations invoked via %simulate in Jupyter Notebooks

I get the following error while trying to pass parameters to operations in Q#. It is quite annoying to hard-code the parameters , in order to perform test runs of the operations with different values.

image

I would like a feature like:

function LeftShift(x: Int) : Int {
return x<<<2;
}

%simulate LeftShift argument1

Make Jupyter visualizations available in published library package

Is your feature request related to a problem? Please describe.
Consumers of this project, such as QuantumKatas, want the ability to use the custom visualizations (JupyterDumpMachine, JupyterDumpRegister, etc.) currently inside the Jupyter project. But this visualization functionality is not contained in the published Microsoft.Quantum.IQSharp.Core library package.

Describe the solution you'd like
Ideally, common functionality for quantum-related visualizations should be accessible through Microsoft.Quantum.IQSharp.Core or a similar package so that downstream projects like QuantumKatas can consume it.

Describe alternatives you've considered
Duplicating the code in QuantumKatas is one option, but this is very unappealing. The functionality is actually contained in the larger Microsoft.Quantum.IQSharp package, but this contains a netcore3.1 tool and cannot be consumed from projects like QuantumKatas.

Additional context
Thanks to @vivanwin for reporting this issue.

IQ# version error during install

Hello ,

I try to install the IQ# but I got this error

PS C:\Users\90507\Desktop\Q\QuantumKatas-master\Measurements> dotnet iqsharp install
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found.

The following frameworks were found:
3.1.3 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=2.1.1&arch=x64&rid=win10-x64

Do I need to change framework version to 2.1.1 or is there any other solution ?

Python import qsharp error

This issue was originally filed by @patrickxli as MicrosoftDocs/quantum-docs-pr#473.

When I import qsharp in Python, I see the following error:

import qsharp
Preparing Q# environment...
...................Traceback (most recent call last):

File "", line 1, in
import qsharp

File "D:\Anaconda3\lib\site-packages\qsharp_init_.py", line 119, in
client = _start_client()

File "D:\Anaconda3\lib\site-packages\qsharp\clients_init_.py", line 47, in _start_client
raise Exception("Q# environment was not available in allocated time.")

Exception: Q# environment was not available in allocated time.

How to fix it? Any advice?

Thanks!

qsharp Python package missing source distribution

Describe the bug
The wheel built from the qsharp Python package is missing a source distribution. As mentioned on StackOverflow, this makes it harder to pack the qsharp package with conda-build.

Expected behavior
A source distribution should be available on PyPI along with the wheel.

Print code for operations in the current workspace

Is your feature request related to a problem? Please describe.
It would be helpful to have a %printcode magic command that prints and possibly syntax highlights the source code to a Q# operation in the current workspace.

Additional context
(h/t @vadym-kl for suggesting this feature!)

iqsharp could not be installed

From @kaiiyer on Monday, December 2, 2019 11:05:04 AM

Issue Title

iqsharp could not be installed

General

.NET Core 3.0

SDK Version: 3.0.101

OS (Version): Parrot GNU/LINUX Release 3.11 (64-bit)

Tool 'microsoft.quantum.iqsharp' is already installed and when i try using the command "dotnet iqsharp install", I get the following error.

Could not execute because the specified command or file was not found.
Possible reasons for this include:

  • You misspelled a built-in dotnet command.
  • You intended to execute a .NET Core program, but dotnet-iqsharp does not exist.
  • You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

Copied from original issue: dotnet/core#3942

Pylint errors when using qsharp package

q# sdk examples raise import errors in vscode linter

for example copying the examples from the installation guide
hello_world
host.py

into a vscode q# project gives the following errors
image

running the code works as expected

everything (vscode, q# extension, python, q# package) has been updated to the latest version

Q# notebook cells have poor formatting in JupyterLab, nteract, etc.

Describe the bug
IQ# notebooks do not work in JupyterLab, the next-generation web-based interface for Project Jupyter.

To Reproduce
Start JupyterLab on a local machine with jupyter lab, try to run any IQ# notebook.

Expected behavior
IQ# notebook works the same way as in Jupyter Notebooks run with jupyter notebook

Additional context
This is a known problem with a known fix, as mentioned to me by @cgranade in personal communication.

Compiling solutions with Q# unit test does not work

Describe the bug
When using a solution with native Q# @test() the solution does not compile. It throws an error saying that Microsoft.Quantum.Xunit is not available, I have tried to add this in the BUILT_IN_PACKAGES inside of the references file, however more dependencies issues pop up.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Q# project which uses @test() statements, inside of the Jupyter notebook folder. I created a sample here.
  2. Load the notebook.

Expected behavior
The solution should compile without any issue, and the test should be able to be used within other projects like the QuantumKatas.

Screenshot
image

System information

  • OS: Windows
  • Browser: Edge (chromium)
  • Version: 0.11.2004.2825

Handle missing dependency errors during Python init

Currently, there is a couple of dependencies needed for the qsharp Python module, namely:

  • .net core 2.2.0
  • IQ#
  • Jupyter

So, it's not too hard to miss any and have problems when importing the qsharp module. During init, we should catch errors and point users to the installation instructions where they can verify that they followed all steps.

Can't install on .NET Core 3.0

Describe the bug
iqsharp can't be installed on .NET Core 3.0

To Reproduce
Steps to reproduce the behavior:

  1. Install .NET Core SDK from https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-3.0.100-macos-x64-installer
  2. dotnet build iqsharp.sln
  3. cd src/Tool/
  4. dotnet run -- install
  5. See error:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
  - The following frameworks were found:
      3.0.0 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The .NET Core frameworks can be found at:
  - https://aka.ms/dotnet-download

Expected behavior
From the document, I would expect iqsharp to work on

.NET Core 2.2 or later

Also from this page: https://dotnet.microsoft.com/download/dotnet-core
It looks like .NET Core 3.0 is the recommended version and 2.2 is reaching end of support soon.

System information

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

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

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.