1

I'm trying to use Jupyter-book to create automatical PDF from my output, but after installing it using the 'pip install -U jupyter-book' command (which runs successfully), it doesn't recognize jupyter-book when I try to run a command:

Input:

jupyter_book create Jupyter_Book_Name

Output:

SyntaxError: invalid syntax (Temp/ipykernel_16888/3781613275.py, line 1)
  File "C:\Users\MAXIME~1.DUS\AppData\Local\Temp/ipykernel_16888/3781613275.py", line 1
    jupyter_book create Jupyter_Book_Name
                 ^
SyntaxError: invalid syntax

I already try to add the init jupyter_book function in the sys.path but I get the same error, and the error arises for any command. I am working in Python 3.9.7 with Jupyter Notebook in Visual Studio Code on Windows 10.

Thank you in advance, any help would really help me.

Skilmoule
  • 11
  • 1

1 Answers1

0

Looks like you're confusing a shell (bash / ...) with a Python REPL.

You're running a shell command in a Python interpreter, a bit like if you try to start Python by typing python inside a Python interpreter:

$ python   # Here I'm in bash, I run Python
Python 3.9.7 (default, Sep  3 2021, 06:18:44) 
>>> python  # Here I'm in the Python interpreter
            # typing python again...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined
# Yup, calling `python` here make no sense, Python looks for a variable
# named `python` not a program named `python`, and won't find it.

So get out of a Python interpreter, find a shell (depending on your OS), and run the command again.

Oh while I'm here, it's probably not:

jupyter_book create Jupyter_Book_Name

but:

jupyter-book create Jupyter_Book_Name
Julien Palard
  • 8,736
  • 2
  • 37
  • 44
  • Thank you for your response. I tried the command via the shell but it doesn't work as well. I get :"jupyter-book is not recognized as an internal or external command", so not recognized either. Do I have to put something in the path? – Skilmoule Sep 29 '21 at 07:33
  • I never mess with my PATH manually, but I do use venvs ( which are inserting themselves in the PATH when you activate them). Can you try installing jupyter-book in a venv? – Julien Palard Sep 29 '21 at 14:00