Cannot run sphinx from pycharm


I am using PyCharm 2.0.1 on a Mac OS X 10.6. In the project I have configured a virtual environment with Python 3.2:

When I run a 'sphinx task in docs' (my task to generate the documentation) I get the following:


/Users/XXX/envs/YYY/bin/python /Applications/ -bhtml /Users/XXX/Documents/code/YYY/docs /Users/XXX/Documents/code/YYY/docs/_build/html
Traceback (most recent call last):
  File "/Applications/", line 5, in <module>
    from sphinx import cmdline
  File "/Users/XXX/envs/YYY/lib/python3.2/site-packages/sphinx/", line 18, in <module>
    from docutils.utils import SystemMessage
  File "/Applications/", line 63, in <module>
    class ApplicationError(StandardError): pass
NameError: name 'StandardError' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/", line 7, in <module>
    raise NameError("Cannot find sphinx in selected interpreter.")
NameError: Cannot find sphinx in selected interpreter.

Process finished with exit code 1


The error is because /Applications/ is not Python 3 compatible. My question is why you need to call PyCharm's docutils module at all instead of using the one in my python installation? How can I fix this?




Getting the same error on pyenv 3.7.2 on macOS 10.12.6

Any thoughts?


Do you get the same error when running this script from the system terminal (outside of PyCharm) using the same interpreter?


Please sign in to leave a comment.