Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Scenario Difference File #48

Closed
YuKa90 opened this issue Nov 14, 2024 · 16 comments
Closed

Problems with Scenario Difference File #48

YuKa90 opened this issue Nov 14, 2024 · 16 comments

Comments

@YuKa90
Copy link

YuKa90 commented Nov 14, 2024

Hi there,

I'm completely new to this, so hopefully it's not a noob question and at the right place.

I'm using
Activity-Browser: 2.10.3
bw2data: 3.6.6
bw2io: 1.8.2
bw2calc: 0.8.12
ecoinvent: 3.10 consequential

Problem 1: Each time I'm trying to create a superstructure, I get following error:

Created database: test_sup_ssp1-ndc_30_60
09:15:38 | ERROR | AttributeError: 'ABSignals' object has no attribute 'databases_changed'
Traceback (most recent call last):
  File "D:\Anaconda\envs\ab\Lib\site-packages\ab_plugin_scenariolink\layouts\tabs\right.py", line 76, in generate_database
    ab_signals.databases_changed.emit()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ABSignals' object has no attribute 'databases_changed'

I tried to cancel activity-browser and restarted it. The Scenario Difference File was created, but another error occured when I tried to use it with a simply test-dataset. (Since the CSV-file was created using comma as a seperator, I used chose comma as separator in AB).

Problem 2:

11:36:42 | INFO | Loading Scenario file. This may take a while for large files
11:36:45 | ERROR | SyntaxError: invalid syntax (<unknown>, line 0)
Traceback (most recent call last):
  File "D:\Anaconda\envs\ab\Lib\site-packages\activity_browser\bwutils\superstructure\utils.py", line 81, in wrapper
    result = func(*args)
             ^^^^^^^^^^^
  File "D:\Anaconda\envs\ab\Lib\site-packages\activity_browser\layouts\tabs\LCA_setup.py", line 603, in load_action
    df = ABCSVImporter.read_file(path, separator=separator)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Anaconda\envs\ab\Lib\site-packages\activity_browser\bwutils\superstructure\file_imports.py", line 223, in read_file
    df = pd.read_csv(
         ^^^^^^^^^^^^
  File "D:\Anaconda\envs\ab\Lib\site-packages\pandas\io\parsers\readers.py", line 1026, in read_csv
    return _read(filepath_or_buffer, kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Anaconda\envs\ab\Lib\site-packages\pandas\io\parsers\readers.py", line 626, in _read
    return parser.read(nrows)
           ^^^^^^^^^^^^^^^^^^
  File "D:\Anaconda\envs\ab\Lib\site-packages\pandas\io\parsers\readers.py", line 1923, in read
    ) = self._engine.read(  # type: ignore[attr-defined]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Anaconda\envs\ab\Lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 234, in read
    chunks = self._reader.read_low_memory(nrows)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "parsers.pyx", line 838, in pandas._libs.parsers.TextReader.read_low_memory
  File "parsers.pyx", line 921, in pandas._libs.parsers.TextReader._read_rows
  File "parsers.pyx", line 1045, in pandas._libs.parsers.TextReader._convert_column_data
  File "parsers.pyx", line 2116, in pandas._libs.parsers._apply_converter
  File "D:\Anaconda\envs\ab\Lib\ast.py", line 64, in literal_eval
    node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Anaconda\envs\ab\Lib\ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<unknown>", line 0

SyntaxError: invalid syntax

I would be thankful, if someone could help me.

Best regards

@BaristaShaun
Copy link

I also face exactly same problem with you!

@romainsacchi
Copy link
Collaborator

Hi @YuKa90 @BaristaShaun do you confirm you have ab-plugin-scenariolink==0.1.2?

@YuKa90
Copy link
Author

YuKa90 commented Nov 15, 2024

@romainsacchi , thanks for taking on this problem so fast. From my side I can confirm 0.1.2 . If you need further details/data, please let know. This superstructure approach is such an amazing and helpful tool

@romainsacchi
Copy link
Collaborator

Hi @marc-vdm, did not we fix the AttributeError: 'ABSignals' object has no attribute 'databases_changed' issue?

@romainsacchi
Copy link
Collaborator

As far as I know, the first issue does not prevent the completion of the process. This means the database, and the SDF are produced anyway, despite AB freezing. So you should see the database in the database list.

@romainsacchi
Copy link
Collaborator

Regarding Issue #2, I'm not sure. But could you try loading it anyway with ";" as a separator?

@BaristaShaun
Copy link

@romainsacchi
Hi!
I have 0.1.2 version and I also try it with ";" as a separator.
But it has this error.
image

@YuKa90
Copy link
Author

YuKa90 commented Nov 15, 2024

@romainsacchi Hi! I have 0.1.2 version and I also try it with ";" as a separator. But it has this error. image

same here

@YuKa90
Copy link
Author

YuKa90 commented Nov 15, 2024

Problem #1: yes, database seems to be created and is accessible in AB

@romainsacchi
Copy link
Collaborator

@YuKa90 Any chance you could send me the SDF somehow? My email address is r_s at me.com

@marc-vdm
Copy link
Member

Created database: test_sup_ssp1-ndc_30_60
09:15:38 | ERROR | AttributeError: 'ABSignals' object has no attribute 'databases_changed'
Traceback (most recent call last):
  File "D:\Anaconda\envs\ab\Lib\site-packages\ab_plugin_scenariolink\layouts\tabs\right.py", line 76, in  generate_database
   ab_signals.databases_changed.emit()
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ABSignals' object has no attribute 'databases_changed'

This is resolved in the next version of scenariolink. The other problems related to Activity Browser, so I will close this

@YuKa90
Copy link
Author

YuKa90 commented Nov 20, 2024

@romainsacchi I sent you a link via WeTransfer, since the file was to large so send vie email

@romainsacchi
Copy link
Collaborator

romainsacchi commented Nov 27, 2024

@YuKa90 @BaristaShaun, I have uploaded a new version of ab-plugin-scenariolink, which hopefully fixes your issues.
Could you update it (conda update ab-plugin-scenariolink)?

After the update, conda list should give you:

ab-plugin-scenariolink   0.1.4
activity-browser   2.10.3 
unfold   2024-11-27 or 1.2.2

Can you then try again the database creation process?

@YuKa90
Copy link
Author

YuKa90 commented Nov 28, 2024

@romainsacchi, thanks for keeping this alive. I tried after all mentioned packages were updated to the versions above:

  • The SDF was generated and exported
  • When writing the superstructure-database, following errer occured

Writing superstructure database... 11:47:28 | ERROR | Failed to unfold database: Exchange links to non-existent activity: {'amount': 1.0, 'categories': None, 'input': (' test_11_28_sup_rem_ssp1_ndc_50_60', 'ab7d8cb4310a4ed58148f897dcaf173f'), 'location': 'RoW', 'name': 'formaldehyde production, methanol oxidation', 'product': 'formaldehyde', 'type': 'production', 'unit': 'kilogram'}

@romainsacchi
Copy link
Collaborator

@YuKa90 ok, can you try to click here

Screenshot 2024-11-28 at 11 56 36

and try again?

@YuKa90
Copy link
Author

YuKa90 commented Nov 28, 2024

@romainsacchi woohoo, so far it's working! props to you , this saved me a lot of work, I'm happy :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants