I'm using python chess and I'm trying to use my stockfish 10 engine downloaded from the stockfish website.

import chess.uci

engine = chess.uci.popen_engine(r"stockfish-10-linux/Linux/stockfish_10_x64")

Leads to the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tim/anaconda3/lib/python3.7/site-packages/chess/uci.py", line 1139, in popen_engine
    return _popen_engine(command, engine_cls, setpgrp, **kwargs)
  File "/home/tim/anaconda3/lib/python3.7/site-packages/chess/_engine.py", line 295, in _popen_engine
    PopenProcess(engine, command, **popen_args)
  File "/home/tim/anaconda3/lib/python3.7/site-packages/chess/_engine.py", line 133, in __init__
    self.process = subprocess.Popen(command, **popen_args)
  File "/home/tim/anaconda3/lib/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/home/tim/anaconda3/lib/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'stockfish-10-linux/Linux/stockfish_10_x64'

I've done this before on my old computer and I'm mimicking my old code which ran with no problem. Except in my old code I used stockfish 9 and here I'm using stockfish 10. Also I imported chess.engine in my old code but now it says this library isn't available.


In the error log you've pasted you can see it's a permission error, which can occur for files that behave as "executables" if you will (think any form of program, e.g. scripts, compiled files etc), but that have not been given the rights by the os to do so. One way to fix it, go to the folder containing the engine file and open a terminal to run the following command which will render your file as executable to the os:

chmod +x stockfish_10_x64

Alternatively, right click, go to properties, permissions and select "allow executing file as program". After this (by either method) you should be able to load and run the engine within the python-chess library.

Not the answer you're looking for? Browse other questions tagged or ask your own question.