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

Invalid Syntax Error When Importing hdfs_hook #10395

Closed
amirulmenjeni opened this issue Aug 19, 2020 · 6 comments
Closed

Invalid Syntax Error When Importing hdfs_hook #10395

amirulmenjeni opened this issue Aug 19, 2020 · 6 comments

Comments

@amirulmenjeni
Copy link

amirulmenjeni commented Aug 19, 2020

Apache Airflow Version: 1.10.10

Kubernetes version (if you are using kubernetes) (use kubectl version): N/A

Environment:

What happened:

Received syntax error when importing from airflow.hooks.hdfs_hook on Python 3.7.8. Here's the error message:

Traceback (most recent call last):
  File "subdags/copy_subset.py", line 9, in <module>
    from airflow.hooks.hdfs_hook import HDFSHook
  File "/home/amirul.menjeni/.pyenv/versions/dataops-flow-env/lib/python3.7/site-packages/airflow/hooks/hdfs_hook.py", line 24, in <module>
    from snakebite.client import Client, HAClient, Namenode, AutoConfigClient
  File "/home/amirul.menjeni/.pyenv/versions/dataops-flow-env/lib/python3.7/site-packages/snakebite/client.py", line 1473
    baseTime = min(time * (1L << retries), cap);
                            ^
SyntaxError: invalid syntax

What you expect to happen:

No syntax error when importing.

How to reproduce it:

  • Create python version 3.7.8 environment
  • Install airflow
  • Import airflow.hooks.hdfs_hook
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 19, 2020

Thanks for opening your first issue here! Be sure to follow the issue template!

@amirulmenjeni
Copy link
Author

Relevant: spotify/snakebite#216

@ephraimbuddy
Copy link
Contributor

You need to install snakebite-py3, snakebite does not work with python 3. I'll try and address this in master

@amirulmenjeni
Copy link
Author

Thanks, pip install snakebite-py3 fixed this issue.

@ephraimbuddy
Copy link
Contributor

@mik-laj, snakebite-py3 is a fork of snakebite and is not maintained by Spotify. Do you suggest we should use it in place of snakebite?

@turbaszek
Copy link
Member

Closing as the issue seems to be solved and it seems that snakebite-py3 is required for hdfs:

airflow/setup.py

Lines 296 to 298 in 12a652f

hdfs = [
'snakebite-py3',
]

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

3 participants