Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulator cannot be used on Windows with python 3.11 #174

Closed
Zhaoyilunnn opened this issue Jun 18, 2024 · 2 comments
Closed

simulator cannot be used on Windows with python 3.11 #174

Zhaoyilunnn opened this issue Jun 18, 2024 · 2 comments

Comments

@Zhaoyilunnn
Copy link
Collaborator

Zhaoyilunnn commented Jun 18, 2024

System Info

OS: Windows 11
Python: 3.11.9
PyQuafu version: 0.4.0

How to reproduce

run following script fails

from quafu import QuantumCircuit, simulate

qc = QuantumCircuit(2)
qc.h(0)
qc.cnot(0, 1)

res = simulate(qc)

报错如下

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Lenovo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\quafu\simulators\__init__.py", line 41, in simulate
    from .simulator import SVSimulator
  File "C:\Users\Lenovo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\quafu\simulators\simulator.py", line 19, in <module>
    from .qfvm import simulate_circuit, applyop_statevec, expect_statevec, sampling_statevec,simulate_circuit_clifford
ImportError: DLL load failed while importing qfvm: 找不到指定的模块。
@Zhaoyilunnn
Copy link
Collaborator Author

Zhaoyilunnn commented Jun 18, 2024

Debug Log

20240618

Successfully build from source on Windows 11 and simulate works well. Seems to be issue with CI environment.

20240620

Check the dependents of .pyd

0.4.0

Dump of file qfvm.cp311-win_amd64.pyd

File Type: DLL

  Image has the following dependencies:

    python311.dll
    MSVCP140.dll
    VCRUNTIME140_1.dll
    VCRUNTIME140.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    KERNEL32.dll
    VCOMP140.DLL

  Summary

        2000 .data
        3000 .pdata
        D000 .rdata
        1000 .reloc
        1000 .rsrc
       2D000 .text
       12000 _RDATA

0.3.6

Dump of file .\qfvm.cp311-win_amd64.pyd

File Type: DLL

  Image has the following dependencies:

    python311.dll
    MSVCP140.dll
    VCRUNTIME140_1.dll
    VCRUNTIME140.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    KERNEL32.dll
    VCOMP140.DLL

  Summary

        2000 .data
        3000 .pdata
        D000 .rdata
        1000 .reloc
        1000 .rsrc
       2D000 .text
       12000 _RDATA

20240624

find that this issue can be resolved after installing visual studio community 2022

@Zhaoyilunnn
Copy link
Collaborator Author

#176

The root cause is the debug flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant