Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 348
Kyle U Avatar asked Apr 04 '19 17:04

Kyle U


2 Answers

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.

like image 66
Nandeesh Avatar answered Oct 21 '22 19:10

Nandeesh


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.

like image 31
gimboland Avatar answered Oct 21 '22 19:10

gimboland