0

I am trying to install readthedocs in local system (Ubuntu 14.04 ) in python3 virtual env from the instructions given in this link

When I ran pip3 install -r requirements.txt , I got an error for Distutils2 . I removed that dependency as the distutils2 is no longer supported and assumed setuptools would suffice.

Running this command python manage.py migrate gave the below error :

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/home/username/read_the_docs_env/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/username/Desktop/CurrentProjects/read_the_docs/checkouts/readthedocs.org/readthedocs/core/admin.py", line 10, in <module>
    from readthedocs.core.views import SendEmailView
  File "/home/username/Desktop/CurrentProjects/read_the_docs/checkouts/readthedocs.org/readthedocs/core/views/__init__.py", line 26, in <module>
    from readthedocs.projects.tasks import remove_dir
  File "/home/username/Desktop/CurrentProjects/read_the_docs/checkouts/readthedocs.org/readthedocs/projects/tasks.py", line 493
    print "Sync Versions Exception: %s" % e.message
                                      ^
SyntaxError: Missing parentheses in call to 'print'

I understand from the above stacktrace that the code is in python2 and so print statement is different in python3 .

Does this mean that I have to install readthedocs in python2 virtualenv ?

Can't we host the docs of python3 projects in readthedocs in-house server ?

mzjn
  • 48,958
  • 13
  • 128
  • 248
Shiva MSK
  • 484
  • 1
  • 6
  • 16
  • In Python 3 `print` is a function and must be call as one: `print(…)`. – Klaus D. Jul 26 '16 at 09:55
  • If you want to create a python2 venv, you have to explictly give the interpreter with the `-p` argument. – Klaus D. Jul 26 '16 at 09:56
  • Yeah, that's the problem. It means the readthedocs code is in python2 which is why it's giving the error when I am installing it in python3 virtualenv. The question is how do we install it in python3 virtualenv. – Shiva MSK Jul 26 '16 at 09:57
  • 1
    Looks like you can't. The instructions pretty clearly say to use python2.7 and a virtualenv. It's just documentation, so why do you need to run it in python3? – OneCricketeer Jul 26 '16 at 09:59

1 Answers1

1

The read the docs code does not support Python 3 yet. The installation instructions explicitly say to use Python 2.7:

First, obtain Python 2.7 and virtualenv

However, it should still be possible to use your read the docs installation to host docs for Python 3 projects, since the instructions then say:

If you plan to import Python 3 project to your RTD then you’ll need to install Python 3 with virtualenv in your system as well.

Alasdair
  • 298,606
  • 55
  • 578
  • 516