Pillow won't install: libjpeg-dev (missing)

I’m trying to install with Pillow on hass.io 0.89 (appdaemon addon 1.7.0)

{
  "log_level": "info",
  "disable_auto_token": false,
  "system_packages": [
    "zlib-dev"
  ],
  "python_packages": [
    "Pillow"
  ]
}
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-867msjnt/Pillow/setup.py", line 812, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:
    
    The headers or library files could not be found for jpeg,
    a required dependency when compiling Pillow from source.

So I add libjpeg-dev:

{
  "log_level": "info",
  "disable_auto_token": false,
  "system_packages": [
    "zlib-dev",
    "libjpeg-dev"
  ],
  "python_packages": [
    "Pillow"
  ]
}

and then:

ERROR: unsatisfiable constraints:
  libjpeg-dev (missing):
    required by: world[libjpeg-dev]
FATAL: Failed installing package libjpeg-dev

Anyone?

1 Like

thats the problem when you try to do advanced stuff on a platform that is designed for noobs.
its very well possible that not every lib is there for the light platform that hassio is using.

but you can try.

it seems that libjpeg isnt there for that platform, so you need to find a simular lib that satisfies pillow.
the best way to start is to find out all the dependencies from pillow. (maybe you can find that out on pypi, or you can try looking inside the setup file from pillow)
then you need to find packages that contain those dependencies and that work on the hassio platform.

the other day i tried to help someone else installing something like this.
it involved dozens of times restarting, trying, and again searching on google for another package.

the last error shows only 1 thing: libjpeg-dev isnt available for the hassio platform.

I got that last part :wink:

I have not been able to find an alternative, that’s why I’m asking :slight_smile:

thats why i gave you some pointers where you could look for clues. :wink:
i havent seen anyone else trying to install pillow on hassio (and i read every AD topic), so i am afraid noone can tell you what you need for dependencies.

i would start with trying to read the setup file and then google for what you find in there combined with resin(i believe thats what hassio is based on)

Thx,

I tied and tried…

{
  "log_level": "info",
  "disable_auto_token": false,
  "system_packages": [
    "zlib-dev",
    "libjpeg-turbo-dev",
    "gcc",
    "libwebp",
    "tk",
    "openjpeg",
    "python-dev"
  ],
  "python_packages": [
    "Pip==19.0.3",
    "pillow"
  ]
}

I got as far as:

   building 'PIL._imaging' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    creating build/temp.linux-x86_64-3.6/src/libImaging
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -DPILLOW_VERSION="5.4.1" -I/tmp/pip-install-xr8nqb_8/pillow/src/libImaging -I/tmp/pip-install-xr8nqb_8/pillow -I/usr/include -I/usr/include/python3.6m -c src/_imaging.c -o build/temp.linux-x86_64-3.6/src/_imaging.o
    building 'PIL._imagingtk' extension
    creating build/temp.linux-x86_64-3.6/src/Tk
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/Tk -I/tmp/pip-install-xr8nqb_8/pillow/src/libImaging -I/tmp/pip-install-xr8nqb_8/pillow -I/usr/include -I/usr/include/python3.6m -c src/_imagingtk.c -o build/temp.linux-x86_64-3.6/src/_imagingtk.o
    src/_imagingtk.c:16:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    src/_imaging.c:74:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    building 'PIL._imagingmath' extension
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/tmp/pip-install-xr8nqb_8/pillow/src/libImaging -I/tmp/pip-install-xr8nqb_8/pillow -I/usr/include -I/usr/include/python3.6m -c src/_imagingmath.c -o build/temp.linux-x86_64-3.6/src/_imagingmath.o
    building 'PIL._imagingmorph' extension
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/tmp/pip-install-xr8nqb_8/pillow/src/libImaging -I/tmp/pip-install-xr8nqb_8/pillow -I/usr/include -I/usr/include/python3.6m -c src/_imagingmorph.c -o build/temp.linux-x86_64-3.6/src/_imagingmorph.o
    src/_imagingmath.c:16:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    src/_imagingmorph.c:14:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xr8nqb_8/pillow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-0wrtmkzl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-xr8nqb_8/pillow/
FATAL: Failed installing package pillow
[cont-init.d] 81-python-packages.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 50-compiled-symlink.sh: executing... 
[cont-finish.d] 50-compiled-symlink.sh: exited 0.
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

gcc did ring a bell here.

