4

I'm trying to follow the tutorial about how to set sphinx and Readthedocs together for project. I used Sphinx back in the day while in a internship, with ubuntu and the setup was quite seamless. I've just launched the sphinx-quickstart on my anaconda power shell. When I try to run make html the following error appears:

(base) PS D:\code\RaspberryServer\docs> make html
make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ make html
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (make:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]: The command make was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\make". See "get-help about_Command_Precedence" for more details.

Firstly I thought it was because I had never installed MinGW. But even after doing so I don't seem to fix the problem and I have no clue to how to start looking into it. My python installation is fully based on Anaconda.

tripleee
  • 175,061
  • 34
  • 275
  • 318
Guilherme Theis
  • 145
  • 1
  • 8
  • 3
    That guide assumes you use cmd.exe, but you are in a PowerShell console. Try to run `.\make.bat html` – Lex Li Dec 28 '20 at 00:06
  • 1
    Thank you, this solved my issue. Can you explain to me the difference between using these? To my understanding powershell usually comes with a more flexible approach (and closer to UNIX) – Guilherme Theis Dec 28 '20 at 00:11

2 Answers2

11

Expand the comment above.

The default site generated by sphinx assumes you use make html on multiple operating systems to generate HTML pages.

That's achieved by typical assumption that,

  • You are on macOS or Linux with (GNU) make installed, so make html executes the task defined in Makefile.
  • You are on Windows and at command prompt (cmd.exe), so make html actually calls to make.bat.

However, you are launching PowerShell console ("PS D:" indicates that), so you cannot get make html working properly. PowerShell does not know what to do with make, and won't call make.bat automatically. You need to call .\make.bat html instead.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • 2
    Many hours wasted to find this out - I wish they had put this on their first page! – Yost777 Nov 01 '22 at 11:00
  • 2
    Indeed, I also found it quite strange that the documentation explains you how to create a directory (mkdir) and how to enter it (cd) but then leaves you completly alone with the executions of "make html". – ZetDen Jan 16 '23 at 15:28
1

You may try to use sphinx-build. As far as I know it gets the job done and does not depend on the OS you use.

sphinx-build <sourcedir> <outputdir>

Csaba Hurton
  • 21
  • 1
  • 5
  • But it depends on which OS you use and how Python is configured. In many cases you cannot run `sphinx-build` at command prompt or PowerShell console on Windows because the relevant paths are not in Windows PATH environment variable. That's different from macOS/Linux where Python is usually preconfigured to be available at terminal. – Lex Li Nov 30 '22 at 21:09