BioSTEAMDevelopmentGroup / Bioindustrial-Park

BioSTEAM's Premier Repository for Biorefinery Models and Results
MIT License
38 stars 17 forks source link

Consultation about HP model errors #154

Open zasddsgg opened 4 months ago

zasddsgg commented 4 months ago

Hello, I have installed biorefineries, biosteam and thermosteam according to the URL you recommended (download with git clone https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park.git, git clone https://github.com/BioSTEAMDevelopmentGroup/biosteam.git, git clone https://github.com/BioSTEAMDevelopmentGroup/thermosteam.git, install with pip install .). However, when running the file TRY_analysis.py (https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/tree/427ec9ad260de62d97f1591cb46891207af8951a/BioSTEAM%202.x.x/biorefineries/HP), I still encounter the following error, could I ask you how to solve it @sarangbhagwat? I use python 3.10.9 version. Thanks for your help. Wish you a good day. The location I download is as follows. 1 2 3

The error information is as follows.

AttributeError                            Traceback (most recent call last)
Cell In[1], line 11
      9 from warnings import filterwarnings
     10 import copy
---> 11 from biosteam.process_tools import UnitGroup
     12 from biosteam.digraph import digraph_from_units, save_digraph
     13 from biosteam.utils import streams_from_units, filter_out_missing_streams, colors

File D:\anaconda\envs\zhangdexin\lib\site-packages\biosteam\__init__.py:73
     71 from . import wastewater
     72 from .wastewater import *
---> 73 from . import evaluation
     74 from .evaluation import *
     75 from . import exceptions

File D:\anaconda\envs\zhangdexin\lib\site-packages\biosteam\evaluation\__init__.py:14
     12 from ._parameter import *
     13 from ._prediction import *
---> 14 from ._model import *
     15 from ._metric import *
     16 from . import (_parameter, _prediction, _model,
     17               _metric, evaluation_tools, _feature,
     18               _utils)

File D:\anaconda\envs\zhangdexin\lib\site-packages\biosteam\evaluation\_model.py:27
     25 from typing import Callable
     26 from ._parameter import Parameter
---> 27 from .evaluation_tools import load_default_parameters
     28 import pickle
     30 __all__ = ('Model',)

File D:\anaconda\envs\zhangdexin\lib\site-packages\biosteam\evaluation\evaluation_tools\__init__.py:10
      1 # -*- coding: utf-8 -*-
      2 # BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
      3 # Copyright (C) 2020-2023, Yoel Cortes-Pena <yoelcortes@gmail.com>
   (...)
      6 # github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
      7 # for license details.
      8 """
      9 """
---> 10 from . import parameter
     11 from . import in_parallel
     13 __all__ = (*parameter.__all__,
     14            *in_parallel.__all__)

File D:\anaconda\envs\zhangdexin\lib\site-packages\biosteam\evaluation\evaluation_tools\parameter.py:10
      1 # -*- coding: utf-8 -*-
      2 # BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
      3 # Copyright (C) 2020-2023, Yoel Cortes-Pena <yoelcortes@gmail.com>
   (...)
      6 # github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
      7 # for license details.
      8 """
      9 """
---> 10 from chaospy import distributions as shape
     11 import biosteam as bst
     13 __all__ = ('load_default_parameters',
     14            'add_all_cost_item_params',
     15            'add_flow_rate_param',
   (...)
     20            'triang',
     21            'bounded_triang',)

File D:\anaconda\envs\zhangdexin\lib\site-packages\chaospy\__init__.py:11
      8 import os
      9 import importlib_metadata
---> 11 from numpoly import *
     13 import chaospy.descriptives
     14 import chaospy.distributions

File D:\anaconda\envs\zhangdexin\lib\site-packages\numpoly\__init__.py:34
     20 from .construct import (
     21     polynomial,
     22     aspolynomial,
   (...)
     30     variable,
     31 )
     32 from .sympy_ import to_sympy
---> 34 from .array_function import *
     35 from .poly_function import *
     36 from .utils import (
     37     bindex,
     38     cross_truncate,
     39     glexindex,
     40     glexsort,
     41 )

File D:\anaconda\envs\zhangdexin\lib\site-packages\numpoly\array_function\__init__.py:70
     68 from .positive import positive
     69 from .power import power
---> 70 from .prod import prod
     71 from .remainder import remainder as mod, remainder
     72 from .repeat import repeat

File D:\anaconda\envs\zhangdexin\lib\site-packages\numpoly\array_function\prod.py:13
      9 from ..baseclass import ndpoly, PolyLike
     10 from ..dispatch import implements
---> 13 @implements(numpy.prod, numpy.product)
     14 def prod(
     15     a: PolyLike,
     16     axis: Union[None, int, Sequence[int]] = None,
     17     dtype: Optional[numpy.typing.DTypeLike] = None,
     18     out: Optional[ndpoly] = None,
     19     keepdims: bool = False,
     20     **kwargs: Any,
     21 ) -> ndpoly:
     22     """
     23     Return the product of array elements over a given axis.
     24 
   (...)
     74 
     75     """
     76     a = numpoly.aspolynomial(a)

File D:\anaconda\envs\zhangdexin\lib\site-packages\numpy\__init__.py:424, in __getattr__(attr)
    421     import numpy.char as char
    422     return char.chararray
--> 424 raise AttributeError("module {!r} has no attribute "
    425                      "{!r}".format(__name__, attr))

AttributeError: module 'numpy' has no attribute 'product'
yoelcortes commented 4 months ago

@zasddsgg, downgrade your numpy version to lower than version 2.0. I'll get back to answering your most pressing questions at the end of the week.

Thanks,

zasddsgg commented 4 months ago

Thanks for your suggestion. I'll give it a try.

zasddsgg commented 4 months ago

HXN error will still report.

KeyError                                  Traceback (most recent call last)
File D:\anaconda\envs\zhangdexin\lib\site-packages\thermosteam\utils\registry.py:85, in Registry.__getattr__(self, ID)
     84 try:
---> 85     return self.data[ID]
     86 except KeyError:

KeyError: 'HXN'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[2], line 20
     17 from biosteam.utils import colors
     18 from matplotlib.ticker import AutoMinorLocator as AML
---> 20 import biorefineries.HP.analyses.models as HP_models
     23 # # Comment this out to run feedstock sugar content-price analysis
     24 # from biorefineries.HP.system_sugarcane import (
     25 #     HP_sys, HP_tea, R302, spec, get_GWP, get_ng_GWP, get_FEC, get_SPED,
   (...)
     28 
     29 # Comment this out to run titer-yield-productivity or feedstock carbohydrate content-price analysis
     30 from biorefineries.HP.system_light_lle_vacuum_distillation import (
     31     HP_sys, HP_tea, HP_lca, R302, spec, get_AA_MPSP,
     32     AA as product
     33 )

File D:\anaconda\envs\zhangdexin\lib\site-packages\biorefineries\HP\analyses\models.py:48
     46 HP_sys = find.system.HP_sys
     47 BT_sys = find.system.BT_sys
---> 48 HXN = find.unit.HXN
     50 system_feeds = [i for i in HP_sys.feeds if i.price] + \
     51     [i for i in BT_sys.feeds if i.price]
     52 system_products = [i for i in HP_sys.products if i.price] + \
     53     [i for i in BT_sys.products if i.price]

File D:\anaconda\envs\zhangdexin\lib\site-packages\thermosteam\utils\registry.py:87, in Registry.__getattr__(self, ID)
     85     return self.data[ID]
     86 except KeyError:
---> 87     raise AttributeError(f'{repr(ID)} not in registry')

AttributeError: 'HXN' not in registry
zasddsgg commented 4 months ago

It seems that I still downloaded the latest version of biorefineries, biosteam and thermosteam from the website https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park.git, https://github.com/BioSTEAMDevelopmentGroup/biosteam.git, https://github.com/BioSTEAMDevelopmentGroup/thermosteam.git. I tried to download through git clone https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/tree/427ec9ad260de62d97f1591cb46891207af8951a.git, but error fatal: repository 'https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/tree/427ec9ad260de62d97f1591cb46891207af8951a.git/' not found was reported. I try to download from the following location, but it seems that I still downloaded the latest version. 1

zasddsgg commented 4 months ago

I try to use git clone git:github.com/yoelcortes/Bioindustrial-Park/tree/master/biorefineries/BioSTEAM 2.x.x/biorefineries, while error ssh: Could not resolve hostname git: Name or service not known fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists will report. @sarangbhagwat Could I consult you the right URL or way to download and install?

sarangbhagwat commented 4 months ago

Hi @zasddsgg,

GitHub will allow you to clone from the repository link, i.e., git clone https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/

Once cloned, use git checkout 427ec9ad260de62d97f1591cb46891207af8951a.

Alternatively, if you would rather not clone the repository, you can simply navigate to the commit link for https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/tree/427ec9ad260de62d97f1591cb46891207af8951a, click Code > Download ZIP, and extract downloaded files to the folder you'd like.

Hope this helps!

zasddsgg commented 4 months ago

@sarangbhagwat Thank you for your recommendation. After git checkout 427ec9ad260de62d97f1591cb46891207af8951a, when I try to install with pip install., ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found will report. It looks like the 'setup.py 'file is missing (as in the following picture). I tried to use the 'setup.py' file here (https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park), but it still got error: subprocess-exited-with-error. 1

zasddsgg commented 3 months ago

@sarangbhagwat Hello, could you help with ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found. It seems to be lacking 'setup.py' file.

zasddsgg commented 1 month ago

Hello, can someone help with this problem? Now I can't repeat the results of TRY_analysis.py in the HP model due to lack of 'setup.py' file.