Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.26k stars 2.37k forks source link

pygments requirement min version is too old #4048

Closed mtreinish closed 4 years ago

mtreinish commented 4 years ago

Information

What is the current behavior?

When pip installing having pygments 2.3.1 installed which satisfies the requirements set of >=2.2 trying to import qiskit.compiler.assemble results in this stack trace:

File "/opt/qiskit/test/benchmarks/assembler.py", line 18, in <module>
       from qiskit.compiler import assemble
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/qiskit/__init__.py", line 31, in <module>
       from qiskit.circuit import ClassicalRegister
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/qiskit/circuit/__init__.py", line 66, in <module>
       from .quantumcircuit import QuantumCircuit
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/qiskit/circuit/quantumcircuit.py", line 28, in <module>
       from qiskit.qasm.qasm import Qasm
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/qiskit/qasm/__init__.py", line 48, in <module>
       from .pygments import OpenQASMLexer, QasmHTMLStyle, QasmTerminalStyle
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/qiskit/qasm/pygments/__init__.py", line 29, in <module>
       from .lexer import OpenQASMLexer, QasmTerminalStyle, QasmHTMLStyle
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/qiskit/qasm/pygments/lexer.py", line 22, in <module>
       class QasmTerminalStyle(Style):
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/pygments/style.py", line 101, in __new__
       ndef[0] = colorformat(styledef)
     File "/opt/qiskit/.asv/env/541b6fbd95fdb429e84621bc981fbd19/lib/python3.6/site-packages/pygments/style.py", line 58, in colorformat
       assert False, "wrong color format %r" % text
   AssertionError: wrong color format 'ansibrightred'

Steps to reproduce the problem

Build an environemnt with pygments 2.3.1 and try to import from qiskit

What is the expected behavior?

You can import without an assertion error.

Suggested solutions

Increase the minimum version of pygments to a working version, or if 2.2 works and 2.3 doesn't exclude 2.3.

mtreinish commented 4 years ago

Testing locally 2.4 works. I've got a PR in progress bumping the minimum and also making pygments optional since it's a visualization requirement (albeit a text visualization) and we typically do not make that a hard requirement for users.

akshat-suwalka commented 4 years ago

2 days before I just do: pip install qiskit import qiskit in my colab and it works well! But now from 2 days it is always showing me AssertionError: wrong color format 'ansibrightred'

Please help me!

@mtreinish @ajavadia

jul1u5 commented 4 years ago

Solved by running pip install qiskit-terra[visualization] and restarting the runtime.

akshat-suwalka commented 4 years ago

Thank you so much @jul1u5 . Its working!

@jul1u5 I have one more doubt in forest version. Can you help on it?

akshat-suwalka commented 4 years ago

@jul1u5 This problem is in my colab. This is the link where you will find the ipynb file : [https://gitlab.com/qosf/qml-mooc/-/blob/master/forest_version/01_Classical_and_Quantum_Probability_Distributions.ipynb]

Annotation 2020-04-13 034732 Annotation 2020-04-13 034842

Please have a look!

jul1u5 commented 4 years ago

Sorry, I have just started learning Qiskit and Quantum Computing and I can't help you.

This issue is now closed and unrelated to the problem you are having. So you should post an issue in the repo with which you are having problems (probably qml-mooc).

As far as I can tell the notebook can't find an executable called qvm. Perhaps you didn't install it.