this is another thread where we tried to find what all needed to be installed and it seems that putting in g++ instead of gcc could bring you closer.

Thanks.

I tried all suggestions from that topic, but I’m afraid it still doesn’t work.

{
  "log_level": "info",
  "disable_auto_token": false,
  "system_packages": [
    "libcurl",
    "python3-dev",
    "curl-dev",
    "gcc",
    "g++"
  ],
  "python_packages": [
    "pip==19.0.3",
    "pycurl",
    "Pillow"
  ]
}
...
    writing src/Pillow.egg-info/PKG-INFO
    writing dependency_links to src/Pillow.egg-info/dependency_links.txt
    writing top-level names to src/Pillow.egg-info/top_level.txt
    reading manifest file 'src/Pillow.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching '*.c'
    warning: no files found matching '*.h'
    warning: no files found matching '*.sh'
    no previously-included directories found matching 'docs/_static'
    warning: no previously-included files found matching '.appveyor.yml'
    warning: no previously-included files found matching '.coveragerc'
    warning: no previously-included files found matching '.codecov.yml'
    warning: no previously-included files found matching '.editorconfig'
    warning: no previously-included files found matching '.landscape.yaml'
    warning: no previously-included files found matching '.readthedocs.yml'
    warning: no previously-included files found matching '.travis'
    warning: no previously-included files found matching '.travis/*'
    warning: no previously-included files found matching 'tox.ini'
    warning: no previously-included files matching '.git*' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
    running build_ext
    
    
    The headers or library files could not be found for jpeg,
    a required dependency when compiling Pillow from source.
    
    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html
    
    Traceback (most recent call last):
      File "/tmp/pip-install-oy1236nk/Pillow/setup.py", line 800, in <module>
        zip_safe=not (debug_build() or PLATFORM_MINGW), )
      File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.6/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/tmp/pip-install-oy1236nk/Pillow/setup.py", line 612, in build_extensions
        raise RequiredDependencyException(f)
    __main__.RequiredDependencyException: jpeg
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-oy1236nk/Pillow/setup.py", line 812, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:
    
    The headers or library files could not be found for jpeg,
    a required dependency when compiling Pillow from source.
    
    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html
    
    
    
    ----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-oy1236nk/Pillow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ni6r2rke/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-oy1236nk/Pillow/
FATAL: Failed installing package Pillow
[cont-init.d] 81-python-packages.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 50-compiled-symlink.sh: executing... 
[cont-finish.d] 50-compiled-symlink.sh: exited 0.
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

Yes!!! Got it:

{
  "log_level": "info",
  "disable_auto_token": false,
  "system_packages": [
    "libcurl",
    "zlib-dev",
    "libjpeg-turbo-dev",
    "libwebp",
    "tk",
    "openjpeg",
    "python3-dev",
    "curl-dev",
    "gcc",
    "g++"
  ],
  "python_packages": [
    "pip==19.0.3",
    "pycurl",
    "Pillow"
  ]
}

2019-03-09 16:08:28.923121 INFO AppDaemon Version 3.0.2 starting
2019-03-09 16:08:28.923419 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-03-09 16:08:28.924625 INFO AppDaemon: Starting Apps
2019-03-09 16:08:28.927889 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-03-09 16:08:29.007533 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-03-09 16:08:29.008075 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-03-09 16:08:29.008320 INFO Starting Dashboards
2019-03-09 16:08:29.014764 INFO API is disabled
2019-03-09 16:08:29.021017 INFO AppDaemon: HASS: Connected to Home Assistant 0.89.1
2019-03-09 16:08:29.106416 INFO AppDaemon: Got initial state from namespace default
2019-03-09 16:08:31.096120 INFO AppDaemon: Reading config
2019-03-09 16:08:31.097751 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-03-09 16:08:31.097866 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-03-09 16:08:31.097973 INFO AppDaemon: App ‘hello_world’ added
2019-03-09 16:08:31.098149 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-03-09 16:08:31.098415 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2019-03-09 16:08:31.107492 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2019-03-09 16:08:31.173009 INFO hello_world: Hello from AppDaemon
2019-03-09 16:08:31.174149 INFO hello_world: You are now ready to run Apps!
2019-03-09 16:08:31.174749 INFO AppDaemon: App initialization complete

5 Likes

Thank you very much!

Which file do you add this info to to get zlib and pillow to install?