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

Qiskit Machine Learning Application (PyQt5) error when I run the build pyqt5 exe application file with pyinstaller #11285

Closed
Herutriana44 opened this issue Nov 21, 2023 · 5 comments

Comments

@Herutriana44
Copy link

Environment

  • Qiskit Machine Learning version:0.6.1
  • Python version: 3.11.4
  • Operating system: windows 10
  • **PyQt: v 5.15.9
  • **Pyinstaller:5.13.0

What is happening?

I am building a quantum machine learning simulation application with PyQt5 and qiskit_machine_learning, when debugging there are no errors and it can run and make predictions. However, after I tried to create an exe extension with pyinstaller and opened the exe application file resulting from the build, the following error occurred. I'm a bit confused about the qiskit_machine_learning configuration in the .spec file and also how to solve this error.

Sorry, i use this picture to show this error because when this error displayed, a few seconds later this terminal will be close

WhatsApp Image 2023-11-10 at 15 54 16_800fe5a6

here is the .spec configuration file

# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(
    ['MAIN_APP'],
    pathex=[],
    binaries=[],
    datas=[
        ('asset/model/Quantum Model', 'asset/model/Quantum Model'), 
        ('asset', 'asset'),
        ('asset/label/allergenicity_label_mapping_quantum.json', 'asset/label'),
        ('asset/label/antigenicity_label_mapping_quantum.json', 'asset/label'),
        ('asset/label/BPepTree_label_quantum.json', 'asset/label'),
        ('asset/label/toxin_label_mapping_quantum.json', 'asset/label'),
        ('asset/label/TPepTree_label_quantum.json', 'asset/label'),
        ('asset/model/Quantum Model/allergen_vqc_model', 'asset/model/Quantum Model'), 
        ('asset/model/Quantum Model/antigen_vqc_model', 'asset/model/Quantum Model'), 
        ('asset/model/Quantum Model/B_vqc_model', 'asset/model/Quantum Model'), 
        ('asset/model/Quantum Model/T_vqc_model', 'asset/model/Quantum Model'), 
        ('asset/model/Quantum Model/toxin_vqc_model', 'asset/model/Quantum Model'), 
        ],
    hiddenimports=[
        'PIL',
        'PyQt5',
        'os',
        'sys',
        'sklearn',
        'sklearn.neighbors',
        'sklearn.metrics',
        'tensorflow',
        'numpy',
        'openpyxl',
        'torch',
        'logging',
        'biopython',
        'rdkit',
        'qiskit',
	'qiskit_machine_learning'
    ],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=True,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='ReVa',
    debug=True,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)

How can we reproduce the issue?

when I run the Qiskit machine learning exe file application the build results with pyinstaller

What should happen?

When I run the exe application file, it should display the application running according to the previous debug

Any suggestions?

No response

@woodsp-ibm
Copy link
Member

Was raised here initially /qiskit-community/qiskit-machine-learning#714 and I commented there qiskit-community/qiskit-machine-learning#714 (comment)

@jakelishman
Copy link
Member

Yeah, this is likely due to a difference in handling implicit packages in new versions of setuptools that we haven't addressed yet. I'm a bit surprised to see it causing bugs, but the short-term fix will likely be to drop an __init__.py file in qiskit/qasm/lib. Longer term, we're planning to remove qiskit/qasm entirely and the OQ2 and OQ3 libraries will be reorganised as part of #10737.

@jakelishman
Copy link
Member

While I don't see this in the error output, I suspect that qiskit/visualization/circuit/styles will exhibit the same problem.

@Herutriana44
Copy link
Author

Yeah, this is likely due to a difference in handling implicit packages in new versions of setuptools that we haven't addressed yet. I'm a bit surprised to see it causing bugs, but the short-term fix will likely be to drop an __init__.py file in qiskit/qasm/lib. Longer term, we're planning to remove qiskit/qasm entirely and the OQ2 and OQ3 libraries will be reorganised as part of #10737.

I'll try to this sir, thanks for giving me solutions

@Herutriana44
Copy link
Author

Yeah, this is likely due to a difference in handling implicit packages in new versions of setuptools that we haven't addressed yet. I'm a bit surprised to see it causing bugs, but the short-term fix will likely be to drop an __init__.py file in qiskit/qasm/lib. Longer term, we're planning to remove qiskit/qasm entirely and the OQ2 and OQ3 libraries will be reorganised as part of #10737.

thanks sir, it's worked

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

3 participants