The class MatplotlibDrawer needs pylatexenc. to install, run "pip install pylatexenc"

5k views Asked by At

I am using colab for qiskit and even after installing pylatexenc using pip this still comes as an error, I also used !pip.Here's the full pic

2

There are 2 answers

0
BeeFriedman On

Try installing pylatexenc using the following command.

pip install pylatexenc
1
Matthew Treinish On

I think that you probably need to restart the kernel in jupyter and rerun the notebook.

The way optional dependency detection looks like it is done there is that when the module is first imported it checks if pylatexenc is installed or not. If it's not installed it sets a flag to say it's not present. Then when you go to use a function in the module if that flag is set it raises that import error. Without restarting the kernel that flag will still be set so it doesn't check again if pylatexenc is installed again on the 2nd call.