Encoding problem with a PyCharm


Hello everyone. Suddenly during working (could notice what I did), all my code became non-executable if use a build - in function Run.

Have an error: encodings.CodecRegistryError: incompatible codecs in module "encodings.ascii" (/usr/lib/python2.7/encodings/ascii.pyc)

At the same time, if use a Terminal - all works as should be.

What it can be? All that I have done today - installed kind of pip install visualization.

Google doesn't know an answer at all! Can anyone help, please? 


Comment actions Permalink

Traceback (most recent call last):
File "/home/woof/pycharm-2018.1.4/helpers/pydev/pydev_run_in_console.py", line 154, in <module>
File "/home/woof/pycharm-2018.1.4/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 462, in ShowConsole
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1308, in single_request
self.send_request(h, handler, request_body)
File "/usr/lib/python2.7/xmlrpclib.py", line 1411, in send_request
connection.putrequest("POST", handler, skip_accept_encoding=True)
File "/usr/lib/python2.7/httplib.py", line 971, in putrequest
host_enc = host.encode("ascii")
File "/usr/lib/python2.7/encodings/__init__.py", line 134, in search_function
(mod.__name__, mod.__file__)
encodings.CodecRegistryError: incompatible codecs in module "encodings.ascii" (/usr/lib/python2.7/encodings/ascii.pyc)

Comment actions Permalink

Hi Kombowombo,

Thank you for contacting PyCharm support.

Please upload  your logs folder zipped (Help | Show Log in...) to https://uploads.services.jetbrains.com/ and provide the name of the zip file and a screenshot of your Project Interpreter window (Preferences | Project | Project Interpreter).


Kind regards,



Comment actions Permalink

Hi Pycharm team,

I am having the similar problem when I upgraded to Professional 2018.2 version

Logs are uploaded : idea_incompatibleCodecsEncodingsUTF-8.log

 Just FYI,
I have 2 versions intalled on my system-
2017.2.3 - I am using this currently.
2018.2 - has above error.


Comment actions Permalink


It seams to be similar to https://youtrack.jetbrains.com/issue/PY-31178#, please comment on the issue and follow for updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

Comment actions Permalink

Same issue.

Code in file:

import pandas
print "hello world"


/usr/bin/python /Users/shanboli/Projects/pp/f.py
Traceback (most recent call last):
File "/Users/shanboli/Projects/pp/f.py", line 1, in <module>
import pandas
File "/Users/shanboli/Library/Python/2.7/lib/python/site-packages/pandas/__init__.py", line 13, in <module>
File "/usr/local/lib/python2.7/site-packages/pytz/__init__.py", line 21, in <module>
from pytz.tzfile import build_tzinfo
File "/usr/local/lib/python2.7/site-packages/pytz/tzfile.py", line 17, in <module>
_NULL = _byte_string('\0')
File "/usr/local/lib/python2.7/site-packages/pytz/tzfile.py", line 15, in _byte_string
return s.encode('ASCII')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/__init__.py", line 134, in search_function
(mod.__name__, mod.__file__)
encodings.CodecRegistryError: incompatible codecs in module "encodings.ascii" (/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/ascii.pyc)

Process finished with exit code 1

everything perfect if I change the import from pandas to numpy


Comment actions Permalink

Same here:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/site.py", line 703, in <module>
File "/usr/local/lib/python2.7/site.py", line 696, in main
File "/usr/local/lib/python2.7/site.py", line 663, in execusercustomize
import usercustomize
File "/home/project/usercustomize.py", line 6, in <module>
File "/home/project/djangotools_sitecustomize.py", line 32, in sort_sys_path_inplace
import git # import changes sys.path (16.10.2018)
File "/usr/local/lib/python2.7/site-packages/git/__init__.py", line 33, in <module>
File "/usr/local/lib/python2.7/site-packages/git/__init__.py", line 25, in _init_externals
import gitdb
File "/usr/local/lib/python2.7/site-packages/gitdb/__init__.py", line 37, in <module>
from gitdb.base import *
File "/usr/local/lib/python2.7/site-packages/gitdb/base.py", line 6, in <module>
from gitdb.util import bin_to_hex
File "/usr/local/lib/python2.7/site-packages/gitdb/util.py", line 118, in <module>
def make_sha(source=''.encode("ascii")):
File "/usr/local/lib/python2.7/encodings/__init__.py", line 134, in search_function
(mod.__name__, mod.__file__, entry)
encodings.CodecRegistryError: incompatible codecs in module "encodings.ascii" (/usr/local/lib/python2.7/encodings/ascii.pyc)

Worked perfectly after switching from Professional to Community Edition.

Edit: Removed real project name

Comment actions Permalink

Please try to reproduce the issue outside of PyCharm, making sure the same virtual invironment is activated in system terminal.

Most likely the issue is not related to IDE.

Comment actions Permalink

Everything fine if code is executed from venv. This problem is related only to IDE.

Comment actions Permalink

@Rs Aleev

Please see the issue https://youtrack.jetbrains.com/issue/PY-27709

And try the workaround from there.


Please sign in to leave a comment.