tomduck / pandoc-xnos

Library code for pandoc-fignos/eqnos/tablenos/secnos.
GNU General Public License v3.0
106 stars 27 forks source link

`--filter pandoc-xnos` not working #11

Open vronizor opened 5 years ago

vronizor commented 5 years ago

Hi all,

I get an error when I try to pass the generic --filter pandoc-xnos, but individual packages work, such as --filter pandoc-secnos.

pandoc-xnos is indeed installed:

pip install pandoc-xnos
Requirement already satisfied: pandoc-xnos in ./.local/lib/python3.7/site-packages (2.3.0)
Requirement already satisfied: pandocfilters<2,>=1.4.2 in ./anaconda3/lib/python3.7/site-packages (from pandoc-xnos) (1.4.2)
Requirement already satisfied: psutil<6,>=4.1.0 in ./anaconda3/lib/python3.7/site-packages (from pandoc-xnos) (5.6.3)

But running the following fails:

pandoc -o 2019-11-18Referee-Report.pdf 2019-11-18Referee-Report.md --pdf-engine=xelatex --filter pandoc-xnos --filter pandoc-citeproc
Error running filter pandoc-xnos:
Could not find executable pandoc-xnos

While running this works:

pandoc -o 2019-11-18Referee-Report.pdf 2019-11-18Referee-Report.md --pdf-engine=xelatex --filter pandoc-secnos --filter pandoc-citeproc

pandoc-secnos: Wrote the following blocks to header-includes.  If you
use pandoc's --include-in-header option then you will need to manually
include these yourself.

    %% pandoc-secnos: required package
    \usepackage{cleveref}

Any idea what is going on?

Thanks!

MPvHarmelen commented 4 years ago

I had a similar problem (nothing worked... :smile:), used find to find if and where the executable was installed:

$ find / -iname *pandoc-xnos* 2>/dev/null
~/.local/bin/pandoc-xnos

and noticed this location wasn't on my path. Somehow adding that location to my path helped for finding it in bash, but not for pandoc, but linking it from a place I expected pandoc to expect executables worked:

sudo ln -s ~/.local/bin/pandoc-xnos /usr/local/bin/
$ wget -O - https://raw.githubusercontent.com/tomduck/pandoc-tablenos/master/demos/demo3.md | pandoc --filter pandoc-xnos -t markdown
    Right Left    Center  Default
  ------- ------ -------- ---------
       12 12        12    12
      123 123      123    123
        1 1         1     1

  : Table 1: Demonstration of a simple table.

Tab. [1](#tbl:1) is from the Pandoc User's Guide. A simpler table is
given by Tab. [2](#tbl:2):

  A   B
  --- ---
  0   1

  : Table 2: Even simpler.
stroobandt commented 4 years ago

Both --filter=pandoc-xnos and --filter='pandoc-xnos' work over here.

MPvHarmelen commented 4 years ago

What system are you on?

stroobandt commented 4 years ago

@MPvHarmelen Xubuntu 18.04.4 LTS

tomduck commented 4 years ago

Is anyone still having this problem?

The pandoc-xnos script needs to be on the PATH. For most systems this shouldn't be a problem. If in doubt, you can check that the pandoc-xnos script executes under bash as follows:

$ pandoc-xnos --version
pandoc-xnos 2.2.0

I have added a check that pandoc-xnos is found to the setup script in the nextrelease branch. This will go out in the next release.

MPvHarmelen commented 4 years ago

I don't have the time to try to break it again on my machine now :sweat_smile: Nice that you're testing for it now. I could have a look again in November, hopefully :)

FrsLry commented 4 years ago

Hi!

I have the same problem here. pandoc-xnos is installed: pip install pandoc-xnos returns

Requirement already satisfied: pandoc-xnos in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (2.4.3)
Requirement already satisfied: psutil<6,>=4.1.0 in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pandoc-xnos) (5.7.2)
Requirement already satisfied: pandocfilters<2,>=1.4.2 in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pandoc-xnos) (1.4.2)

Nevertheless, when I call

pandoc manuscript.md -s -o test.tex --filter pandoc-xnos --bibliography=references.json --csl=.assets/templates/ecology-letters.cls --metadata-file=metadata.json --template=.assets/templates/template.tex

I obtain:

Error running filter pandoc-xnos:
Could not find executable pandoc-xnos

On the other hand, pandoc-xnos --version also returns an error message.

Do you think this problem is related to this post?

Thanks!

tomduck commented 4 years ago

Thanks, @FrsLry. Let's see if we can figure this out. What OS are you using? Cheers, Tom

FrsLry commented 4 years ago

Thanks, @FrsLry. Let's see if we can figure this out. What OS are you using? Cheers, Tom

Sorry @tomduck, I'm on windows 10.

Cheers!

tomduck commented 4 years ago

@FrsLry, did you install from PyPI using pip, or some other method? --Tom

FrsLry commented 4 years ago

Yes @tomduck , I used:

pip install pandoc-fignos pandoc-eqnos pandoc-tablenos pandoc-secnos --user

And then I updated it, as it's clearly explained on https://github.com/tomduck/pandoc-xnos.

So now, when I try to get the version of pandoc-xnos or each of these programs (using pandoc-* --version), I obtain this error message:

