Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl

I am trying to run the following pandas code to create a df by reading an excel. However I receive the error below. (I pip-installed the openpyxl but I get the same error.)

import pandas as pd
import numpy as np
           
df = pd.read_excel("test.xlsx")

return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'openpyxl'

ImportError: Missing optional dependency 'openpyxl'.  Use pip or conda to install openpyxl.
like image 862
DrGenius Avatar asked Nov 17 '25 02:11

DrGenius


1 Answers

pip install openpyxl --upgrade

If this doesn't work, try this too:

pip install pandas --upgrade
like image 77
KillerRebooted Avatar answered Nov 18 '25 16:11

KillerRebooted



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!