tomjanus / reemission

RE-emission is a collection of methods for calculating GHG emisisons from reservoirs
https://tomjanus.github.io/reemission/
GNU General Public License v3.0
5 stars 1 forks source link

Cannot Install #45

Closed XINGXING-ZHANG closed 6 months ago

XINGXING-ZHANG commented 7 months ago

Respect for your sharing! Pypi does not have reemission. What‘s version of python you have used when Install from loca source? I have try all Install methods. Cannot install still.

tomjanus commented 7 months ago

@XINGXING-ZHANG let me look into this over the weekend as this issue (#44) should have been fixed long time ago. For now, I can suggest the following workaround: Please git clone, e.g. git clone git@github.com:tomjanus/reemission.git or git clone https://github.com/tomjanus/reemission.git depending on your git/github setup and in the main directory where setup.py and setup.cfg are located, please run: pip install -e . This should install reemission in the editable mode, i.e. Python interpreter will read files directly from the repository. I shall fix the remaining problems in the next couple of days.

XINGXING-ZHANG commented 7 months ago

Thanku for reply. But when I use reemission --help. It keeps prompting for missing and error-prone components, including various libraries being absent, and issues arising from code version discrepancies due to Python versions. One fix leads to another, and so on.

1713069114452
XINGXING-ZHANG commented 7 months ago

and so on

1713069437746
XINGXING-ZHANG commented 7 months ago

continue

1713077254113
XINGXING-ZHANG commented 7 months ago

After fix one by one. It works now. Thank for u nice work tomjanus TypeError: The following constraints cannot be applied to typing.List[float]: 'ge' """ area_fractions: List[float] = Field( ge=0, description="Inundated area fractions of landuse types, -", default_factory=list) """ area_fractions: conlist( confloat(ge=0), description="Inundated area fractions of landuse types, -", default_factory=list ) = Field( description="Inundated area fractions of landuse types, -", default_factory=list) """ area_fractions: List[float] = Field( ge=0, description="Area fractions of landuse types, -", default_factory=list) """
area_fractions: conlist( confloat(ge=0), description="Area fractions of landuse types, -", default_factory=list ) = Field( ..., description="Area fractions of landuse types, -", default_factory=list)

1713077986000
XINGXING-ZHANG commented 7 months ago

Still have some problem, when run-demo. @tomjanus $ reemission run-demo C:\Users\User\anaconda3\Lib\site-packages\pydantic_internal_config.py:334: UserWarning: Valid config keys have changed in V2:

RUNNING CALCULATIONS FOR A SUBSET OF EXISTING AND FUTURE HYDROELECTRIC RESERVOIRS IN MYANMAR...

  1. Fetching the demo dabase of dams from external sources... The DAMS database folder C:\Users\User\reemission\examples\demo\reemission_demo_dam_db exists and has the correct size. Fetching the dam database from external sources not required.

  2. Fetching reservoir and catchment delineations from external sources... The DAMS database folder C:\Users\User\reemission\examples\demo\reemission_demo_delineations exists an d has the correct size. Fetching the dam database from external sources not required.

  3. Creating the outputs folder C:\Users\User\reemission\examples\demo\heet_outputs ... Folder already exists: C:\Users\User\reemission\examples\demo\heet_outputs

  4. Merging tabular data into a single CSV file and saving to C:\Users\User\reemission\examples\demo\he et_outputs\heet_outputs.csv ... C:\Users\User\anaconda3\Lib\site-packages\pydantic_internal_config.py:334: UserWarning: Valid config keys have changed in V2:

    • 'allow_population_by_field_name' has been renamed to 'populate_by_name'
    • 'fields' has been removed warnings.warn(message, UserWarning) Adding column: c_treatment_factor with value primary (mechanical) to data in file(s) C:\Users\User\ree mission\examples\demo\reemission_demo_delineations\batch_1\output_parameters.csv, C:\Users\User\reemis sion\examples\demo\reemission_demo_delineations\batch_2\output_parameters.csv, C:\Users\User\reemissio n\examples\demo\reemission_demo_delineations\batch_3\output_parameters.csv, C:\Users\User\reemission\e xamples\demo\reemission_demo_delineations\batch_4\output_parameters.csv Adding column: c_landuse_intensity with value low intensity to data in file(s) C:\Users\User\reemissio n\examples\demo\reemission_demo_delineations\batch_1\output_parameters.csv, C:\Users\User\reemission\e xamples\demo\reemission_demo_delineations\batch_2\output_parameters.csv, C:\Users\User\reemission\exam ples\demo\reemission_demo_delineations\batch_3\output_parameters.csv, C:\Users\User\reemission\example s\demo\reemission_demo_delineations\batch_4\output_parameters.csv Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\User\anaconda3\Scripts\reemission-heet.exe__main.py", line 7, in File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1128, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\rich_click\rich_command.py", line 126, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 754, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\reemission\src\reemission\integration\cli\cli.py", line 95, in process_tab_outpu ts heet_output.filter_columns( File "C:\Users\User\reemission\src\reemission\integration\heet\heet_tab_parser.py", line 161, in fil ter_columns raise ColumnsNotFoundError(missing_mandatory) reemission.integration.heet.custom_exceptions.ColumnsNotFoundError: Missing columns type
  5. Merging shape files for individual reservoirs into combined shape files... C:\Users\User\anaconda3\Lib\site-packages\pydantic_internal_config.py:334: UserWarning: Valid config keys have changed in V2:

    • 'allow_population_by_field_name' has been renamed to 'populate_by_name'
    • 'fields' has been removed warnings.warn(message, UserWarning) Concatenating shape files matching pattern R_.shp. Concatenating shapes for dam ids 33, 35, 101, 8, 9, 107, 47, 151, 120, 152, 127. Data saved to shape file C:\Users\User\reemission\examples\demo\heetoutputs\reservoirs.shp. Concatenating shape files matching pattern C.shp. Concatenating shapes for dam ids 33, 35, 101, 8, 9, 107, 47, 151, 120, 152, 127. Data saved to shape file C:\Users\User\reemission\examples\demo\heetoutputs\catchments.shp. Concatenating shape files matching pattern MS.shp. Concatenating shapes for dam ids 33, 35, 101, 8, 9, 107, 47, 151, 120, 152, 127. Data saved to shape file C:\Users\User\reemission\examples\demo\heetoutputs\rivers.shp. Concatenating shape files matching pattern PS.shp. Concatenating shapes for dam ids 33, 35, 101, 8, 9, 107, 47, 151, 120, 152, 127. Data saved to shape file C:\Users\User\reemission\examples\demo\heet_outputs\dams.shp.
  6. Converting HEET tabular data to the RE-Emission input JSON file C:\Users\User\anaconda3\Lib\site-packages\pydantic_internal_config.py:334: UserWarning: Valid config keys have changed in V2:

    • 'allow_population_by_field_name' has been renamed to 'populate_by_name'
    • 'fields' has been removed warnings.warn(message, UserWarning) Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\User\anaconda3\Scripts\reemission-heet.exe__main.py", line 7, in File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1128, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\rich_click\rich_command.py", line 126, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 754, in invoke return callback(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\reemission\src\reemission\integration\cli\cli.py", line 176, in tab_to_json converter.to_json(pathlib.Path(output_file)) File "C:\Users\User\reemission\src\reemission\integration\heet\heet_tab_to_json.py", line 120, in to _json heet_output = TabularHeetOutput.from_csv(self.tab_data_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\reemission\src\reemission\integration\heet\heet_tab_parser.py", line 124, in fro mcsv df = pd.read_csv(filename) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\util_decorators.py", line 211, in wrapper return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\util_decorators.py", line 331, in wrapper return func(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 950, in read_csv return _read(filepath_or_buffer, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 605, in _read parser = TextFileReader(filepath_or_buffer, **kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 1442, in _init _ self._engine = self._make_engine(f, self.engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 1735, in _make_e ngine self.handles = get_handle( ^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\common.py", line 856, in get_handle handle = open( ^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\User\reemission\examples\demo\ heet_outputs\heet_outputs.csv'
  7. Creating the outputs folder C:\Users\User\reemission\examples\demo\reemission_outputs ... Folder already exists: C:\Users\User\reemission\examples\demo\reemission_outputs

  8. Calculating GHG emissions with RE-EMISSION C:\Users\User\anaconda3\Lib\site-packages\pydantic_internal_config.py:334: UserWarning: Valid config keys have changed in V2:

    • 'allow_population_by_field_name' has been renamed to 'populate_by_name'
    • 'fields' has been removed warnings.warn(message, UserWarning)

      | | | | | _ () _(_) | |) | | __| | | ' ` | / / | |/ | ' \ | <| ||| || | | | | | _ _ \ | () | | | | || \___| |__|| || |||//|_/|| ||

    Usage: reemission calculate [OPTIONS] INPUT_FILE

    Try 'reemission calculate --help' for help ╭─ Error ────────────────────────────────────────────────────────────────────────────────────────────╮ │ Invalid value for 'INPUT_FILE': Path │ │ 'C:\Users\User\reemission\examples\demo\heet_outputs\reemission_inputs.json' does not │ │ exist. │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯

  9. Merging input and output data into shape files Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\User\anaconda3\Scripts\reemission.exe__main.py", line 7, in File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1128, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\rich_click\rich_command.py", line 126, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\click\core.py", line 754, in invoke return callback(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\reemission\src\reemission\cli\cli.py", line 377, in run_demo process_mya_case_study_results( File "C:\Users\User\reemission\examples\demo\postprocess_results.py", line 22, in process_mya_case_s tudy_results append_data_to_shapes(shp_folder, data_file, config) File "C:\Users\User\reemission\src\reemission\postprocessing\data_processing.py", line 179, in appen d_data_to_shapes tab_data = load_csv(data_file) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\reemission\src\reemission\utils.py", line 94, in load_csv return pd.read_csv(path) ^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\util_decorators.py", line 211, in wrapper return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\util_decorators.py", line 331, in wrapper return func(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 950, in read_csv return _read(filepath_or_buffer, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 605, in _read parser = TextFileReader(filepath_or_buffer, **kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 1442, in _init _ self._engine = self._make_engine(f, self.engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\parsers\readers.py", line 1735, in _make_e ngine self.handles = get_handle( ^^^^^^^^^^^ File "C:\Users\User\anaconda3\Lib\site-packages\pandas\io\common.py", line 856, in get_handle handle = open( ^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\User\reemission\examples\demo\ heet_outputs\heet_outputs.csv'

XINGXING-ZHANG commented 7 months ago

@tomjanus in step 4, the error happened

tomjanus commented 7 months ago

@XINGXING-ZHANG I suspect you've fixed the installation issues with missing rich-click package and with lack os support for pydantic v2. The dependency needs to be down,graded to v1. I shall update the repository shortly, including setuptools, the demo and the jupyter notebooks which are outdated due to some recent developments - mainly new input variables and input data templating with pydantic. Thank you for your patience.

tomjanus commented 6 months ago

Fixed in #74a7974