spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.37k stars 1.62k forks source link

Qiskit and Qiskit Ecosystem variables issue #21559

Open arque1393 opened 1 year ago

arque1393 commented 1 year ago

Description

Variable Explorer can't show the qiskit ecosystem variable like Quantum Circuit, State Vectors ets It showing this error message.

Spyder was unable to retrieve the value of this variable from the console.

The error message was:

An unkown error occurred. Check the console because its contents could have been printed there.

Note: Please don't report this problem on Github, there's nothing to do about it.

What steps will reproduce the problem?

When I click on the Qiskit ecosystem variable to show in detail this error occurs.

There are no valid machenism to display state vectors variable or Quantum Circuit variable. There should be implement this for Quantum Computing and Quantum Reasearch

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0                 :  1.4.1 (OK)
chardet >=2.0.0                      :  5.2.0 (OK)
cloudpickle >=0.5.0                  :  3.0.0 (OK)
cookiecutter >=1.6.0                 :  2.5.0 (OK)
diff_match_patch >=20181111          :  20230430 (OK)
intervaltree >=3.0.2                 :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1     :  8.18.1 (OK)
jedi >=0.17.2,<0.20.0                :  0.19.1 (OK)
jellyfish >=0.7                      :  1.0.3 (OK)
jsonschema >=3.2.0                   :  4.20.0 (OK)
keyring >=17.0.0                     :  24.3.0 (OK)
nbconvert >=4.0                      :  7.11.0 (OK)
numpydoc >=0.6.0                     :  1.6.0 (OK)
parso >=0.7.0,<0.9.0                 :  0.8.3 (OK)
pexpect >=4.4.0                      :  4.9.0 (OK)
pickleshare >=0.4                    :  0.7.5 (OK)
psutil >=5.3                         :  5.9.6 (OK)
pygments >=2.0                       :  2.17.2 (OK)
pylint >=2.5.0,<3.1                  :  3.0.2 (OK)
pylint_venv >=3.0.2                  :  3.0.3 (OK)
pyls_spyder >=0.4.0                  :  0.4.0 (OK)
pylsp >=1.9.0,<1.10.0                :  1.9.0 (OK)
pylsp_black >=1.2.0,<3.0.0           :  1.3.0 (OK)
qdarkstyle >=3.2.0,<3.3.0            :  3.2.1 (OK)
qstylizer >=0.2.2                    :  0.2.2 (OK)
qtawesome >=1.2.1                    :  1.2.3 (OK)
qtconsole >=5.5.0,<5.6.0             :  5.5.1 (OK)
qtpy >=2.1.0                         :  2.4.1 (OK)
rtree >=0.9.7                        :  1.1.0 (OK)
setuptools >=49.6.0                  :  65.5.0 (OK)
sphinx >=0.6.6                       :  7.2.6 (OK)
spyder_kernels >=2.5.0,<2.6.0        :  2.5.0 (OK)
textdistance >=4.2.0                 :  4.6.0 (OK)
three_merge >=0.1.1                  :  0.1.1 (OK)
watchdog >=0.10.3                    :  3.0.0 (OK)
xdg >=0.26                           :  0.28 (OK)
zmq >=22.1.0                         :  25.1.1 (OK)

# Optional:
cython >=0.21                        :  None (NOK)
matplotlib >=3.0.0                   :  None (NOK)
numpy >=1.7                          :  None (NOK)
pandas >=1.1.1                       :  None (NOK)
scipy >=0.17.0                       :  None (NOK)
sympy >=0.7.3                        :  None (NOK)

# Spyder plugins:
spyder_notebook.notebookplugin 0.5.1 :  0.5.1 (OK)
spyder_terminal.terminalplugin 1.2.2 :  1.2.2 (OK)

Environment

