Kyle U
Kyle U

Reputation: 305

Pycharm and .rst --- NameError: Cannot find docutils in selected interpreter

I'm new to Pycharm as well as writing .rst files. I'm currently trying to debug some issue that prevents my .rst file from rendering properly. I want to use the .rst preview that Pycharm provides, but I get this error:

NameError: Cannot find docutils in selected interpreter.

I'm not quite sure what the problem is. I've installed the rst2html interpreter on my project, applied it and restarted Pycharm, but that doesn't seem to do it.

Upvotes: 6

Views: 1940

Answers (3)

Rmatt
Rmatt

Reputation: 1347

In my case (on OSX) I had to install docutils on my global python installation. I had to:

  1. Make sure that in Settings -> Project -> Interpreter only one version of Python (outside of the virtual envs) was available (by removing [Pressing "-" below the list] the linked Python 2.7 version).
  2. Forcing global install of docutils sudo /usr/bin/pip3 install docutils
  3. Restart PyCharm, make sure your project have the correct interpreter

Upvotes: 0

Nandeesh
Nandeesh

Reputation: 2802

Add the following to ~/.profile file for it to correctly export your locale settings.

export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8

These two lines added to the file should suffice to set the locale [replace en_US for your desired locale, and check beforehand that it is indeed installed on your system (locale -a)].

After that, you can start a new session and check using locale:

$ locale

The following should be the output:

LANG="en_US.UTF-8"  
LC_COLLATE="en_US.UTF-8"  
LC_CTYPE="en_US.UTF-8"  
LC_MESSAGES="en_US.UTF-8"  
LC_MONETARY="en_US.UTF-8"  
LC_NUMERIC="en_US.UTF-8"  
LC_TIME="en_US.UTF-8"  
LC_ALL="en_US.UTF-8"  

Then restart PyCharm. This should resolve the issue.

Upvotes: 9

gimboland
gimboland

Reputation: 2286

There's an open bug for this open since July 2018 (and still open as of September 2019). It seems that a workaround for at least some people (including me) is to launch PyCharm from the command line.

Upvotes: 3

Related Questions