Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation fails on Mac OS 12 #7

Open
lordfeck opened this issue May 21, 2022 · 3 comments
Open

Installation fails on Mac OS 12 #7

lordfeck opened this issue May 21, 2022 · 3 comments

Comments

@lordfeck
Copy link

lordfeck commented May 21, 2022

Greetings,

I run Mac OS 12.3 Monterey.

I went to install pelican-thumbnailer using the system supplied Python distribution and it failed with the following error whilst building Pillow:

      [............]
      copying src/PIL/PpmImagePlugin.py -> build/lib.macosx-12-x86_64-3.9/PIL
      copying src/PIL/FtexImagePlugin.py -> build/lib.macosx-12-x86_64-3.9/PIL
      running egg_info
      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'
      warning: no previously-included files found matching '.appveyor.yml'
      warning: no previously-included files found matching '.coveragerc'
      warning: no previously-included files found matching '.editorconfig'
      warning: no previously-included files found matching '.readthedocs.yml'
      warning: no previously-included files found matching 'codecov.yml'
      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
      no previously-included directories found matching '.ci'
      adding license file 'LICENSE'
      writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
      running build_ext
      
      
      The headers or library files could not be found for zlib,
      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 "/private/tmp/pip-install-s19uuh84/pillow_ddc2d36086314b8da9da4e973b335324/setup.py", line 864, in <module>
          setup(
        File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup
          return distutils.core.setup(**attrs)
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
          return run_commands(dist)
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
          dist.run_commands()
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
          self.run_command(cmd)
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/install.py", line 670, in run
          self.run_command('build')
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
          self.build_extensions()
        File "/private/tmp/pip-install-s19uuh84/pillow_ddc2d36086314b8da9da4e973b335324/setup.py", line 694, in build_extensions
          raise RequiredDependencyException(f)
      __main__.RequiredDependencyException: zlib
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/tmp/pip-install-s19uuh84/pillow_ddc2d36086314b8da9da4e973b335324/setup.py", line 918, in <module>
          raise RequiredDependencyException(msg)
      __main__.RequiredDependencyException:
      
      The headers or library files could not be found for zlib,
      a required dependency when compiling Pillow from source.
      
      Please see the install instructions at:
         https://pillow.readthedocs.io/en/latest/installation.html
      
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

I tried installing Pillow manually using pip3, but it installed a newer version (9.1.x) than that requested by Pelican-Thumbnailer. I also used brew to install zlib, as the makefile requested, but alas the problem persisted. It may be due to header/includes missing where to find the zlib source.

I'd appreciate any help/advice, or indeed if this could be patched in a future release.

Thanks very much.

@lordfeck
Copy link
Author

lordfeck commented May 22, 2022

Update, I found a temporary workaround thanks to this.

First, install zlib using Homebrew.

Then run this in your shell:

export CPPFLAGS="-I$(brew --prefix zlib)/include"

Then run pip3 install pelican-thumbnailer. Pillow 7.2.0 builds successfully and thumbnailer may be installed.

@justinmayer
Copy link
Contributor

Hi @lordfeck. I wouldn't recommend using the Python interpreter included with MacOS Command-Line Tools. It can cause myriad issues, including the one you experienced, and for the most part I think it is best that folks pretend that it does not exist.

I wrote an article that documents the method I recommend, which uses asdf and its Python plugin to install Python.

@lordfeck
Copy link
Author

lordfeck commented Jun 3, 2022

@justinmayer thanks kindly for your response. I've actually had problems in the past with the bundled Python, I thought they were one-offs, but I think there is a pattern here! I'll have a go at the method you've detailed using asdf.

I'd like to add that I greately appreciate your work on Pelican - I was looking for a capable, non-bloated but extensible SSG and it suits that use case perfectly.

Offtopic, but I'd like to share that I made my own custom theme in Jinja then used it to build a blog/personal website at www.thran.uk. Your project's documentation was a great aid in this task, especially in how it described the objects, so I have the site reliably working with my slightly strange pagination rules. When I have a spare moment, I would be willing adapt the theme to be more generic and contribute it to the project, if you think it is suitable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants