Linuxbrew-core: brew install libxslt fails - No Python.h found

Created on 18 Sep 2018  Â·  15Comments  Â·  Source: Homebrew/linuxbrew-core

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • [x] have a problem with brew install (or upgrade, reinstall) a single formula? If it's a general brew problem please file this issue at Linuxbrew/brew: https://github.com/Linuxbrew/brew/issues/new/choose. If it's a tap (e.g. Brewsci/homebrew-bio) problem please file this issue at the tap.
  • [x] ran brew update and can still reproduce the problem?
  • [x] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [x] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [ ] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:

  • What you were trying to do (and why)
  • What happened (include command output)
  • What you expected to happen
  • Step-by-step reproduction instructions (by running brew install commands)

I'm on a linux server (Red Hat Enterprise 7) and worked quite happily with brew for multiple years now. Due to hardware issues I had to reinstall everything and now, the compilation of libxslt fails as brew fails to see the Python headers.

brew install libxslt fails.

Please see the link for the brew gist-logs:
https://gist.github.com/Martingales/23cc62e52f4bd1cedc8ced0c3e87a550

Thanks for having a look into this!

in progress outdated user configuration

Most helpful comment

I have confirmed this bug on a completely different cluster running CentOS.

https://gist.github.com/Martingales/bf8a61792a186eae34b9c7d324a69daf

All 15 comments

I have confirmed this bug on a completely different cluster running CentOS.

https://gist.github.com/Martingales/bf8a61792a186eae34b9c7d324a69daf

Additional confirmation on Ubuntu 14.04.2 LTS.

What does find / -name Python.h give?

Is python@2 installed?

find / -name Python.h takes a while as I'm on a large shared cluster. Will return the output once it finishes.

Meanwhile, this is the output of locate Python.h and brew list:

locate Python.h:

/usr/include/python2.7/Python.h
/usr/share/doc/swig-doc-2.0.10/Doc/Manual/Python.html

brew list

autoconf binutils curl gcc glibc htslib libbsd libtool minia patchelf python source-highlight util-linux
automake boost docbook gdbm gmp [email protected] libevent libxml2 mpfr pcre python@2 sphinx-doc xz
bash-completion bzip2 docbook-xsl gettext gpatch itstool libffi linux-headers ncurses pcre2 readline sqlite zlib
bcftools cmake expat git gsl last libmpc m4 openssl pkg-config samtools tree

So, yes, Python@2 is installed.

You can reduce the search time by using:
find /home/linuxbrew/.linuxbrew/Cellar -name Python.h

This should give you:
/home/linuxbrew/.linuxbrew/Cellar/python@2/2.7.15_1/include/python2.7/Python.h linuxbrew@3e40aaea99f5:~/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/

If not it means that python@2 is not correctly installed. I would recommend re-reunnig brew update-reset, brew uninstall python@2 and brew install python@2.

I found two Python.h files in my brew directory:
/PATH/TO/BREW/Cellar/python@2/2.7.15_1/include/python2.7/Python.h
/PATH/TO/BREW/Cellar/python/3.7.0/include/python3.7m/Python.h

I have also performed the brew update-reset and reinstalling of python@2 but no change. The Python.h headers are still there and libxslt cannot be installed failing with the same error message as before.

As a hack, editing the formula and pointing to the path where Python.h resides works for me.

def install
    if build.head?
      ENV["NOCONFIGURE"] = "yes"
      system "./autogen.sh"
    end

    # https://bugzilla.gnome.org/show_bug.cgi?id=762967
    inreplace "configure", /PYTHON_LIBS=.*/, 'PYTHON_LIBS="-undefined dynamic_lookup"'

    system "./configure", "--disable-dependency-tracking",
                          "--disable-silent-rules",
                          "--prefix=#{prefix}",
                          ("--without-crypto" if OS.linux?),
                          "--with-python=/PATH/TO/.linuxbrew/Cellar/python@2/2.7.15_1/include/python2.7"
                          "--with-libxml-prefix=#{Formula["libxml2"].opt_prefix}"
    system "make"
    system "make", "install"
end

Would you like to open a pull request with the change?
The path can be written as: #{Formula["python@2"].opt_include}, so that we do not need to hardcode it.

@celadevra I countered the same problem. Where I can edit the formula?

You can do this in this file: https://github.com/Linuxbrew/homebrew-core/blob/master/Formula/libxslt.rb

I can guide you through the process of opening the pull request if you need any help.

I have tried the solution proposed by @celadevra and @iMichka but I couldn't get it to work. Here is what I have tried:

system "./configure", "--disable-dependency-tracking",
                      "--disable-silent-rules",`
                      "--prefix=#{prefix}",
                      ("--without-crypto" if OS.linux?),
                      "--with-python=#{Formula["python@2"].opt_include}/python@2/include/python2.7",
                      "--with-libxml-prefix=#{Formula["libxml2"].opt_prefix}"

That --with-python is definitely pointing to the right folder as confirmed in the .configure logs but it is still not recognised by make. I have then changed the paragraph and pointed brew to the vanilla Python of my computer and it now works.

system "./configure", "--disable-dependency-tracking",
                      "--disable-silent-rules",`
                      "--prefix=#{prefix}",
                      ("--without-crypto" if OS.linux?),
                      "--with-python=/usr/include/python2.7",
                      "--with-libxml-prefix=#{Formula["libxml2"].opt_prefix}"

This is a horrible hack but it seems to be correctly installed as confirmed by brew info libxslt:

libxslt: stable 1.1.32, HEAD
C XSLT library for GNOME
http://xmlsoft.org/XSLT/
/PATH/TO/brew/Cellar/libxslt/1.1.32 (139 files, 3.2MB) *
Built from source on 2018-10-10 at 16:22:21
From: https://github.com/Linuxbrew/homebrew-core/blob/master/Formula/libxslt.rb
==> Dependencies
Required: libxml2 ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
To allow the nokogiri gem to link against this libxslt run:
gem install nokogiri -- --with-xslt-dir=/PATH/TO/brew/opt/libxslt
==> Analytics
install: 2,710 (30d), 13,307 (90d), 56,373 (365d)
install_on_request: 2,269 (30d), 10,460 (90d), 38,591 (365d)
build_error: 0 (30d)

@yolanda0001 You can change a formula by brew edit libxslt in your terminal.

@iMichka created PR #9790 . Two errors during CI but they don't seem to be related to the commit itself. Please review it.

I also encountered with this. Have it been solved?

This is now fixed with #9790. Please run brew update and try again.

Was this page helpful?
0 / 5 - 0 ratings