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

Error on benchmark imports #480

Closed
Hrovatin opened this issue Feb 10, 2025 · 2 comments
Closed

Error on benchmark imports #480

Hrovatin opened this issue Feb 10, 2025 · 2 comments
Assignees

Comments

@Hrovatin
Copy link
Collaborator

I tried to add new benchmarks, but when importing the benchmark classes I get an error (starting from when I pulled main today in the morning):

# Change to directory where I have baybe github folder (parent folder of benchmarks)

# Same err occurs if importing from benchmarks directly
from benchmarks.definition import (
    ConvergenceBenchmark,
    ConvergenceBenchmarkSettings,
)

Traceback (most recent call last):
  File "/Users/karinhrovatin/miniforge3/envs/baybe/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-b4d93ed0baeb>", line 1, in <module>
    from benchmarks import (
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/karinhrovatin/Documents/code/baybe/benchmarks/__init__.py", line 3, in <module>
    from benchmarks.definition import (
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/karinhrovatin/Documents/code/baybe/benchmarks/definition/__init__.py", line 3, in <module>
    from benchmarks.definition.base import (
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/karinhrovatin/Documents/code/baybe/benchmarks/definition/base.py", line 77, in <module>
    def unstructure_benchmark(benchmark: Benchmark, _) -> dict:
TypeError: BaseConverter.register_unstructure_hook() missing 1 required positional argument: 'func'

With @fabianliebig we already tried the below change in the code, but that did not help:

# Added underscore to function definition
@converter.register_unstructure_hook
def unstructure_benchmark(benchmark: Benchmark, _) -> dict:

Also, this does not happen when Fabian tries to run it on his computer.

@AVHopp @AdrianSosic any ideas how to deal wit this?

@AdrianSosic
Copy link
Collaborator

Hi @Hrovatin, before I start investigating, can you quickly confirm that you are using one of the newer cattrs versions as specified in the updated pyproject.toml?

@Hrovatin
Copy link
Collaborator Author

Thanks @AdrianSosic , I forgot to re-run pip install after pull - so it got resolved now.

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

2 participants