BioSTEAMDevelopmentGroup / BioSTEAMDevelopmentGroup/Bioindustrial-Park

Error regarding model call

Open
#130 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
53
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Hello, I have installed biorefineries, biosteam and thermosteam with code ```pip install .``` and ```git clone```. However, when I call the following code, I will encounter the following error. May I ask you how to solve it?
I use git clone https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park.git, git clone https://github.com/BioSTEAMDevelopmentGroup/biosteam.git and git clone https://github.com/BioSTEAMDevelopmentGroup/thermosteam.git, and cd Bioindustrial-Park folder, use ```pip install .```, cd biosteam folder, use ```pip install .```, cd thermosteam folder, use ```pip install .``` to install biorefineries, biosteam and thermosteam.

The code is as follows:
```
from biorefineries import cellulosic
import biosteam as bst
from biosteam import settings
from biorefineries.tea import create_cellulosic_ethanol_tea
from biosteam.report import voc_table
bst.nbtutorial()
cs = cellulosic.Biorefinery('corn stover ethanol')
cs.cornstover_sys.diagram(format='png')
tea=create_cellulosic_ethanol_tea(cs.cornstover_sys)
cs.cornstover_sys.save_report('cornstover.xlsx')
```

The error information is as follows:
```
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File D:\anaconda\envs\zddd\lib\site-packages\biorefineries\cellulosic\biorefinery.py:32, in Biorefinery.chemicals(self)
31 try:
---> 32 chemicals = self._chemicals
33 except AttributeError:

AttributeError: 'Biorefinery' object has no attribute '_chemicals'

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
Cell In[1], line 7
5 from biosteam.report import voc_table
6 bst.nbtutorial()
----> 7 cs = cellulosic.Biorefinery('corn stover ethanol')
8 cs.cornstover_sys.diagram(format='png')
9 tea=create_cellulosic_ethanol_tea(cs.cornstover_sys)

File D:\anaconda\envs\zddd\lib\site-packages\biorefineries\cellulosic\biorefinery.py:53, in Biorefinery.__new__(cls, name, cache, chemicals, include_blowdown_recycle, feedstock_kwargs, prices, GWP_CFs)
51 self.flowsheet = bst.Flowsheet(name)
52 F.set_flowsheet(self.flowsheet)
---> 53 bst.settings.set_thermo(self.chemicals)
54 load_process_settings()
55 sys = self.sys = create_cellulosic_ethanol_system(
56 include_blowdown_recycle=include_blowdown_recycle
57 )

File D:\anaconda\envs\zddd\lib\site-packages\biorefineries\cellulosic\biorefinery.py:34, in Biorefinery.chemicals(self)
32 chemicals = self._chemicals
33 except AttributeError:
---> 34 self._chemicals = chemicals = create_cellulosic_ethanol_chemicals()
35 return chemicals

File D:\anaconda\envs\zddd\lib\site-packages\thermosteam\utils\decorators\chemical_cache.py:19, in chemical_cache..h(cache, *args, **kwargs)
17 caching = Chemical.cache
18 Chemical.cache = True
---> 19 value = g(*args, **kwargs)
20 Chemical.cache = caching
21 else:

File D:\anaconda\envs\zddd\lib\site-packages\biorefineries\cellulosic\chemicals.py:124, in create_cellulosic_ethanol_chemicals()
122 @chemical_cache
123 def create_cellulosic_ethanol_chemicals():
--> 124 from biorefineries import cane
125 chems = tmo.Chemicals([])
126 oilcane_chemicals = cane.create_oilcane_chemicals()

File D:\anaconda\envs\zddd\lib\site-packages\biorefineries\cane\__init__.py:13
11 from . import evaluation
12 from . import results
---> 13 from . import contour_plots
14 from . import feature_mockups
15 from . import uncertainty_plots

File D:\anaconda\envs\zddd\lib\site-packages\biorefineries\cane\contour_plots.py:85
69 CABBI_colors = (colors.CABBI_yellow.tint(75).RGBn,
70 colors.CABBI_yellow.tint(30).RGBn,
71 colors.CABBI_yellow.RGBn,
72 colors.CABBI_green.tint(5).RGBn,
73 colors.CABBI_teal_green.shade(40).RGBn,
74 colors.CABBI_teal_green.shade(60).RGBn)
76 CABBI_colors_x = (colors.CABBI_blue_light.tint(90).RGBn,
77 colors.CABBI_blue_light.tint(40).RGBn,
78 colors.CABBI_blue_light.RGBn,
(...)
81 colors.CABBI_teal_green.tint(40).shade(15).RGBn,
82 colors.CABBI_teal_green.shade(45).RGBn)
84 diverging_colormaps = [
---> 85 plt.cm.get_cmap('RdYlGn')
86 ]
88 colormaps = [
89 plt.cm.get_cmap('viridis'),
90 plt.cm.get_cmap('copper_r'),
(...)
95 plt.cm.get_cmap('bone_r'),
96 ] * 2
98 light_letter_color = colors.neutral.tint(98).RGBn

AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with biorefineries/cane/contour_plots.py at the matplotlib.cm.get_cmap('RdYlGn') call shown in the traceback, then reproduce the failure using the reported Biorefinery('corn stover ethanol') setup. Check the installed matplotlib and project versions involved. Done means the cellulosic Biorefinery initializes without this AttributeError and the plotting-related imports still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.