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

TypeError: 'module' object is not callable #36524

Closed
1 of 2 tasks
geo-mak opened this issue Jan 2, 2024 · 7 comments
Closed
1 of 2 tasks

TypeError: 'module' object is not callable #36524

geo-mak opened this issue Jan 2, 2024 · 7 comments
Labels
area:core invalid kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet

Comments

@geo-mak
Copy link

geo-mak commented Jan 2, 2024

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.7.2

What happened?

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/settings.py", line 55, in
TIMEZONE = pendulum.tz.timezone(tz)
^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'module' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/bin/airflow", line 5, in
from airflow.main import main
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/init.py", line 52, in
from airflow import configuration, settings
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/configuration.py", line 2340, in
secrets_backend_list = initialize_secrets_backends()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/configuration.py", line 2254, in initialize_secrets_backends
secrets_backend_cls = import_string(class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/utils/module_loading.py", line 37, in import_string
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/secrets/metastore.py", line 29, in
from airflow.utils.session import NEW_SESSION, provide_session
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/utils/session.py", line 24, in
from airflow import settings
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/airflow/settings.py", line 57, in
TIMEZONE = pendulum.tz.timezone("UTC")
^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'module' object is not callable

What you think should happen instead?

No response

How to reproduce

~ % airflow webserver -p 8080

Operating System

macOS-14.2.1-arm64-arm-64bit

Versions of Apache Airflow Providers

apache-airflow-providers-common-sql==1.10.0
apache-airflow-providers-ftp==3.7.0
apache-airflow-providers-http==4.8.0
apache-airflow-providers-imap==3.5.0
apache-airflow-providers-sqlite==3.7.0

Deployment

Virtualenv installation

Deployment details

Local installation with python 3.12.1

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@geo-mak geo-mak added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Jan 2, 2024
Copy link

boring-cyborg bot commented Jan 2, 2024

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@potiuk
Copy link
Member

potiuk commented Jan 2, 2024

Airfow Does not work on Python 3.12 (see prerequisites). One of the reason is migration to Pendulum 3 which is in progress #36281 - if you want to help with that by reviews and testing of that PR, you are most welcome.

@potiuk potiuk closed this as completed Jan 2, 2024
@potiuk potiuk added the invalid label Jan 2, 2024
@geo-mak
Copy link
Author

geo-mak commented Jan 2, 2024

Usually I get an error when installing if requirements are not satisfied (e.g python 3.12 is not supported).
I will investigate the issue in detail and see what I can do to solve it.
I appreciate your time.

@potiuk
Copy link
Member

potiuk commented Jan 2, 2024

Usually I get an error when installing if requirements are not satisfied (e.g python 3.12 is not supported). I will investigate the issue in detail and see what I can do to solve it. I appreciate your time.

Yes. It works if you have crystal ball and can foresee that future versions of things will not get supported. 2.7.2 was released around the time Python 3..12 and (as you might read in release notes) 2.7.3 was already released with < 3.12 limit - this is why you likely got 2.7.2 installed. https://airflow.apache.org/docs/apache-airflow/stable/release_notes.html#airflow-2-7-2-2023-10-12

Usually it's a good idea to read the documentation when you install software. You would have also learned that you should use constraints to install airflow in reproducible way - https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html and you would have found that there are no constraints for 3.12 for any Airflow version (including 2.7.2) - which is a very clear indication that it is not supported.

@geo-mak
Copy link
Author

geo-mak commented Jan 2, 2024

I appreciate your feedback.
Currently, I don't have anything urgent because Python 3.12 is not yet in production. I am testing to make sure things work before updating my workflows and pipelines later.
I have tried to search for the issue, but it was not obvious.

@potiuk
Copy link
Member

potiuk commented Jan 2, 2024

but it was not obvious.

Of course it was not.

That's exactly why we explain and recommend our users that they should use constraints. Many of the issues caused by incompatible dependencies produce non-obvious errors and following our recommendations on how you should install Airflow is a good way to avoid those kind of problems - which are inherently impossible to prevent in Python ecosystem when your application has 650+ dependencies.

We even did not stop at the documentation and went ahead and explained more details why it is like that and why you should use constraints in a few talks. This is the one I gave at Airflow Summit, explaining some whys:

https://airflowsummit.org/sessions/2023/mastering-dependencies-the-airflow-way/

@geo-mak
Copy link
Author

geo-mak commented Jan 2, 2024

Thank you for bringing this to my attention. I anticipate that there may be some challenges ahead, but nonetheless, I truly appreciate the time and effort invested in this project. It's unique and comprehensive in many ways. I look forward to working together to make it even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core invalid kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet
Projects
None yet
Development

No branches or pull requests

2 participants