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

Install dataclasses dependency only in python 3.6 #67

Merged
merged 2 commits into from
Dec 3, 2023

Conversation

ChogirmaliYigit
Copy link
Collaborator

@ChogirmaliYigit ChogirmaliYigit commented Dec 3, 2023

Environment info

Platform: Linux
Python version: 3.11

It works fine on local machine, but gives this error when runs on Azure server. It seems related to an incompatibility of python > 3.6 with package dataclasses. Sentry SDK is one of them. Fix makes sure to only install dataclasses on py3.6

2023-12-02T20:53:40.756705382Z Traceback (most recent call last):
2023-12-02T20:53:40.756711874Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2023-12-02T20:53:40.756716313Z     worker.init_process()
2023-12-02T20:53:40.756719769Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
2023-12-02T20:53:40.756723706Z     self.load_wsgi()
2023-12-02T20:53:40.756728225Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2023-12-02T20:53:40.756732453Z     self.wsgi = self.app.wsgi()
2023-12-02T20:53:40.756736611Z                 ^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756740478Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
2023-12-02T20:53:40.756744786Z     self.callable = self.load()
2023-12-02T20:53:40.756749706Z                     ^^^^^^^^^^^
2023-12-02T20:53:40.756757410Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2023-12-02T20:53:40.756763692Z     return self.load_wsgiapp()
2023-12-02T20:53:40.756767669Z            ^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756771276Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2023-12-02T20:53:40.756774883Z     return util.import_app(self.app_uri)
2023-12-02T20:53:40.756778269Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756790763Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/gunicorn/util.py", line 359, in import_app
2023-12-02T20:53:40.756795461Z     mod = importlib.import_module(module)
2023-12-02T20:53:40.756805070Z           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756809347Z   File "/opt/python/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
2023-12-02T20:53:40.756812874Z     return _bootstrap._gcd_import(name[level:], package, level)
2023-12-02T20:53:40.756816341Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756820027Z   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
2023-12-02T20:53:40.756824025Z   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
2023-12-02T20:53:40.756827752Z   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
2023-12-02T20:53:40.756912080Z   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
2023-12-02T20:53:40.756918573Z   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
2023-12-02T20:53:40.756922300Z   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2023-12-02T20:53:40.756926037Z   File "/tmp/8dbf3781caa3cf9/config/wsgi.py", line 15, in <module>
2023-12-02T20:53:40.756929994Z     application = get_wsgi_application()
2023-12-02T20:53:40.756933831Z                   ^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756939312Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2023-12-02T20:53:40.756943991Z     django.setup(set_prefix=False)
2023-12-02T20:53:40.756948629Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/django/__init__.py", line 19, in setup
2023-12-02T20:53:40.756953037Z     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2023-12-02T20:53:40.756957596Z                       ^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756961463Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/django/conf/__init__.py", line 102, in __getattr__
2023-12-02T20:53:40.756965140Z     self._setup(name)
2023-12-02T20:53:40.756969098Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/django/conf/__init__.py", line 89, in _setup
2023-12-02T20:53:40.756973606Z     self._wrapped = Settings(settings_module)
2023-12-02T20:53:40.756977824Z                     ^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756982453Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/django/conf/__init__.py", line 217, in __init__
2023-12-02T20:53:40.756987332Z     mod = importlib.import_module(self.SETTINGS_MODULE)
2023-12-02T20:53:40.756991039Z           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.756994485Z   File "/opt/python/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
2023-12-02T20:53:40.757004584Z     return _bootstrap._gcd_import(name[level:], package, level)
2023-12-02T20:53:40.757009463Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757013882Z   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
2023-12-02T20:53:40.757018280Z   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
2023-12-02T20:53:40.757021987Z   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
2023-12-02T20:53:40.757025594Z   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
2023-12-02T20:53:40.757029511Z   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
2023-12-02T20:53:40.757034040Z   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2023-12-02T20:53:40.757038518Z   File "/tmp/8dbf3781caa3cf9/config/settings.py", line 33, in <module>
2023-12-02T20:53:40.757042736Z     sentry_sdk.init(
2023-12-02T20:53:40.757046373Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/sentry_sdk/hub.py", line 131, in _init
2023-12-02T20:53:40.757050300Z     client = Client(*args, **kwargs)  # type: ignore
2023-12-02T20:53:40.757055049Z              ^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757059397Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/sentry_sdk/client.py", line 162, in __init__
2023-12-02T20:53:40.757063745Z     self._init_impl()
2023-12-02T20:53:40.757067512Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/sentry_sdk/client.py", line 268, in _init_impl
2023-12-02T20:53:40.757071210Z     self.integrations = setup_integrations(
2023-12-02T20:53:40.757074836Z                         ^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757079355Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/sentry_sdk/integrations/__init__.py", line 119, in setup_integrations
2023-12-02T20:53:40.757083853Z     for integration_cls in iter_default_integrations(
2023-12-02T20:53:40.757087400Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/sentry_sdk/integrations/__init__.py", line 46, in iter_default_integrations
2023-12-02T20:53:40.757091147Z     yield getattr(import_module(module), cls)
2023-12-02T20:53:40.757094543Z                   ^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757098902Z   File "/opt/python/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
2023-12-02T20:53:40.757103821Z     return _bootstrap._gcd_import(name[level:], package, level)
2023-12-02T20:53:40.757108069Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757112637Z   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
2023-12-02T20:53:40.757117136Z   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
2023-12-02T20:53:40.757125742Z   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
2023-12-02T20:53:40.757129880Z   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
2023-12-02T20:53:40.757134368Z   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
2023-12-02T20:53:40.757139318Z   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2023-12-02T20:53:40.757143666Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/sentry_sdk/integrations/flask.py", line 30, in <module>
2023-12-02T20:53:40.757148014Z     from flask import Flask, Request  # type: ignore
2023-12-02T20:53:40.757151981Z     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757156299Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/flask/__init__.py", line 1, in <module>
2023-12-02T20:53:40.757161279Z     from . import json as json
2023-12-02T20:53:40.757165547Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/flask/json/__init__.py", line 6, in <module>
2023-12-02T20:53:40.757169224Z     from ..globals import current_app
2023-12-02T20:53:40.757172420Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/flask/globals.py", line 6, in <module>
2023-12-02T20:53:40.757176047Z     from werkzeug.local import LocalProxy
2023-12-02T20:53:40.757179453Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/werkzeug/__init__.py", line 2, in <module>
2023-12-02T20:53:40.757183040Z     from .test import Client as Client
2023-12-02T20:53:40.757186857Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/werkzeug/test.py", line 35, in <module>
2023-12-02T20:53:40.757190544Z     from .sansio.multipart import Data
2023-12-02T20:53:40.757193800Z   File "/opt/python/3.11.4/lib/python3.11/site-packages/werkzeug/sansio/multipart.py", line 18, in <module>
2023-12-02T20:53:40.757197427Z     @dataclass(frozen=True)
2023-12-02T20:53:40.757200562Z      ^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757203849Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/dataclasses.py", line 950, in wrap
2023-12-02T20:53:40.757207546Z     return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
2023-12-02T20:53:40.757211062Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757215030Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/dataclasses.py", line 800, in _process_class
2023-12-02T20:53:40.757219077Z     cls_fields = [_get_field(cls, name, type)
2023-12-02T20:53:40.757223035Z                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757226882Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/dataclasses.py", line 800, in <listcomp>
2023-12-02T20:53:40.757230859Z     cls_fields = [_get_field(cls, name, type)
2023-12-02T20:53:40.757238353Z                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757242171Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/dataclasses.py", line 659, in _get_field
2023-12-02T20:53:40.757246379Z     if (_is_classvar(a_type, typing)
2023-12-02T20:53:40.757250737Z         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757254804Z   File "/tmp/8dbf3781caa3cf9/antenv/lib/python3.11/site-packages/dataclasses.py", line 550, in _is_classvar
2023-12-02T20:53:40.757259283Z     return type(a_type) is typing._ClassVar
2023-12-02T20:53:40.757263371Z                            ^^^^^^^^^^^^^^^^
2023-12-02T20:53:40.757266917Z AttributeError: module 'typing' has no attribute '_ClassVar'

Thanks @Shamsidinkhon

@Muhammadali-Akbarov Muhammadali-Akbarov merged commit 3fd2181 into master Dec 3, 2023
6 checks passed
@Muhammadali-Akbarov Muhammadali-Akbarov deleted the hotfix/dataclasses branch December 13, 2023 16:30
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

Successfully merging this pull request may close these issues.

2 participants