1

I've used PyCharm's package installer on other machines with no problem, but on this machine (Windows, if it matters) every time I hit the "install package" button, it fails. Here's what I get when I ask for details:

Executed command:

pip install chess

Error occurred:

ValueError: source code string cannot contain null bytes

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.4\helpers\packaging_tool.py", line 145, in main
    do_install(pkgs)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.4\helpers\packaging_tool.py", line 59, in do_install
    run_pip(['install'] + pkgs)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.4\helpers\packaging_tool.py", line 73, in run_pip
    runpy.run_module(module_name, run_name='__main__', alter_sys=True)
  File "C:\Users\Emma\AppData\Local\Programs\Python\Python35-32\lib\runpy.py", line 201, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "C:\Users\Emma\AppData\Local\Programs\Python\Python35-32\lib\runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\Emma\AppData\Local\Programs\Python\Python35-32\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\Emma\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ValueError: source code string cannot contain null bytes

At first I thought it was an encoding problem, so I switched my encoding to UTF-8 for everything, which briefly made PyCharm stop graying-out my "import chess" statements, but as soon as I went back into the menu and tried to install it the same problem occurred. This is also not a problem specifically with chess, because I'm having the same issue with pandas.

I'm using PyCharm community edition (originally 2017, but I reinstalled while trying to fix this problem, so now it's 2019). The project interpreter is Python 3.5.3rc1.

2 Answers2

0

This is not the problem with your PyCharm, but with the source code of the module, you are trying to install. According to PyPi, it is this one, and it has been updated last time 7 years ago.

You could download it yourself and fix the problem with this solution.

Simon Osipov
  • 404
  • 5
  • 18
0

If you also have problem to install other packages with PyCharm, have you tried using command prompt to install them?
pip install chess

Nathan
  • 449
  • 1
  • 7
  • 23