I've resumed calculations on BW2 this week after a few months of break and my old notebooks don't work anymore due to the change in XLRD, which doesn't read xlsx anymore (if I understand this post correctly).
I'm starting a new project:
bw.projects.set_current("MyNewProject")
bw.bw2setup()
And I get this in return:
XLRDError: Excel xlsx file; not supported
If I understand correctly, it comes from the init of bw2io. Where I found:
def get_sheet(path, name):
wb = xlrd.open_workbook(path)
return wb.sheet_by_name(name)
I suppose I should replace
xlrd.open_workbook(path)
Any idea how to fix this?
The 2.0 release of xlrd removed support for .xlsx
files. bw2io
was using xlrd
, but as of the 0.8 release uses openpyxl
. So, you can solve this problem by either explicitly forcing an install of xlrd
< 2.0, or by updating your bw2io
library.
Note that if you are using anaconda, you might need to start a new environment using Python 3.8 or 3.9 to get the latest version of bw2io
to install correctly. There is no reason not to have the latest Python release (3.9 as of this post) installed, so this is probably best practice anyway.