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

'bw2calc' has no attribute 'ComparativeMonteCarlo' #223

Closed juliana-steinbach closed 11 months ago

juliana-steinbach commented 12 months ago

I am installing brightway2 in a new computer but this time I am facing the following error:

import brightway2 as bw

Adding a column to the projects database. A backup copy of this database 'C:\Users\jsteinbach\AppData\Local\pylca\Brightway3\projects.db' was made at 'C:\Users\jsteinbach\AppData\Local\pylca\Brightway3\projects.backup.db'; if you have problems, file an issue, and restore the backup data to use the stable version of Brightway2.

AttributeError Traceback (most recent call last) Cell In[1], line 6 3 get_ipython().run_line_magic('autoreload', '2') 5 get_ipython().run_line_magic('matplotlib', 'inline') ----> 6 from init import *

File ~\Desktop\jenny\init.py:5 3 import matplotlib.pyplot as plt 4 import numpy as np ----> 5 import brightway2 as bw 6 import SALib 7 from tabulate import tabulate

File ~\AppData\Local\anaconda3\envs\brightway_env\Lib\site-packages\brightway2__init.py:3 1 # -- coding: utf-8 - 2 from bw2data import ----> 3 from bw2calc import 4 from bw2io import * 6 version__ = (2, 3)

AttributeError: module 'bw2calc' has no attribute 'ComparativeMonteCarlo'

Does anyone know how to fix this? It is a completly new environment...

cmutel commented 12 months ago

Hi @juliana-steinbach! You have installed parts of the development version of Brightway, and there were a lot of changes to bw2calc which are causing problems.

I think you are using only conda, right? Can you share the command you used to create the conda environment?

juliana-steinbach commented 12 months ago

Hi @cmutel, yes, I am using conda, I have created the environment using:

conda create --name brightway_env

the installation pathway was pretty straightforward:

pip install brightway2

followed by

conda install -c conda-forge -c cmutel bw2io=0.8.7

as we are still using the 3.8 ecoinvent version. This morning I have tried installing brightway2 using

conda install brightway2

but it is not working, so I had to use:

pip install brightway2

which seems to be working, but the command

conda install -c conda-forge -c cmutel bw2io=0.8.7

is not converting the brightway2 2.4.4 to 2.3 and the bw2io 0.8.10 to 0.8.7 (which I managed to switch yesterday, but not today...)

juliana-steinbach commented 11 months ago

The solution was very simple but it took me some time to figure out how to fix it. Since 'conda install -c conda-forge -c cmutel bw2io=0.8.7' wasn't modifying the bw2io version from 0.8.10 to 0.8.7 I simply uninstalled bw2io0.8.10 with the command 'pip uninstall bw2io' and installed 0.8.7 with 'conda install -c conda-forge -c cmutel brightway2 bw2io=0.8.7'.

This all happened now because I installed premise and it automatically converted my bw2io from 7 to 10...