Skip to content

ModuleNotFoundError: No module named 'six' on build #7705

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

Closed
Arthurdw opened this issue Nov 28, 2020 · 15 comments · Fixed by #7710
Closed

ModuleNotFoundError: No module named 'six' on build #7705

Arthurdw opened this issue Nov 28, 2020 · 15 comments · Fixed by #7710
Labels
Accepted Accepted issue on our roadmap Bug A bug

Comments

@Arthurdw
Copy link

Arthurdw commented Nov 28, 2020

Details

I tried building my docs for my project, yet this fails with a ModuleNotFoundError

My conf file
Build url

Expected Result

A successful build

Actual Result

The following error:

Running Sphinx v3.3.1

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/config.py", line 319, in eval_config_file
    execfile_(filename, namespace)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/util/pycompat.py", line 89, in execfile_
    exec(code, _globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/checkouts/latest/docs/source/conf.py", line 82, in <module>
    from six import string_types
ModuleNotFoundError: No module named 'six'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 279, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 219, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/config.py", line 174, in read
    namespace = eval_config_file(filename, tags)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/config.py", line 332, in eval_config_file
    raise ConfigError(msg % traceback.format_exc()) from exc
sphinx.errors.ConfigError: There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/config.py", line 319, in eval_config_file
    execfile_(filename, namespace)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/util/pycompat.py", line 89, in execfile_
    exec(code, _globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/checkouts/latest/docs/source/conf.py", line 82, in <module>
    from six import string_types
ModuleNotFoundError: No module named 'six'


Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/config.py", line 319, in eval_config_file
    execfile_(filename, namespace)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/envs/latest/lib/python3.7/site-packages/sphinx/util/pycompat.py", line 89, in execfile_
    exec(code, _globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/dblstats/checkouts/latest/docs/source/conf.py", line 82, in <module>
    from six import string_types
ModuleNotFoundError: No module named 'six'
@ynerant
Copy link

ynerant commented Nov 28, 2020

Same issue. I tried to recompile a version that were successfully compiled yesterday, and it failed, so it is not related to my sources.

@patel-zeel
Copy link

Same error. I wanted to try this tool today for the first time. What bad luck !!! Red alert devs.

@arunhpatil
Copy link

Hi, I had the same issue. At first, I followed the recommendation #7704 (comment) but it was not complete without specifying requirements in the settings.

Solved

Here is how I solved it, first follow #7704 (comment), and then click Admin, Advanced Settings and then under the section Requirements file add the file path you created docs/requirements.txt. Click on Save and build Version. I hope this works out for you.

Cheers.

@ynerant
Copy link

ynerant commented Nov 28, 2020

This is not a solution.
RTD must work on a simple configuration without declaring any external dependency, and recompiling previous builds must work.

@arunhpatil
Copy link

@ynerant, agreed. If I am not wrong, Package six needs to be installed on the RTD's end. If it's not already there, we need to specify that in the requirements. This fixed the problem I had, but hopefully, the dev team comes up with a better alternative.

yaroslaff added a commit to yaroslaff/okerrupdate-doc that referenced this issue Nov 29, 2020
@Jonas231
Copy link

I tried the above solution but it did not work for me...

@Arthurdw
Copy link
Author

Arthurdw commented Nov 29, 2020

I tried the above solution but it did not work for me...

@Jonas231 it didn't for me either in the beginning, but when migrating the items from the source folder into the docs folder it did work.

@ynerant, agreed. If I am not wrong, Package six needs to be installed on the RTD's end. If it's not already there, we need to specify that in the requirements. This fixed the problem I had, but hopefully, the dev team comes up with a better alternative.

I agree, I'll keep this issue open until its fixed.

@jonaswinkler
Copy link

Yep, that's an issue, docs start failing to build without any changes to their configuration.

@arunhpatil
Copy link

I tried the above solution but it did not work for me...

@Jonas231, the filename mentioned in .yml file is different than what you have in the docs folder. I see it is commented for now.

Also, the way you did make html to generate HTML files, you should make clean to clean the build folder before you commit on GitHub. Let me know if this works.

@humitos
Copy link
Member

humitos commented Nov 30, 2020

I'm not sure why this started failing now. However, we are appending some extra logic to the user's conf.py file and this logic relies on six but we are not installing it as a "core requirements" together with the others.

I just did a quick test creating an empty virtualenv and installing our core requirements:

$ python -m pip install --upgrade --no-cache-dir setuptools==41.0.1 docutils==0.14 mock==1.0.1 pillow==5.4.1 'alabaster>=0.7,<0.8,!=0.7.5' commonmark==0.8.1 recommonmark==0.5.0 sphinx sphinx-rtd-theme 'readthedocs-sphinx-ext<2.2'

...

$ python
Python 3.7.7 (default, Apr 11 2020, 22:03:50) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import six
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'six'
>>>

None of them installed six as a dependency. So, we should

  • include it as a "core dependency"
  • remove its usage (is seems we only use it to check for string_types)

We will have a patch for this soon.

@humitos
Copy link
Member

humitos commented Nov 30, 2020

As a workaround while we create the patch and deploy it, you can:

  1. create a requirements.txt file and add six to it
  2. use the readthedocs.yml config file to install those requirements (https://docs.readthedocs.io/en/stable/config-file/v2.html#python)

@humitos
Copy link
Member

humitos commented Nov 30, 2020

Hi all! I deployed a quick fix for now that does not install latest sphinx version by default (3.3.1) but the previous one that Read the Docs pinned for years (1.8.x).

We enabled this feature (USE_LATEST_SPHINX for new projects) to start testing the builder with this new version of Sphinx, but we didn't realize that six was not a dependency anymore. So, for now, I disabled this feature and your builds will use sphinx==1.8.x by default. If you want to use a different version of Sphinx, please specify it in your requirements.txt file as usual.

We will have a fix for this soon and we will re-enable USE_LATEST_SPHINX version for new projects.

@stevepiercy
Copy link
Contributor

@humitos is USE_LATEST_SPHINX for new projects only and not existing projects, and if so what is a "new" project? I did not see it documented. I also did not see it in any release notes. USE_LATEST_SPHINX is only mentioned in this issue and its related PR, and an old issue.

@humitos
Copy link
Member

humitos commented Nov 30, 2020

@stevepiercy "new projects" currently means "project created after Oct 20" (*) which is when this feature was added/enabled. We do not document this feature flag because is only for internal usage. As it's hard to upgrade a pinned core dependency without breaking everyone's builds we have this kind of features that we can easily enable or disable for a set of projects to start testing out how the upgrade of this dependency will behave and can rollback fast if something goes wrong.

(*) this is relative to each feature flag and we could update this date manually again depending on the new feature we want to test.

@stsewd
Copy link
Member

stsewd commented Dec 3, 2020

Builds should be good now https://readthedocs.org/projects/dblstats/builds/12483379/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants