jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.7k stars 4.94k forks source link

Cannot import brightway2 #7320

Closed LouiseBru closed 6 months ago

LouiseBru commented 6 months ago

Hello,

I recently installed Brightway2 with anaconda, and since then, I've been encountering an error when trying to import it. I've never used brightway before.

Here's the error message I'm receiving:


TypeError Traceback (most recent call last) Cell In[1], line 1 ----> 1 import brightway2 as bw

File ~\anaconda3\envs\brightway_\lib\site-packages\brightway2__init__.py:4 2 from bw2data import 3 from bw2calc import ----> 4 from bw2io import * 6 version = (2, 4, 6)

File ~\anaconda3\envs\brightway_\lib\site-packages\bw2io__init__.py:76 63 from .data import ( 64 add_ecoinvent_33_biosphere_flows, 65 add_ecoinvent_34_biosphere_flows, (...) 73 get_xlsx_example_filepath, 74 ) 75 from .migrations import migrations, Migration, create_core_migrations ---> 76 from .importers import ( 77 CSVImporter, 78 CSVLCIAImporter, 79 Ecospold1LCIAImporter, 80 ExcelImporter, 81 ExcelLCIAImporter, 82 MultiOutputEcospold1Importer, 83 SimaProCSVImporter, 84 SimaProLCIACSVImporter, 85 SingleOutputEcospold1Importer, 86 SingleOutputEcospold2Importer, 87 ) 88 from .units import normalize_units 89 from .unlinked_data import unlinked_data, UnlinkedData

File ~\anaconda3\envs\brightway_\lib\site-packages\bw2io\importers__init__.py:2 1 # -- coding: utf-8 -- ----> 2 from .ecoinvent_lcia import EcoinventLCIAImporter 3 from .ecospold1 import ( 4 MultiOutputEcospold1Importer, 5 NoIntegerCodesEcospold1Importer, 6 SingleOutputEcospold1Importer, 7 ) 8 from .ecospold1_lcia import Ecospold1LCIAImporter

File ~\anaconda3\envs\brightway_\lib\site-packages\bw2io\importers\ecoinvent_lcia.py:19 15 from ..strategies.lcia import fix_ecoinvent_38_lcia_implementation 16 from .base_lcia import LCIAImporter ---> 19 class EcoinventLCIAImporter(LCIAImporter): 20 """ 21 A class for importing ecoinvent-compatible LCIA methods 22 23 """ 25 def init(self, biosphere_database: str | None = None):

File ~\anaconda3\envs\brightway_\lib\site-packages\bw2io\importers\ecoinvent_lcia.py:25, in EcoinventLCIAImporter() 19 class EcoinventLCIAImporter(LCIAImporter): 20 """ 21 A class for importing ecoinvent-compatible LCIA methods 22 23 """ ---> 25 def init(self, biosphere_database: str | None = None): 26 """Initialize an instance of EcoinventLCIAImporter. 27 28 Defines strategies in __init__ because config.biosphere is dynamic. 29 """ 30 self.strategies = [ 31 normalize_units, 32 set_biosphere_type, (...) 38 ), 39 ]

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

I'm not sure how to address this issue. I've already tried reinstalling Brightway, but it hasn't resolved the problem.

Could someone please provide guidance on how to resolve this error?

Thank you in advance for your assistance.

RRosio commented 6 months ago

Hi @LouiseBru, have you opened an issue in the Brightway2 repository, https://github.com/brightway-lca/brightway2, for the issue you are encountering? This seems like an issue that may not be in the Jupyter Notebook codebase. I will close this issue.