if name == 'main': # To ensure correct behavior on Windows and macOS
ocrmypdf.ocr('线索.pdf', 'output.pdf', deskew=True)
Where are you installing/running from?
PyPI (pip, poetry, pipx, etc.)
OCRmyPDF version
ocrmypdf 16.4.2.dev8+g5256e74d
What operating system are you working on?
Linux
Operating system details and version
22.04
Simple sanity checks
[X] Operating system is currently supported by its vendor (not end of life)
[X] Python version is compatible with OCRmyPDF
[X] This issue is not about a specific input file
Relevant log output
The program 'gs' could not be executed or was not found on your
system PATH.
Traceback (most recent call last):
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/subprocess/__init__.py", line 158, in get_version
proc = run(
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/subprocess/__init__.py", line 62, in run
proc = subprocess_run(args, env=env, check=check, **kwargs)
File "/usr/local/envs/yourEnv/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/envs/yourEnv/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/envs/yourEnv/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gs'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/output/untitled.py", line 4, in <module>
ocrmypdf.ocr('线索.pdf', 'output.pdf', deskew=True)
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/api.py", line 379, in ocr
check_options(options, plugin_manager)
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/_validation.py", line 237, in check_options
_check_plugin_options(options, plugin_manager)
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/_validation.py", line 230, in _check_plugin_options
plugin_manager.hook.check_options(options=options)
File "/output/.venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
File "/output/.venv/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/output/.venv/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/output/.venv/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/builtin_plugins/ghostscript.py", line 53, in check_options
check_external_program(
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/subprocess/__init__.py", line 324, in check_external_program
found_version = version_checker()
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/_exec/ghostscript.py", line 72, in version
return Version(get_version(GS))
File "/output/.venv/lib/python3.10/site-packages/ocrmypdf/subprocess/__init__.py", line 169, in get_version
raise MissingDependencyError(
ocrmypdf.exceptions.MissingDependencyError: Could not find program 'gs' on the PATH
What were you trying to do?
import ocrmypdf
if name == 'main': # To ensure correct behavior on Windows and macOS ocrmypdf.ocr('线索.pdf', 'output.pdf', deskew=True)
Where are you installing/running from?
PyPI (pip, poetry, pipx, etc.)
OCRmyPDF version
ocrmypdf 16.4.2.dev8+g5256e74d
What operating system are you working on?
Linux
Operating system details and version
22.04
Simple sanity checks
Relevant log output