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
The class MatplotlibDrawer needs pylatexenc. to install, run "pip install pylatexenc" [closed]
Asked Answered
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.
Try installing pylatexenc using the following command.
pip install pylatexenc
© 2022 - 2024 — McMap. All rights reserved.
import os
andos._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