pandoc-fignos : The term 'pandoc-fignos' 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
+ pandoc-fignos --version
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (pandoc-fignos:String) [], CommandNotFoundExc
   eption
    + FullyQualifiedErrorId : CommandNotFoundException

I tried to reinstall to check (with the same pip install pandoc-fignos pandoc-eqnos pandoc-tablenos pandoc-secnos --user) and now I have:

Requirement already satisfied: pandoc-fignos in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (2.3.1)
Requirement already satisfied: pandoc-eqnos in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (2.3.0)
Requirement already satisfied: pandoc-tablenos in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (2.2.2)
Requirement already satisfied: pandoc-secnos in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (2.2.2)
Requirement already satisfied: pandoc-xnos<3.0,>=2.4.2 in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pandoc-fignos) (2.4.3)
Requirement already satisfied: pandocfilters<2,>=1.4.2 in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pandoc-xnos<3.0,>=2.4.2->pandoc-fignos) (1.4.2)
Requirement already satisfied: psutil<6,>=4.1.0 in .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pandoc-xnos<3.0,>=2.4.2->pandoc-fignos) (5.7.2)

Thanks!

François

tomduck commented 4 years ago

Good, thanks. Could you please provide the output of pip show --files pandoc-xnos? This will allow us to see where the pandoc-xnos script and library are installed on your system. --Tom

Note/edit: This will provide a more detailed account than what you have already provided. The pandoc-xnos script normally gets installed at a different location than the library.

FrsLry commented 4 years ago

Sure! Here it is:

Name: pandoc-xnos
Version: 2.4.3
Summary: Library code for the pandoc-xnos filter suite.
Home-page: https://github.com/tomduck/pandoc-xnos
Author: Thomas J. Duck
Author-email: tomduck@tomduck.ca
License: GPL
Location: .\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages
Requires: psutil, pandocfilters
Required-by: pandoc-tablenos, pandoc-secnos, pandoc-fignos, pandoc-eqnos
Files:
  ..\Scripts\pandoc-xnos.exe
  pandoc_xnos-2.4.3.dist-info\AUTHORS
  pandoc_xnos-2.4.3.dist-info\INSTALLER
  pandoc_xnos-2.4.3.dist-info\LICENSE
  pandoc_xnos-2.4.3.dist-info\METADATA
  pandoc_xnos-2.4.3.dist-info\RECORD
  pandoc_xnos-2.4.3.dist-info\WHEEL
  pandoc_xnos-2.4.3.dist-info\entry_points.txt
  pandoc_xnos-2.4.3.dist-info\top_level.txt
  pandocxnos\__init__.py
  pandocxnos\__pycache__\__init__.cpython-38.pyc
  pandocxnos\__pycache__\core.cpython-38.pyc
  pandocxnos\__pycache__\main.cpython-38.pyc
  pandocxnos\__pycache__\pandocattributes.cpython-38.pyc
  pandocxnos\core.py
  pandocxnos\main.py
  pandocxnos\pandocattributes.py

Cheers!

tomduck commented 4 years ago

I am wondering if the solution to this problem under Windows is to just drop --user from the installation command?

Cheers, Tom

dmcnamee commented 3 years ago

hello, I had the same issue as @FrsLry on macOS. Uninstalling then reinstalling without the --user flag worked for me.

b0g2 commented 3 years ago

In Windows, I solved it by installing using pip:

pip install pandoc-fignos pandoc-eqnos pandoc-tablenos pandoc-secnos

and then adding the directory containing pandoc-xnos.exe to the path. I run pandoc using a batch script:

SET PATH=%PATH%;D:\ProgramData\Anaconda3\Scripts
pandoc --filter pandoc-xnos -t latex --template=latex.template --listings --number-sections --table-of-contents -o%argout%.tex %argin%

(in my case I am using anaconda).

You can find the directory by

pip show --files pandoc-xnos

as mentioned by @tomduck .

jankap commented 2 years ago

It's all about the path here. If you start a normal shell, e.g. cmd in Windows and just typing pandoc-xnos or pandoc-fignos returns in a command not found error, it's either not installed or the install folder is not on the Windows path. Try to remove it via pip uninstall, via admin shell. Reinstall and carefully watch where the stuff is installed into. Add this folder to the path and everything is fine.

Tutorial (not mine): https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/#:~:text=The%20most%20used%20environment%20variable,full%20path%20to%20the%20executable.

edit: And don't forget to restart your shell and VSCode if you made changes to the PATH!

Xezarior commented 1 year ago

I stumbled upon the same problem, but reinstalling (pip uninstall ... then pip install...) without the --user flag did not solve it. I think I did not remove it fully or something like that. Thank you all for the precious debugging information (I didn't know about printing the installation path of python packages), I found the folder and added it to my PATH.

In my case (Windows 11, Python 3.11) the PATH already includes the directory %USERPROFILE%\AppData\Local\Programs\Python\Python311\Scripts\ but pandoc-xnos has been installed into %USERPROFILE%\AppData\Roaming\Python\Python311\Scripts\ causing it to not being found because that one wasn't on the PATH.

Maybe it could be an approach to hint at this second path during the install script? I think that preserving the option to use the --user flag if desired could be valuable for non-admin environments like schools/shared servers and similar.