Reputation: 21
I'm using Nikola, a static website generator, to build a website. I am automating its building through Github Actions. I also wanted to use Pandoc to help convert my markdown to html, but I noted that Pandoc was not included in the original action. Therefore, I had to try to figure out myself how to include it. However, I've been thwarted time and again by FileNotFound
errors.
First, I tried to edit the action so that it installed Pandoc on the Ubuntu environment. Below is my edited version of the action. I only added the Install Pandoc on Ubuntu
step.
on: [push]
jobs:
nikola-build:
runs-on: ubuntu-latest
steps:
- name: Install Pandoc on Ubuntu
run: sudo apt-get install -y pandoc
- name: Check out
uses: actions/checkout@v2
- name: Build and Deploy Nikola
uses: getnikola/nikola-action@v3
with:
dry_run: false
When this failed again informing me that Pandoc could not be found, I added a requirements.txt
file to my repository:
Pandoc
I tried running the action again. Both installations—the action step I wrote and pip install pandoc
—ran without any issues and were successful. And yet when it came to the step where Nikola starts to build the website, it seems that no matter what is done, it fails in rendering, because Pandoc cannot not be found:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/nikola/plugins/compile/pandoc.py", line 76, in compile
subprocess.check_call(['pandoc', '-o', dest, source] + self._get_pandoc_options(source))
File "/usr/local/lib/python3.8/subprocess.py", line 359, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/local/lib/python3.8/subprocess.py", line 340, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pandoc'
I've looked absolutely everywhere for solutions to similar problems, but they are few and outdated. I would greatly appreciate any insight into this problem, what is at fault, what I can do to fix it, etc.
Upvotes: 1
Views: 6684
Reputation: 21
I discovered that the system was unable to find Pandoc as the entirety of the project was run in a Docker container; I had previously installed Pandoc on the system itself and failed. I was able to solve the problem by modifying the shell script to install Pandoc in the container.
Upvotes: 1
Reputation: 54897
pandoc
is not a Python package. It is a separate and very powerful command line tool. nikola
invokes the command line tool to do its work. You need to install it using the sudo apt install pandoc
command line that they suggest.
Upvotes: 4