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

SyntaxError: future feature annotations is not defined when attempting to make for awx #9357

Closed
pknomad opened this issue Jun 17, 2021 · 3 comments

Comments

@pknomad
Copy link

pknomad commented Jun 17, 2021

Describe the bug
A clear and concise description of what the bug is.

I'm getting an exception occurred error when attempting to deploy an AWX server on a CentOS 8 VM.

Exception occurred:
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/awxkit/cli/sphinx.py", line 4, in <module>
    from sphinxcontrib.autoprogram import AutoprogramDirective
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/sphinxcontrib/autoprogram.py", line 11
    from __future__ import annotations
                                     ^
SyntaxError: future feature annotations is not defined
The full traceback has been saved in /tmp/sphinx-err-z7kvlz1c.log, if you want to report the issue to the developer
s.

To Reproduce
Steps to reproduce the behavior:

$ TOWER_HOST=SOMEURL TOWER_USERNAME=SOMEUSERNAME TOWER_SECRET=SECRET make clean html

Expected behavior
AWX Server 19.X should be running successfully

Your project
https://github.com/ansible/

Screenshots
If applicable, add screenshots to help explain your problem.

Environment info

  • OS: CentOS 8.4.2105
  • Python version: 3.6.8
  • Sphinx version: 4.0.2 (also tried 3.5.4)
  • Sphinx extensions: sphinxcontrib-autoprogram
  • Extra tools: Currently hosted on GCP

Additional context
I was browsing for solution to the problem but it seems like sphinx is currently using something that is only available on python3.7+? For CentOS python3.7 has been skipped so it seems like the user either needs to update to 3.8 or if they don't want to upgrade python for different reasons, use a different OS like Ubuntu 20.0.X+ that uses 3.8.4 by default. Haven't tested it yet but will be giving a try later today.

https://stackoverflow.com/questions/52889746/cant-import-annotations-from-future/52890129
ansible/awx#4879

Here is the tracelog:

Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make: *** [Makefile:20: html] Error 2
[j9kgcp1@awx docs]$ cat /tmp/sphinx-err-
sphinx-err-_56kiue2.log  sphinx-err-e64miel9.log  sphinx-err-rctvujtj.log  
sphinx-err-8yw78ji0.log  sphinx-err-ffy165qs.log  sphinx-err-z7kvlz1c.log  
[j9kgcp1@awx docs]$ cat /tmp/sphinx-err-ffy165qs.log 
# Sphinx version: 3.5.4
# Python version: 3.6.8 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 3.0.1
# Last messages:
# Loaded extensions:
Traceback (most recent call last):
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/sphinx/cmd/build.py", line 279, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/sphinx/application.py", line 245, in __init__
    self.setup_extension(extension)
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/sphinx/application.py", line 402, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/sphinx/registry.py", line 417, in load_extension
    mod = import_module(extname)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/awxkit/cli/sphinx.py", line 4, in <module>
    from sphinxcontrib.autoprogram import AutoprogramDirective
  File "/home/j9kgcp1/.local/lib/python3.6/site-packages/sphinxcontrib/autoprogram.py", line 11
    from __future__ import annotations
                                     ^
SyntaxError: future feature annotations is not defined
@pknomad
Copy link
Author

pknomad commented Jun 18, 2021

Tried on Ubuntu 20.04 (this time on AWS) with Python 3.8.5 with different versions - 4.0.2, 2.2.0, and even 1.8.5 all yield the same error message:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/cmd/build.py", line 300, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3/dist-packages/sphinx/application.py", line 228, in __init__
    self.setup_extension(extension)
  File "/usr/lib/python3/dist-packages/sphinx/application.py", line 449, in setup_extension
    self.registry.load_extension(self, extname)
  File "/usr/lib/python3/dist-packages/sphinx/registry.py", line 472, in load_extension
    mod = __import__(extname, None, None, ['setup'])
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/cli/sphinx.py", line 76, in <module>
    parser = render()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/cli/sphinx.py", line 52, in render
    cli.authenticate()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/cli/client.py", line 95, in authenticate
    self.root.load_session().get()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/api/pages/base.py", line 181, in load_session
    username=username or default_cred.username, password=password or default_cred.password, **self.connection.get_session_requirements()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/api/client.py", line 44, in get_session_requirements
    self.get('/api/')  # this causes a cookie w/ the CSRF token to be set
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/api/client.py", line 105, in get
    return self.request(relative_endpoint, method='get', query_parameters=query_parameters, headers=headers)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/api/client.py", line 96, in request
    raise err
  File "/home/ubuntu/.local/lib/python3.8/site-packages/awxkit/api/client.py", line 92, in request
    response = session_request_method(url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='ec2-54-67-71-41.us-west-1.compute.amazonaws.com', port=80): Max retries exceeded with url: /api/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb665336730>: Failed to establish a new connection: [Errno 111] Connection refused'))

@domdfcoding
Copy link
Contributor

For your first issue, sphinxcontrib.autoprogram mistakenly declares itself as compatible with Python versions it is not -- it requires 3.7+ but you're using 3.6.

This has been reported upstream already (sphinx-contrib/autoprogram#47) and fixed in sphinx-contrib/autoprogram#48, although a new release hasn't been made yet. As a workaround you could use sphinxcontrib.autoprogram version 0.1.5, or upgrade to Python 3.7 or newer.

Your second issue looks like either an awxkit, requests or AWS` issue, rather than Sphinx.

@pknomad
Copy link
Author

pknomad commented Jun 19, 2021

Thanks domdfcoding. I'll close this issue. Cheers.

@pknomad pknomad closed this as completed Jun 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants