Answers.Body: <p>Download an appropriate stockfish binary at <a href="https://stockfishchess.org/download/" rel="noreferrer">https://stockfishchess.org/download/</a>.</p>
  <p>Remember where it is and use that location and engine filename.</p>
  <pre><code>stockfish = Stockfish('/engine_path/engine_filename')
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-22T18:53:17.697Z
Answers.Text: I realized my mistake. The file was inside `/opt/homebrew/Cellar/stockfish/15` but I had to do  `⌘+Shift+G` in order to actually find the stockfish file inside. The final path ended up being `/opt/homebrew/Cellar/stockfish/15/bin/stockfish`
Answers.UserDisplayName: Ozzy08
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-03T21:51:09.880Z
Answers.Text: Thanks I was doing the exact same thing @Ozzy08. This helped alot
Answers.UserDisplayName: maxwell
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-22T08:16:59.807Z
Answers.LastActivityDate: 2022-06-22T08:16:59.807Z
Answers.UserDisplayName: ferdy
Answers.Body: <p>I think the path that you give to the Stockfish constructor is wrong.</p>
  <p>According to this page <a href="https://pypi.org/project/stockfish/" rel="nofollow noreferrer">https://pypi.org/project/stockfish/</a> you should rather give the path to where you installed your engine, so probably <code>/opt/homebrew/Cellar/stockfish/15</code> , not some python file in the stockfish package.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-22T06:24:29.060Z
Answers.LastActivityDate: 2022-06-22T06:24:29.060Z
Answers.UserDisplayName: Christian
Body: <p>I'm trying to get stockfish for python working but I am running into issues. This is my code so far.</p>
  <pre><code>from stockfish import Stockfish
  stockfish = Stockfish('/Users/Me/opt/anaconda3/lib/python3.9/site-packages/stockfish/models.py')
  </code></pre>
  <p>This returns a <code>OSError: [Errno 8] Exec format error: '/Users/Me/opt/anaconda3/lib/python3.9/site-packages/stockfish/models.py'</code></p>
  <p>This is where I downloaded the package from: <a href="https://pypi.org/project/stockfish/" rel="nofollow noreferrer">https://pypi.org/project/stockfish/</a>. After this, as I have a Mac, I downloaded it through homebrew and my installation has a path <code>/opt/homebrew/Cellar/stockfish/15</code>, but this also does not work.</p>
  
Tags: <engines><stockfish><python>
Title: Can't properly use python stockfish package in Mac
ThreadText: # Can't properly use python stockfish package in Mac
  
  (Asked by: username_0 on 2022-06-22)
  
  I'm trying to get stockfish for python working but I am running into issues. This is my code so far.
  from stockfish import Stockfish
  stockfish = Stockfish('/Users/Me/opt/anaconda3/lib/python3.9/site-packages/stockfish/models.py')
  
  This returns a OSError: [Errno 8] Exec format error: '/Users/Me/opt/anaconda3/lib/python3.9/site-packages/stockfish/models.py'
  This is where I downloaded the package from: https://pypi.org/project/stockfish/. After this, as I have a Mac, I downloaded it through homebrew and my installation has a path /opt/homebrew/Cellar/stockfish/15, but this also does not work.
  
  **Tags:** engines, stockfish, python
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-06-22. Score: 5 | Accepted answer
  
  Download an appropriate stockfish binary at https://stockfishchess.org/download/.
  Remember where it is and use that location and engine filename.
  stockfish = Stockfish('/engine_path/engine_filename')
  
  > **Comments:**
  > **username_0**: I realized my mistake. The file was inside `/opt/homebrew/Cellar/stockfish/15` but I had to do  `⌘+Shift+G` in order to actually find the stockfish file inside. The final path ended up being `/opt/homebrew/Cellar/stockfish/15/bin/stockfish`  
  > **username_2**: Thanks I was doing the exact same thing @username_0. This helped alot  
  
  ---
  
  ### Answer by username_3 on 2022-06-22. Score: 2
  
  I think the path that you give to the Stockfish constructor is wrong.
  
  According to this page <https://pypi.org/project/stockfish/> you should rather give the path to where you installed your engine, so probably `/opt/homebrew/Cellar/stockfish/15` , not some python file in the stockfish package.
  
  
  ---
  
  