brightway-lca / brightway2-analyzer

BSD 3-Clause "New" or "Revised" License
7 stars 12 forks source link

bw2analyzer v2 imports _currently_ obsolete classes from bw2calc #7

Closed tngTUDOR closed 2 years ago

tngTUDOR commented 2 years ago

An install of brightway25 1.0, using conda on a clean python 3.9 environment with:

conda install -y -q -c conda-forge -c cmutel -c haasad brightway25

will produce import error on basic imports suggested at the homepage of the brightway25 repo as shown below. It seems that some classes are not published anymore in bw2calc.

Python 3.9.5 (default, Jun  4 2021, 12:28:51) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.28.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import bw2analyzer as ba
   ...: import bw2data as bd
   ...: import bw2calc as bc
   ...: import bw2io as bi
   ...: import matrix_utils as mu
   ...: import bw_processing as bp
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/tmp/ipykernel_902/2868165393.py in <module>
----> 1 import bw2analyzer as ba
      2 import bw2data as bd
      3 import bw2calc as bc
      4 import bw2io as bi
      5 import matrix_utils as mu

/opt/conda/lib/python3.9/site-packages/bw2analyzer/__init__.py in <module>
     19 from .health_check import DatabaseHealthCheck
     20 from .page_rank import PageRank
---> 21 from .report import SerializedLCAReport
     22 from .sc_graph import GTManipulator
     23 from .tagged import traverse_tagged_databases

/opt/conda/lib/python3.9/site-packages/bw2analyzer/report.py in <module>
      3 from .sc_graph import GTManipulator
      4 from bw2data import JsonWrapper, methods, config, projects, get_activity
----> 5 from bw2calc import ParallelMonteCarlo, LCA, GraphTraversal
      6 from scipy.stats import gaussian_kde
      7 import numpy as np

ImportError: cannot import name 'ParallelMonteCarlo' from 'bw2calc' (/opt/conda/lib/python3.9/site-packages/bw2calc/__init__.py)
cmutel commented 2 years ago

Fixed in d7c323d9e019fa21e983de7844ad13af8d1c23f1