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: "Cannot compare tz-naive and tz-aware datetime-like objects." #5

Closed
Natenom opened this issue Nov 15, 2023 · 3 comments
Closed
Labels
type: bug Something isn't working
Milestone

Comments

@Natenom
Copy link

Natenom commented Nov 15, 2023

Aus dem Log, wenn man die Startseite aufruft. Aktuelle Version aus master von vor ein paar Minuten.

Hab nach dem Pullen ein poetry install gefolgt von poetry update ausgeführt.

Hier das Log:

2023-11-15 21:59:56 geo_activity_playground.webui.app ERROR Exception on /meta-plot/distance-last-30-days.json [GET]
Traceback (most recent call last):
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arrays/datetimelike.py", line 531, in _validate_comparison_value
    self._check_compatible_with(other)
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arrays/datetimes.py", line 528, in _check_compatible_with
    self._assert_tzawareness_compat(other)
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arrays/datetimes.py", line 770, in _assert_tzawareness_compat
    raise TypeError(
TypeError: Cannot compare tz-naive and tz-aware datetime-like objects.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arrays/datetimelike.py", line 941, in _cmp_method
    other = self._validate_comparison_value(other)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arrays/datetimelike.py", line 534, in _validate_comparison_value
    raise InvalidComparison(other) from err
pandas.errors.InvalidComparison: 2023-10-15 20:59:56.646037+00:00

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my/src/github/geo-activity-playground/geo_activity_playground/webui/app.py", line 45, in meta_plot
    return meta_plots[name](repository.meta.reset_index())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my/src/github/geo-activity-playground/geo_activity_playground/core/plots.py", line 61, in distance_last_30_days_meta_plot
    meta.loc[meta["start"] > before_30_days],
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/ops/common.py", line 76, in new_method
    return method(self, other)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arraylike.py", line 56, in __gt__
    return self._cmp_method(other, operator.gt)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/series.py", line 5799, in _cmp_method
    res_values = ops.comparison_op(lvalues, rvalues, op)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/ops/array_ops.py", line 332, in comparison_op
    res_values = op(lvalues, rvalues)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/ops/common.py", line 76, in new_method
    return method(self, other)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arraylike.py", line 56, in __gt__
    return self._cmp_method(other, operator.gt)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/arrays/datetimelike.py", line 943, in _cmp_method
    return invalid_comparison(self, other, op)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/pandas/core/ops/invalid.py", line 40, in invalid_comparison
    raise TypeError(f"Invalid comparison between dtype={left.dtype} and {typ}")
TypeError: Invalid comparison between dtype=datetime64[ns] and Timestamp
2023-11-15 21:59:56 werkzeug INFO 127.0.0.1 - - [15/Nov/2023 21:59:56] "GET /meta-plot/distance-last-30-days.json HTTP/1.1" 500 -
@martin-ueding martin-ueding added the type: bug Something isn't working label Nov 19, 2023
@martin-ueding martin-ueding added this to the 0.6.0 milestone Nov 24, 2023
martin-ueding added a commit that referenced this issue Nov 24, 2023
@martin-ueding
Copy link
Owner

Ich habe das jetzt versucht zu beheben. Du müsstest einmal den Cache löschen, damit die Dateien neu extrahiert werden. Dann sollte die Zeitzone entsprechend eingefügt werden. Vielleicht stimmen dann die Zeiten nicht, weil ich UTC angenommen habe. Da müsste man noch überlegen, wie man da die richtige Zeitzone reinbekommen kann.

Falls es wieder einen Fehler gibt, kannst du mal nach zwei Zeilen in der Ausgabe vor der Fehlermeldung suchen. Das sollte dann ungefähr so aussehen:

Timestamp('2019-08-04 11:34:36+0000', tz='UTC')
Timestamp('2023-10-24 07:53:14.425367+0000', tz='UTC')

@martin-ueding martin-ueding removed this from the 0.6.0 milestone Nov 24, 2023
@Natenom
Copy link
Author

Natenom commented Nov 24, 2023

Habe seit der 0.6.0 einen anderen Fehler beim Aufruf der Startseite und bei einzelnen Tracks:

Timestamp('2023-01-27 12:54:14+0000', tz='UTC')
Timestamp('2023-10-24 22:48:11.067728+0000', tz='UTC')
2023-11-24 23:48:11 geo_activity_playground.webui.app ERROR Exception on / [GET]
Traceback (most recent call last):
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my/src/github/geo-activity-playground/geo_activity_playground/webui/app.py", line 33, in index
    return render_template("index.html.j2", **entry_controller.render())
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my/src/github/geo-activity-playground/geo_activity_playground/webui/entry_controller.py", line 19, in render
    "distance_last_30_days_plot": self.distance_last_30_days_meta_plot(),
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my/src/github/geo-activity-playground/geo_activity_playground/webui/entry_controller.py", line 54, in distance_last_30_days_meta_plot
    .to_json(format="vega")
     ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/altair/vegalite/v5/api.py", line 1002, in to_json
    spec = self.to_dict(
           ^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/altair/vegalite/v5/api.py", line 2713, in to_dict
    return super().to_dict(
           ^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/altair/vegalite/v5/api.py", line 953, in to_dict
    return _compile_with_vegafusion(vegalite_spec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/altair/utils/_vegafusion_data.py", line 163, in compile_with_vegafusion
    transformed_vega_spec, warnings = vf.runtime.pre_transform_spec(
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/.cache/pypoetry/virtualenvs/geo-activity-playground-SZxD7HkL-py3.11/lib/python3.11/site-packages/vegafusion/runtime.py", line 307, in pre_transform_spec
    new_spec, warnings = self.embedded_runtime.pre_transform_spec(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: DataFusion error: Arrow error: Invalid argument error: The data type type Null has no natural order
    Context[0]: Failed to get node value

2023-11-24 23:48:11 werkzeug INFO 127.0.0.1 - - [24/Nov/2023 23:48:11] "GET / HTTP/1.1" 500 -

@martin-ueding martin-ueding added this to the 0.6.0 milestone Nov 26, 2023
@martin-ueding
Copy link
Owner

Das ist ein gutes Zeichen. Den Fehler hatte ich eben mit deiner Datei auch schon, das ist ein anderes Problem. Das habe ich auch schon behoben für 0.8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants