trouble Installing PreTeXt-CLI

162 views
Skip to first unread message

Kyriakos Kypriotakis

unread,
Sep 28, 2021, 10:32:56 AM9/28/21
to PreTeXt support
Hello, windows 10 user here

I followed the instructions found on Getting PreTeXt (pretextbook.org)

and was able to install python and I already have latex 

but I am struggling with PreTeXt, here is what I have, any help would be greatly appreciated! 


PS C:\Users\kyria> pretext --version
pretext : The term 'pretext' 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
+ pretext --version
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (pretext:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\kyria>

and 

PS C:\Users\kyria> python -m pretext --version
Traceback (most recent call last):
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\__init__.py", line 87, in <module>
    refresh()
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\__init__.py", line 76, in refresh
    if not Git.refresh(path=path):
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\cmd.py", line 340, in refresh
    raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pretext\__main__.py", line 1, in <module>
    from .cli import main
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pretext\cli.py", line 11, in <module>
    from .project import Target,Project
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pretext\project.py", line 5, in <module>
    import git
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\__init__.py", line 89, in <module>
    raise ImportError('Failed to initialize: {0}'.format(exc)) from exc
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet

Oscar Levin

unread,
Sep 28, 2021, 12:53:05 PM9/28/21
to PreTeXt support
Were you able to do `python -m pip install pretextbook`?

Also, what do you get from `python --version`?

Oscar.

Kyriakos Kypriotakis

unread,
Sep 28, 2021, 2:02:55 PM9/28/21
to PreTeXt support

Yes, I was able to do "python -m pip install pretextbook" 
and "python --version" works I have version 3.9.7

Thank you for looking into this! 

K. 

Oscar Levin

unread,
Sep 28, 2021, 8:44:09 PM9/28/21
to pretext...@googlegroups.com
Interesting.  Do you have git installed on this computer by any chance?  I suspect that on all the machines we have tested it on, we already had git installed.  That shouldn't be necessary with the git python package, but I'm not an expert.  

--
You received this message because you are subscribed to a topic in the Google Groups "PreTeXt support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-support/-Ey9xhP489s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/8bb974af-aa38-4de0-8ad1-ecf4a5cc0398n%40googlegroups.com.

Kyriakos Kypriotakis

unread,
Sep 28, 2021, 10:20:48 PM9/28/21
to PreTeXt support
No, I don't have git. Should I install it or would you recommend just using the online free service (forgot the website name) to use PreTeXt, also I have another (older) linux mint laptop. Maybe trying installing PreTeXt there is a better option? 

K. 

Dirk Basson

unread,
Sep 29, 2021, 3:11:17 AM9/29/21
to pretext...@googlegroups.com
Could it be that pretext is simply not in the PATH environment variable? I don't know how that installation works, so this may be completely the wrong approach, but here is how you can check whether pretext is in the path: 
1. Click the search button bottom left next to the windows button. 
2. Type "Edit the System Environment Variables"
3. Click on the button "Environment Variables" at the bottom.
4. In the bottom half (System variables), double click on PATH
5. Check to see whether one of the lines contains a path to the pretext installation.
If it is not there, then it may be possible that it is installed, but that the path needs to be added there (but it may also be possible that it is not installed). Do a Windows search for "pretext".

You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/267176b9-a599-4427-9be7-90e4d933ad30n%40googlegroups.com.

Kyriakos Kypriotakis

unread,
Sep 29, 2021, 11:48:57 AM9/29/21
to PreTeXt support
Yes, thank you. It doesn't look like PreText is installed, and I did install Git, 

and when I run  python -m pip install pretextbook,  it acts as if it is installed. Or that's how it looks to me. 

PS C:\Users\kyria> python -m pip install pretextbook
Requirement already satisfied: pretextbook in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (0.5.1)
Requirement already satisfied: lxml in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (4.6.3)
Requirement already satisfied: python-slugify in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (5.0.2)
Requirement already satisfied: GitPython in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (3.1.24)
Requirement already satisfied: watchdog in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (2.1.5)
Requirement already satisfied: click>=7.0 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (8.0.1)
Requirement already satisfied: requests in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (2.26.0)
Requirement already satisfied: pdfCropMargins in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (1.0.5)
Requirement already satisfied: click-logging in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pretextbook) (1.0.1)
Requirement already satisfied: colorama in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from click>=7.0->pretextbook) (0.4.4)
Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from GitPython->pretextbook) (3.10.0.2)
Requirement already satisfied: gitdb<5,>=4.0.1 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from GitPython->pretextbook) (4.0.7)
Requirement already satisfied: smmap<5,>=3.0.1 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from gitdb<5,>=4.0.1->GitPython->pretextbook) (4.0.0)
Requirement already satisfied: wheel in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pdfCropMargins->pretextbook) (0.37.0)
Requirement already satisfied: PyPDF2 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pdfCropMargins->pretextbook) (1.26.0)
Requirement already satisfied: pillow>=7.1.0 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pdfCropMargins->pretextbook) (8.3.2)
Requirement already satisfied: text-unidecode>=1.3 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from python-slugify->pretextbook) (1.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests->pretextbook) (2021.5.30)
Requirement already satisfied: idna<4,>=2.5 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests->pretextbook) (3.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests->pretextbook) (2.0.6)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\kyria\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests->pretextbook) (1.26.7)

Kyriakos Kypriotakis

unread,
Sep 29, 2021, 11:53:35 AM9/29/21
to PreTeXt support

Here is par of the feedback I get "bad Git executable" but not sure how to fix it. 

PS C:\Users\kyria> python -m pretext --version
Traceback (most recent call last):
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\__init__.py", line 87, in <module>
    refresh()
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\__init__.py", line 76, in refresh
    if not Git.refresh(path=path):
  File "C:\Users\kyria\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\git\cmd.py", line 340, in refresh
    raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

Oscar Levin

unread,
Sep 29, 2021, 2:16:01 PM9/29/21
to PreTeXt support
It definitely looks like this is a problem with your python install, specifically of the python-git package.  I really don't know how to fix that (although reinstalling python from python.org might help, maybe using python 3.8).  You might also look into using a virtual environment, as described here: https://pretextbook.org/doc/guide/html/python-virtual.html, or ask google.  The idea, as far as I understand, is that this will give you a clean copy of python in which you could pip install pretextbook without conflicting with other python setups.

Cheers,
Oscar.

Rob Beezer

unread,
Sep 29, 2021, 4:43:41 PM9/29/21
to pretext...@googlegroups.com
On 9/29/21 11:16 AM, Oscar Levin wrote:
> The idea, as far as I understand, is that this will give you a clean
> copy of python in which you could pip install pretextbook without conflicting
> with other python setups.

It is definitely the case that the pretext/pretext script should be run in a
virtual environment. I've come very close to really messing-up my system-wide
Python (on Ubuntu) before I made that part of my routine.

Independent of Kyriakos' situation, it is also the case that we have little hope
of helping with every different way to have system software in a bad state.

Does it make sense to require, or maybe just strongly recommend, that
PreTeXt-CLI have the same expectation?

Rob






Kyriakos Kypriotakis

unread,
Sep 30, 2021, 11:40:16 AM9/30/21
to PreTeXt support
Thank you all for your help and feedback. I decided to use CoCalc for now and do not install PreTeXt in my pc, maybe in the future. 

Thanks again! 

K. 

Reply all
Reply to author
Forward
0 new messages