The class MatplotlibDrawer needs pylatexenc. to install, run "pip install pylatexenc" [closed]
Asked Answered
W

2

7

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

Washy answered 14/10, 2020 at 15:29 Comment(0)
M
8

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.

Media answered 14/10, 2020 at 15:41 Comment(1)
If you want your kernel to be restarted by a python command use this: import os and os._exit(00). This will crash the python kernel and (at least in Google Colab) it will be restarted automatically, BUT the changes in libraries that you made with !pip will be preserved.Opine
H
0

Try installing pylatexenc using the following command.

pip install pylatexenc
Hautevienne answered 14/10, 2020 at 16:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.