Environment ``` Package Version ----------------------------- ---------- alabaster 0.7.13 anyio 4.1.0 argon2-cffi 23.1.0 argon2-cffi-bindings 21.2.0 arrow 1.3.0 astroid 3.0.1 asttokens 2.4.1 async-lru 2.0.4 atomicwrites 1.4.1 attrs 23.1.0 autopep8 2.0.4 Babel 2.13.1 beautifulsoup4 4.12.2 binaryornot 0.4.4 black 23.11.0 bleach 6.1.0 certifi 2023.11.17 cffi 1.16.0 chardet 5.2.0 charset-normalizer 3.3.2 click 8.1.7 cloudpickle 3.0.0 coloredlogs 15.0.1 comm 0.2.0 contourpy 1.2.0 cookiecutter 2.5.0 cryptography 41.0.5 cycler 0.12.1 debugpy 1.8.0 decorator 5.1.1 defusedxml 0.7.1 diff-match-patch 20230430 dill 0.3.7 docstring-to-markdown 0.13 docutils 0.20.1 executing 2.0.1 fastjsonschema 2.19.0 flake8 6.1.0 fonttools 4.45.1 fqdn 1.5.1 humanfriendly 10.0 idna 3.6 imagesize 1.4.1 importlib-metadata 6.8.0 inflection 0.5.1 intervaltree 3.1.0 ipykernel 6.26.0 ipython 8.18.1 isoduration 20.11.0 isort 5.12.0 jaraco.classes 3.3.0 jedi 0.19.1 jeepney 0.8.0 jellyfish 1.0.3 Jinja2 3.1.2 json5 0.9.14 jsonpointer 2.4 jsonschema 4.20.0 jsonschema-specifications 2023.11.1 jupyter_client 8.6.0 jupyter_core 5.5.0 jupyter-events 0.9.0 jupyter-lsp 2.2.1 jupyter_server 2.10.1 jupyter_server_terminals 0.4.4 jupyterlab 4.0.9 jupyterlab_pygments 0.3.0 jupyterlab_server 2.25.2 keyring 24.3.0 kiwisolver 1.4.5 markdown-it-py 3.0.0 MarkupSafe 2.1.3 matplotlib 3.8.2 matplotlib-inline 0.1.6 mccabe 0.7.0 mdurl 0.1.2 mistune 3.0.2 more-itertools 10.1.0 mpmath 1.3.0 mypy-extensions 1.0.0 nbclient 0.9.0 nbconvert 7.11.0 nbformat 5.9.2 nest-asyncio 1.5.8 notebook 7.0.6 notebook_shim 0.2.3 numpy 1.26.2 numpydoc 1.6.0 overrides 7.4.0 packaging 23.2 pandocfilters 1.5.0 parso 0.8.3 pathspec 0.11.2 pbr 6.0.0 pexpect 4.9.0 pickleshare 0.7.5 Pillow 10.1.0 pip 23.2.1 platformdirs 4.0.0 pluggy 1.3.0 ply 3.11 prometheus-client 0.19.0 prompt-toolkit 3.0.41 psutil 5.9.6 ptyprocess 0.7.0 pure-eval 0.2.2 pycodestyle 2.11.1 pycparser 2.21 pydocstyle 6.3.0 pyflakes 3.1.0 Pygments 2.17.2 pylatexenc 2.10 pylint 3.0.2 pylint-venv 3.0.3 pyls-spyder 0.4.0 pyparsing 3.1.1 PyQt5 5.15.10 PyQt5-Qt5 5.15.2 PyQt5-sip 12.13.0 PyQtWebEngine 5.15.6 PyQtWebEngine-Qt5 5.15.2 python-dateutil 2.8.2 python-json-logger 2.0.7 python-lsp-black 1.3.0 python-lsp-jsonrpc 1.1.2 python-lsp-server 1.9.0 python-slugify 8.0.1 pytoolconfig 1.2.6 pyxdg 0.28 PyYAML 6.0.1 pyzmq 25.1.1 QDarkStyle 3.2.1 qiskit 0.45.0 qiskit-aer 0.13.1 qiskit-terra 0.45.0 qstylizer 0.2.2 QtAwesome 1.2.3 qtconsole 5.5.1 QtPy 2.4.1 referencing 0.31.0 requests 2.31.0 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rich 13.7.0 rope 1.11.0 rpds-py 0.13.1 Rtree 1.1.0 rustworkx 0.13.2 scipy 1.11.4 SecretStorage 3.3.3 Send2Trash 1.8.2 setuptools 65.5.0 six 1.16.0 sniffio 1.3.0 snowballstemmer 2.2.0 sortedcontainers 2.4.0 soupsieve 2.5 Sphinx 7.2.6 sphinxcontrib-applehelp 1.0.7 sphinxcontrib-devhelp 1.0.5 sphinxcontrib-htmlhelp 2.0.4 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.6 sphinxcontrib-serializinghtml 1.1.9 spyder 5.5.0 spyder-kernels 2.5.0 spyder-notebook 0.5.1 spyder-terminal 1.2.2 stack-data 0.6.3 stevedore 5.1.0 symengine 0.9.2 sympy 1.12 tabulate 0.9.0 terminado 0.18.0 text-unidecode 1.3 textdistance 4.6.0 three-merge 0.1.1 tinycss2 1.2.1 tomli 2.0.1 tomlkit 0.12.3 tornado 6.3.3 traitlets 5.14.0 types-python-dateutil 2.8.19.14 ujson 5.8.0 uri-template 1.3.0 urllib3 2.1.0 watchdog 3.0.0 wcwidth 0.2.12 webcolors 1.13 webencodings 0.5.1 websocket-client 1.6.4 whatthepatch 1.0.5 wurlitzer 3.0.3 yapf 0.40.2 zipp 3.17.0 ```
ccordoba12 commented 1 year ago

Hey @arque1393, thanks for reporting. Could you post a simple qiskit code for us to test it on our side? Also, let us know what variable you're trying to view after running it.

arque1393 commented 1 year ago

Observe this code


import qiskit as q
from qiskit_aer import StatevectorSimulator
quantum_register = q.QuantumRegister(2,"q")
classical_register = q.ClassicalRegister(2,"C")

circuit= q.QuantumCircuit(quantum_register,classical_register)
circuit.h(0)           #Applying Hadamord Gate
circuit.cx(0,1)      # Applying Controled Not GAte

sv_sim = StatevectorSimulator()
result = q.execute(circuit, sv_sim).result()

state_vector = result.get_statevector()
circuit.measure([0,1], [0,1])
circuit .draw()

Notice the QuantumCircuit,Statevector class. this type of variable can't showed in detailed description in VAriable Explorer of Spyder and This Show error.

if I Write circuit.draw() console easily prints the circuit diagram or state_vector variable is also the object of qiskit.quantum_info.Statevector is displayed like a simple Numpy array but Spyder Variable Explorer can't Recognise this. image

Screenshot of Total Variable list that are Created for above code in spyder

image