microsoft / QuantumKatas

Tutorials and programming exercises for learning Q# and quantum computing
MIT License
4.53k stars 1.21k forks source link

docker image creation is stuck #878

Closed simonadamprog closed 1 year ago

simonadamprog commented 1 year ago

I'm trying to go through the readme part for running QuantumKatas locally. I rebased my work branch recently with upstream. I'm running the:

  1. Build the docker image and tag it katas: docker build -t katas .

And the command line is stuck at this point for half an hour now:

% docker build -t katas . [+] Building 496.5s (8/10)
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 37B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for mcr.microsoft.com/quantum/iqsharp-base:0.27.258160 0.3s => [internal] load build context 0.0s => => transferring context: 56.29kB 0.0s => CACHED [1/6] FROM mcr.microsoft.com/quantum/iqsharp-base:0.27.258160@sha256:1012bcc317e29ae70a7d46c1f67eb8487daf750d8841f90a494b44cb 0.0s => [2/6] COPY . /home/jovyan 0.5s => [3/6] RUN pip install -I --no-cache-dir matplotlib numpy pytest && chown -R jovyan /home/jovyan && 65.2s => [4/6] RUN cd /home/jovyan/ && dotnet restore ./tutorials/ExploringDeutschJozsaAlgorithm/AQ/ProviderDependencies.csproj 9.4s => [5/6] RUN cd /home/jovyan/ && for solution in $(find . -type f -name "*.sln"); do dotnet restore "$solution"; done && ./sc 421.0s => => # Restored /home/jovyan/QEC_BitFlipCode/QEC_BitFlipCode.csproj (in 3.26 sec).
=> => # Determining projects to restore...
=> => # Restored /home/jovyan/SuperdenseCoding/SuperdenseCoding.csproj (in 3.34 sec).
=> => # 1 of 2 projects are up-to-date for restore.
=> => # Prebuilding: BasicGates.ipynb in BasicGates kata...
=> => # [NbConvertApp] Converting notebook BasicGates/BasicGates.ipynb to markdown

I have an M1 proc. with .NET 6.0 (for this architecture) installed. I also tried to run "dotnet test", but I'm getting the issue described in: https://github.com/microsoft/qsharp-compiler/issues/1273
Can it be an issue also with this docker build that there is a mismatch between architectures?

UPDATE: For second try it gave me this error:

=> => # Prebuilding: BasicGates.ipynb in BasicGates kata...
=> => # [NbConvertApp] Converting notebook BasicGates/BasicGates.ipynb to markdown
=> => # Assertion failed: p_rcu_reader->depth != 0 (/qemu/include/qemu/rcu.h: rcu_read_unlock: 101)

Yeah I guess it is a cpu architecture issue.

tcNickolas commented 1 year ago

Apologies for the delay replying!

Yes, you're most likely correct that it's an issue with Mac M1 chips - I think it's the same issue as https://github.com/microsoft/qsharp-compiler/issues/1362, though in Jupyter Notebooks it manifests slightly differently. You could try to set up the Katas as Q# projects and then use the workaround described in that issue to use an older version of the simulator that doesn't have this problem. This wouldn't work for Jupyter Notebooks, though, as the %kata magic uses CounterSimulator which, in turn, uses QuantumSimulator which exhibits this issue. I don't think there's an easy way to fix this in the Katas, since they have to rely on the simulator for the tests.