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

import qsharp takes a very long time #338

@rmshaffer

Description

@rmshaffer

Issue description below copied from MicrosoftDocs/quantum-docs-pr#1076. Reported by @sanori.

Note that this affects only the first run after installation. Once everything is cached, then subsequent runs are fast, as expected.


$ python
Python 3.7.6 | packaged by conda-forge | (default, Jun  1 2020, 18:57:50) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import qsharp
Preparing Q# environment...
...................Q# environment was not available in allocated time.
Please check the instructions at https://aka.ms/qdk-install/python.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.7/site-packages/qsharp/__init__.py", line 123, in <module>
    client = _start_client()
  File "/opt/conda/lib/python3.7/site-packages/qsharp/clients/__init__.py", line 64, in _start_client
    raise IQSharpNotAvailableError(message)
qsharp.clients.IQSharpNotAvailableError: Q# environment was not available in allocated time.
Please check the instructions at https://aka.ms/qdk-install/python.
>>> 
  • qsharp Version: 0.12.2010.504
  • Environment:
    • Ubuntu 20.04
    • Python 3.7.6
  • .NET information
 $ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.402
 Commit:    9b5de826fd

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

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

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

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

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

I tried "import qsharp" again several times.
Then, the error message disappeared and it worked.

I guess that it takes too long time to run "import qsharp" for the first time.

With qsharp 0.12.2009.2803, "import qsharp" does not take long time:

$ python
Python 3.7.6 | packaged by conda-forge | (default, Jun  1 2020, 18:57:50) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import qsharp
Preparing Q# environment...
.>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Kind-BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions