QSD-Group / QSDsan

Quantitative Sustainable Design (QSD) of sanitation and resource recovery systems.
https://qsdsan.com
Other
30 stars 12 forks source link

pip install exposan leads to _heat_exchanging.py out of date #102

Closed hccroll closed 1 year ago

hccroll commented 1 year ago

I recently installed exposan with the intent to simulate the BSM1 WWTF process. I used pip install exposan --user to avoid needing to uninstall other libraries.

Upon attempting to run from exposan import bsm1 I received the following error:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 from exposan import bsm1

File ~\AppData\Roaming\Python\Python310\site-packages\exposan\__init__.py:25
     22 es_path = os.path.dirname(__file__)
     23 del os, pkg_resources
---> 25 from . import utils

File ~\AppData\Roaming\Python\Python310\site-packages\exposan\utils.py:23
     21 from chaospy import distributions as shape
     22 from thermosteam.functional import rho_to_V
---> 23 from qsdsan import ImpactItem, sanunits as su
     24 from qsdsan.utils import time_printer, AttrSetter
     25 from . import es_path

File ~\AppData\Roaming\Python\Python310\site-packages\qsdsan\__init__.py:72
     68 from ._tea import *
     69 from ._lca import *
---> 72 from . import (
     73     _component,
     74     _components,
     75     _construction,
     76     _equipment,
     77     _impact_indicator,
     78     _impact_item,
     79     _lca,
     80     _process,
     81     _sanstream,
     82     _sanunit,
     83     _tea,
     84     _transportation,
     85     _waste_stream,
     86     equipments,
     87     processes,
     88     sanunits,
     89     stats,
     90     )
     92 utils._secondary_importing()
     93 for _slot in utils.doc_examples.__all__:

File ~\AppData\Roaming\Python\Python310\site-packages\qsdsan\sanunits\__init__.py:44
     42 from ._encapsulation_bioreactor import *
     43 from ._excretion import *
---> 44 from ._heat_exchanging import *
     45 from ._junction import *
     46 from ._non_reactive import *

File ~\AppData\Roaming\Python\Python310\site-packages\qsdsan\sanunits\_heat_exchanging.py:27
     25 from math import ceil, pi
     26 from biosteam.units import HXprocess as HXP, HXutility as HXU
---> 27 from biosteam.units.facilities import HeatExchangerNetwork as HXN
     28 from biosteam.units.design_tools.specification_factors import material_densities_lb_per_ft3
     29 from biosteam.exceptions import bounds_warning, DesignWarning

ModuleNotFoundError: No module named 'biosteam.units.facilities'

Looking at the native _heat_exchanging.py file in QSDsan, it looks like the import lines do not match with the version installed through original pip command.

Native QSDsan File:

from warnings import warn
from math import ceil, pi
from biosteam import HeatExchangerNetwork as HXN, HXprocess as HXP, HXutility as HXU
from biosteam.units.design_tools.specification_factors import material_densities_lb_per_ft3
from biosteam.exceptions import bounds_warning, DesignWarning
from biosteam.units.design_tools import flash_vessel_design
from .. import SanUnit, Construction
from ..utils import auom

Pip download File:

import biosteam as bst
from warnings import warn
from math import ceil, pi
from biosteam.units import HXprocess as HXP, HXutility as HXU
from biosteam.units.facilities import HeatExchangerNetwork as HXN
from biosteam.units.design_tools.specification_factors import material_densities_lb_per_ft3
from biosteam.exceptions import bounds_warning, DesignWarning
from biosteam.units.design_tools import flash_vessel_design
from .. import SanUnit, Construction
from ..utils import auom

Replacing the downloaded block with the native block fixes the error, and I was able to reproduce the dynamic simulation example, though I have not yet tested additional simulations.

Versions of the following packages:

Operating on windows 11

yalinli2 commented 1 year ago

Thanks @hccroll for reporting this! Yea the pip version is really outdated, biosteam reorganized the modules at some point. I'll leave this issue until I release a new version, which hopefully will happen within the next week.

yalinli2 commented 1 year ago

Just released v1.3.0 and this should be fixed now, thanks!