Cannot install requirement - python-poppler

Hi Guys/Gals,

I been having issues with installing python-poppler using the streamlit share.

The project is here

It does not have a lot of requirements but I get this error while deploying to streamlit

 ----------------------------------------
  ERROR: Failed building wheel for python-poppler
  Running setup.py clean for python-poppler
Failed to build python-poppler
Installing collected packages: python-poppler, gTTS
    Running setup.py install for python-poppler: started
    Running setup.py install for python-poppler: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg install --record /tmp/pip-record-avi4oe8l/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/appuser/.local/include/python3.7m/python-poppler
         cwd: /tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/
    Complete output (73 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/utilities.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/image.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/font.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/destination.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/page.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/document.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/__init__.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/rectangle.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/_version.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/toc.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/pagetransition.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/embeddedfile.py -> build/lib.linux-x86_64-3.7/poppler
    copying src/poppler/pagerenderer.py -> build/lib.linux-x86_64-3.7/poppler
    creating build/lib.linux-x86_64-3.7/poppler/cpp
    copying src/poppler/cpp/__init__.py -> build/lib.linux-x86_64-3.7/poppler/cpp
    running egg_info
    writing src/python_poppler.egg-info/PKG-INFO
    writing dependency_links to src/python_poppler.egg-info/dependency_links.txt
    writing top-level names to src/python_poppler.egg-info/top_level.txt
    reading manifest file 'src/python_poppler.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'src/python_poppler.egg-info/SOURCES.txt'
    running build_ext
    Traceback (most recent call last):
      File "/tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/setup.py", line 24, in run
        out = subprocess.check_output(["cmake", "--version"])
      File "/usr/local/lib/python3.7/subprocess.py", line 411, in check_output
        **kwargs).stdout
      File "/usr/local/lib/python3.7/subprocess.py", line 488, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/usr/local/lib/python3.7/subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "/usr/local/lib/python3.7/subprocess.py", line 1551, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'cmake': 'cmake'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/setup.py", line 106, in <module>
        zip_safe=False,
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/local/lib/python3.7/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/setup.py", line 28, in run
        + ", ".join(e.name for e in self.extensions)
    RuntimeError: CMake must be installed to build the following extensions: poppler.cpp.modules
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sizt2qxw/python-poppler_99216da101344a0a9c606c48ed0c949e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg install --record /tmp/pip-record-avi4oe8l/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/appuser/.local/include/python3.7m/python-poppler Check the logs for full command output.

Kindly help

The error message tells you the problem, you need to install CMake. For system-level packages such as compilers and build tools, you need to add a packages.txt file to your repo, with cmake and any other tools you might need.

Best,
Randy

1 Like

Thanks Randy, I read the docs just before checking here. It works.

Will share the link soon :stuck_out_tongue: