1

I am trying to Install python-chess on Ubuntu 16. Installed it via pip3, but getting error while importing chess.

ujesh@suyodhana:~$ pip3 install python-chess
Collecting python-chess
  Using cached https://files.pythonhosted.org/packages/74/f3/b0caa4307443926d9f9ba8752270a8fc159e3ac6c9859c4615244c5ba74c/python_chess-0.30.0-py3-none-any.whl
Installing collected packages: python-chess
Successfully installed python-chess-0.30.0
You are using pip version 8.1.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ujesh@suyodhana:~$ python3
Python 3.5.2 (default, Oct  8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chess
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ujesh/.local/lib/python3.5/site-packages/chess/__init__.py", line 157
    BB_ALL = 0xffff_ffff_ffff_ffff
                                 ^
SyntaxError: invalid syntax
>>>


Any help would be highly appreciable

Thanks in Advance..

Ujesh Lal
  • 111
  • 1
  • 5

1 Answers1

3

This is because underscores in numeric literals were only introduced in Python 3.6 (see PEP515 here).

To solve this, you need to upgrade your version of Python - as python-chess 0.30.0+ only supports 3.6+ - or downgrade python-chess to 0.29.0 with

pip install --force-reinstall python-chess==0.29.0 
CDJB
  • 14,043
  • 5
  • 29
  • 55