9

I am trying to install sphinx on a remote machine.

Since I don't have an access to the root, I did this:

$bash

$mkdir -p ~/local/lib/python2.7/site-packages

$export PYTHONPATH=$PYTHONPATH:~/local/lib/python2.7/site-packages

$export PATH=$PATH::~/local/lib/python2.7/site-packages

$easy_install -U --prefix=$HOME/local Sphinx

But apparently, $easy_install doesn't build sphinx-quickstart; when I type

$sphinx-quickstart

I get the following message:

bash: sphinx-quickstart: command not found

I tried

find $HOME -name sphinx-quickstart 

and no result was found. However, I can import sphinx inside python:

$python

And then

>>import sphinx 

works. Any idea why sphinx-quickstart doesn't work?

pmjn6
  • 307
  • 1
  • 4
  • 14
  • Does the `PATH` variable contain the subdirectory where the `sphinx-quickstart` is found? -- I see you have updated your `PYTHONPATH` variable but have you updated your `PATH` variable in the same way? – Jdamian Nov 12 '14 at 09:03
  • No, I had not. But now I did, and it is still the same. I typed setenv PATH $PATH\:home/local/lib/python2.7/site-packages – pmjn6 Nov 12 '14 at 19:40
  • `$export export: Command not found.` – pmjn6 Nov 12 '14 at 20:28
  • I aslo typed `$bash` and then `bash-4.3$ export PATH=$PATH:~/local/lib/python2.7/site-packages` This works, but doesn't solve the issue with `sphinx-quickstart` – pmjn6 Nov 12 '14 at 20:36
  • Try `locate sphinx-quickstart` and `find $HOME -name sphinx-quickstart`. – Jdamian Nov 13 '14 at 08:06
  • `find $HOME -name sphinx-quickstart` doesn't result anything, but still `import sphinx` works in python. – pmjn6 Nov 13 '14 at 21:09

5 Answers5

23

An alternative way to invoke sphinx-quickstart is to explicitly load Sphinx's quickstart module. For Sphinx v1.7+:

python -m sphinx.cmd.quickstart

For older versions of Sphinx:

python -m sphinx.quickstart

For example:

$ /c/Python35/python -m sphinx.quickstart
Welcome to the Sphinx 1.6.2 quickstart utility.
...
jdknight
  • 1,801
  • 32
  • 52
1

I found the solution in this webpage:

User (root/sudo free) installation of Python modules.

In section 3. Python 2.6+ he mentioned that the command line commands are in

~/local/bin

Although I had put ~/local/lib/python2.7/siste-packages in the path, the ~/local/bin directory was not in the path. So all I did

$export PYTHONPATH=$PYTHONPATH:~/local/bin

and now it works.

I don't know why find $HOME -name sphinx-quickstart did not find sphinx-quickstart

Daniel A.A. Pelsmaeker
  • 47,471
  • 20
  • 111
  • 157
pmjn6
  • 307
  • 1
  • 4
  • 14
0

In MacOS (Catalina) and zsh:

I installed sphinx with brew and had the same problem as you.

Solution: Installed it with conda as conda install sphinx and now it works for me

$ sphinx-quickstart
Welcome to the Sphinx 2.3.0 quickstart utility.

Installation Guide

Gonzalo Garcia
  • 6,192
  • 2
  • 29
  • 32
0

Note, if you're in a virtual environment and using poetry to run

poetry run py -m sphinx.cmd.quickstart

where py is the python launcher for Windows.

adam.hendry
  • 4,458
  • 5
  • 24
  • 51
0

Have added an answer for installation on macOS using brew here

For new users, installing with brew gives the following caveats:

==> sphinx-doc
sphinx-doc is keg-only, which means it was not symlinked into /usr/local,
because this formula is mainly used internally by other formulae.
Users are advised to use `pip` to install sphinx-doc.

If you need to have sphinx-doc first in your PATH, run:
  echo 'export PATH="/usr/local/opt/sphinx-doc/bin:$PATH"' >> ~/.zshrc

Running the echo command:

echo 'export PATH="/usr/local/opt/sphinx-doc/bin:$PATH"' >> ~/.zshrc

should fix the issue.

Don't miss source-ing the .zshrc after the updating it:

source ~/.zshrc
Vaibhav Mishra
  • 415
  • 3
  • 10