brightway-lca / brightway2-io

Importing and exporting for the Brightway LCA framework
BSD 3-Clause "New" or "Revised" License
26 stars 40 forks source link

Missing EXIOBASE importer, cannot import Exiobase3MonetaryImporter from bw2io #262

Open nicolnt opened 4 months ago

nicolnt commented 4 months ago

I am trying to make use of Exiobase3MonetaryImporter specified here https://docs.brightway.dev/en/latest/content/api/bw2io/importers/exiobase3_monetary/index.html

But using this code raises an error.

# Brightway packages
import bw2io
import bw2data
# Brightway type hints
from bw2io import Exiobase3MonetaryImporter

Code inspired from official documentation https://docs.brightway.dev/en/latest/content/examples/brightway-examples/data_import/ecoinvent_import.html#imports

Error message

{
    "name": "ImportError",
    "message": "cannot import name 'Exiobase3MonetaryImporter' from 'bw2io' (/home/nicolas/miniconda3/envs/brightway_example_graph_technosphere/lib/python3.11/site-packages/bw2io/__init__.py)",
    "stack": "---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 6
      4 import bw2data
      5 # Brightway type hints
----> 6 from bw2io import Exiobase3MonetaryImporter
      7 # import/export
      8 import os

ImportError: cannot import name 'Exiobase3MonetaryImporter' from 'bw2io' (/home/nicolas/miniconda3/envs/brightway_example_graph_technosphere/lib/python3.11/site-packages/bw2io/__init__.py)"
}

Environment

environment.yml

name: brightway_example_graph_technosphere
channels:
  - conda-forge
  - nodefaults
dependencies:
  # core functionality
  - python=3.11
  - ipython
  - jupyterlab
  # life-cycle assessment
  - bw2data
  - bw2calc
  - bw2io

Taken from here: https://docs.brightway.dev/en/latest/_downloads/dbf0aeba6cfd859b9ebebe4dd5a71cc8/ecoinvent_import.yml

Command to create environment

conda env create -f environment.yml && conda activate brightway_example_graph_technosphere

Package versions

michaelweinold commented 4 months ago

Hello there! I will have a look at this next month. Feel free to ping me here if I have not updated the issue by then.

mfastudillo commented 2 months ago

Hi @nicolnt and @michaelweinold

this import should work.

from bw2io.importers.exiobase3_monetary import Exiobase3MonetaryImporter

however, I think #254 is still a problem