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

SQLFluff failing due to ModuleNotFoundError: No module named 'pytz' #70

Closed
jasluong opened this issue Feb 28, 2023 · 4 comments
Closed

Comments

@jasluong
Copy link

Hi all,

sqlfluff has been failing for us since this morning with the following error:

ModuleNotFoundError: No module named 'pytz'

Rest of the error is below:

Traceback (most recent call last):
    File "/usr/local/bin/sqlfluff", line 5, in <module>
      from sqlfluff.cli.commands import cli
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/cli/commands.py", line 518, in <module>
      def lint(
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/cli/commands.py", line 218, in core_options
      get_plugin_manager().hook.get_templaters()
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/plugin/host.py", line 12, in get_plugin_manager
      pm.load_setuptools_entrypoints(project_name)
    File "/usr/local/lib/python3.9/site-packages/pluggy/_manager.py", line [287](https://github.com/motorway/motorway-dbt/actions/runs/4292196911/jobs/7478336098#step:4:289), in load_setuptools_entrypoints
      plugin = ep.load()
    File "/usr/local/lib/python3.9/importlib/metadata.py", line 86, in load
      module = import_module(match.group('module'))
    File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "/usr/local/lib/python3.9/site-packages/sqlfluff_templater_dbt/__init__.py", line 3, in <module>
      from sqlfluff_templater_dbt.templater import DbtTemplater
    File "/usr/local/lib/python3.9/site-packages/sqlfluff_templater_dbt/templater.py", line 13, in <module>
      from dbt.config import read_user_config
    File "/usr/local/lib/python3.9/site-packages/dbt/config/__init__.py", line 2, in <module>
      from .profile import Profile, read_user_config  # noqa
    File "/usr/local/lib/python3.9/site-packages/dbt/config/profile.py", line 10, in <module>
      from dbt.contracts.connection import Credentials, HasCredentials
    File "/usr/local/lib/python3.9/site-packages/dbt/contracts/connection.py", line 28, in <module>
      from dbt.contracts.util import Replaceable
    File "/usr/local/lib/python3.9/site-packages/dbt/contracts/util.py", line 7, in <module>
      from dbt import deprecations
    File "/usr/local/lib/python3.9/site-packages/dbt/deprecations.py", line 6, in <module>
      import dbt.tracking
    File "/usr/local/lib/python3.9/site-packages/dbt/tracking.py", line 25, in <module>
      import pytz
  ModuleNotFoundError: No module named 'pytz'

Screenshot below:

image

@yu-iskw
Copy link
Owner

yu-iskw commented Feb 28, 2023

@jasluong Thank you for raising the issue. I was faced with the same issue in a different situation. I haven't completely identify the root cause why the issue started. However, as I was able to solve the issue just by installing pytz besides dbt-core.

@yu-iskw
Copy link
Owner

yu-iskw commented Feb 28, 2023

It seems that the dependency on pytz was added to dbt-core just right now.

dbt-labs/dbt-core#7077

According to the released versions, the fixed versions are released as dbt-core 1.2.5, 1.3.3 and 1.4.4. I think we have to do nothing to solve the issue. If the issue will continue, please let me know.

https://github.com/dbt-labs/dbt-core/releases

@yu-iskw
Copy link
Owner

yu-iskw commented Feb 28, 2023

Let me close the issue, as I have made sure it was solved in the integration tests of the github repository by adding the dependency on pytz in dbt-core. If the issue will continue, please let me know.

#71

@yu-iskw yu-iskw closed this as completed Feb 28, 2023
@jasluong
Copy link
Author

jasluong commented Mar 1, 2023

Hey @yu-iskw thanks for looking into this. It looks to be working fine now - thanks for the help!

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