Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brightway2 lcia methods missing #21

Closed
tjlca opened this issue Feb 2, 2021 · 8 comments
Closed

brightway2 lcia methods missing #21

tjlca opened this issue Feb 2, 2021 · 8 comments

Comments

@tjlca
Copy link

tjlca commented Feb 2, 2021

This may be a minor issue due to improper setup -

Installed brightway2 using pip - python 3.8

from brightway2 install *

len(methods) 

gives 0. methods is empty.
The LCIA methods are not showing up. Any help would be appreciated.

@BenPortner
Copy link
Member

Hi @TJTapajyoti,

I believe it should be import, not install. Also please note that you need to run bw2setup() before any methods will show up. For a beginner guide see https://github.com/BenPortner/brightway_recipes.

Cheers.
Ben

@BenPortner
Copy link
Member

@TJTapajyoti that's strange! Try create_default_lcia_methods()?

@tjlca
Copy link
Author

tjlca commented Feb 3, 2021

Hi @BenPortner I redid each and every step in your tutorial. I still got the same problem. On trying the function you mentioned, I am obtaining this error -

create_default_lcia_methods()
Traceback (most recent call last):

File "", line 1, in

    create_default_lcia_methods()

  File "/Users/tghosh/opt/anaconda3/envs/liason/lib/python3.8/site-packages/bw2io/__init__.py", line 91, in create_default_lcia_methods
    ei = EcoinventLCIAImporter()

  File "/Users/tghosh/opt/anaconda3/envs/liason/lib/python3.8/site-packages/bw2io/importers/ecoinvent_lcia.py", line 30, in __init__
    self.csv_data, self.cf_data, self.units, self.file = convert_lcia_methods_data()

  File "/Users/tghosh/opt/anaconda3/envs/liason/lib/python3.8/site-packages/bw2io/data/__init__.py", line 336, in convert_lcia_methods_data
    sheet = get_sheet(

  File "/Users/tghosh/opt/anaconda3/envs/liason/lib/python3.8/site-packages/bw2io/data/__init__.py", line 40, in get_sheet
    wb = xlrd.open_workbook(path)

  File "/Users/tghosh/opt/anaconda3/envs/liason/lib/python3.8/site-packages/xlrd/__init__.py", line 170, in open_workbook
    raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')

XLRDError: Excel xlsx file; not supported

I have a question - are the default LCIA methods inbuilt in brightway2 or obtained from ecoinvent or some other database that I am missing? This seems like its trying to read a excel file that is not supported. Not sure if there is some excel file with all the LCIA methods.

@tjlca
Copy link
Author

tjlca commented Feb 3, 2021

Just to confirm, I created a new project, ran bwsetup(), loaded ecoinvent(I have version 3.6), applied the strategies,statistics and write_database function. I made sure i am in the correct project. I checked the datasets and processes and they were fine. I defined functional units. Just then I am trying
bw.methods or for me just methods - as I imported everything from the module of brightway2 - I am getting -
Methods dictionary with 0 objects

I installed brightway 2.1 to check and I am getting the same error.
I am using python 3.8

Should I install brightway2 using pip or use conda install from cmutel?

@tjlca
Copy link
Author

tjlca commented Feb 3, 2021

Hi @BenPortner so this interesting. I looked into the projects i had in my brightway2 and there were some old projects ( which remained even though I uninstalled and reinstalled brightway2) but when I am setting my current project as BW2intro or StepByStep, I have all the LCIA methods available.

projects.set_current("BW2intro")

bw.methods
Out[27]: 
Methods dictionary with 850 objects, including:
	('CML 2001 (obsolete)', 'acidification potential', 'average European')
	('CML 2001 (obsolete)', 'acidification potential', 'generic')
	('CML 2001 (obsolete)', 'climate change', 'GWP 100a')
	('CML 2001 (obsolete)', 'climate change', 'GWP 20a')
	('CML 2001 (obsolete)', 'climate change', 'GWP 500a')
	('CML 2001 (obsolete)', 'climate change', 'lower limit of net GWP')
	('CML 2001 (obsolete)', 'climate change', 'upper limit of net GWP')
	('CML 2001 (obsolete)', 'eutrophication potential', 'average European')
	('CML 2001 (obsolete)', 'eutrophication potential', 'generic')
	('CML 2001 (obsolete)', 'freshwater aquatic ecotoxicity', 'FAETP 100a')
Use `list(this object)` to get the complete list.

@BenPortner
Copy link
Member

It seems you have a new version of xlrd installed, which does not support xlsx files anymore, see brightway-lca/brightway2-io#86. Can you try to downgrade xlrd and see if you can then run create_default_lcia_methods()?

@tjlca
Copy link
Author

tjlca commented Feb 3, 2021

@BenPortner Thanks so much for solving my issue. This works fine. create_default_lcia_methods()

had to downgrade xlrd

@tjlca tjlca closed this as completed Feb 3, 2021
@BenPortner
Copy link
Member

@TJTapajyoti I'm glad it worked 😃 Please also run create_core_migrations() to complete the setup.

Happy brightway coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants