ImportError: Pandas requires version '3.1.0' or newer of 'openpyxl'
I am trying to work with the 'openpyxl' library and pandas but receive the following error when I run my code.
ImportError Traceback (most recent call last)
Cell In[27], line 1
----> 1 message_data = (pd.read_excel('message_types.xlsx',
2 sheet_name='messages')
3 .sort_values('id')
4 .drop('id', axis=1))
File c:\PATH.py:495, in read_excel(io, sheet_name, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, date_format, thousands, decimal, comment, skipfooter, storage_options, dtype_backend, engine_kwargs)
493 if not isinstance(io, ExcelFile):
494 should_close = True
--> 495 io = ExcelFile(
496 io,
497 storage_options=storage_options,
498 engine=engine,
499 engine_kwargs=engine_kwargs,
500 )
501 elif engine and engine != io.engine:
502 raise ValueError(
503 "Engine should not be specified when passing "
504 "an ExcelFile - ExcelFile already has the engine set"
505 )
File c:\PATH.py:1567, in ExcelFile.__init__(self, path_or_buffer, engine, storage_options, engine_kwargs)
1564 self.engine = engine
...
--> 164 raise ImportError(msg)
165 else:
166 return None
ImportError: Pandas requires version '3.1.0' or newer of 'openpyxl' (version '3.0.10' currently installed).
I use anaconda navigator and have verified that openpyxl is installed correctly but the Anaconda Navigator only lists openpyxl version 3.0.10 as the latest available version. I can install openpyxl version 3.1.2 using 'pip install' but don't know how to verify which version of pandas is compatible with openpyxl version 3.0.10 without having to also downgrade my python version which leads to a host of other dependencies.