dfm / george

Fast and flexible Gaussian Process regression in Python
http://george.readthedocs.io
MIT License
445 stars 128 forks source link

Pip-install fails when pybind11 is not already installed #129

Closed nilsvu closed 3 years ago

nilsvu commented 4 years ago

A clean pip install george fails when building wheels (tested for Python 3.6) because pybind11 can't be found. It succeeds in the second attempt. Apparently pybind11 is correctly listed as a dependency of the george package and gets installed by pip, but at the point where the wheels are built the pybind11 package is not available yet. Here's an example notebook that reproduces the issue:

Here's the full output:

$ pip install george
Collecting george
  Downloading https://files.pythonhosted.org/packages/27/19/9de575be629e3a41c3ca6b1e2c80e0ae90a2e831436c5f70cc8d72e37ab7/george-0.3.1.tar.gz (1.8MB)
     |████████████████████████████████| 1.8MB 1.8MB/s eta 0:00:01
Requirement already satisfied: numpy in /home/nbuser/anaconda3_501/lib/python3.6/site-packages (from george) (1.16.2)
Requirement already satisfied: scipy in /home/nbuser/anaconda3_501/lib/python3.6/site-packages (from george) (1.1.0)
Collecting pybind11
  Downloading https://files.pythonhosted.org/packages/89/e3/d576f6f02bc75bacbc3d42494e8f1d063c95617d86648dba243c2cb3963e/pybind11-2.5.0-py2.py3-none-any.whl (296kB)
     |████████████████████████████████| 296kB 1.8MB/s eta 0:00:01
Building wheels for collected packages: george
  Building wheel for george (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/nbuser/anaconda3_501/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-atg5mm6a/george/setup.py'"'"'; __file__='"'"'/tmp/pip-install-atg5mm6a/george/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ez8yjvc3 --python-tag cp36
       cwd: /tmp/pip-install-atg5mm6a/george/
  Complete output (71 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/george
  copying george/kernels.py -> build/lib.linux-x86_64-3.6/george
  copying george/metrics.py -> build/lib.linux-x86_64-3.6/george
  copying george/modeling.py -> build/lib.linux-x86_64-3.6/george
  copying george/gp.py -> build/lib.linux-x86_64-3.6/george
  copying george/__init__.py -> build/lib.linux-x86_64-3.6/george
  copying george/utils.py -> build/lib.linux-x86_64-3.6/george
  creating build/lib.linux-x86_64-3.6/george/solvers
  copying george/solvers/hodlr.py -> build/lib.linux-x86_64-3.6/george/solvers
  copying george/solvers/basic.py -> build/lib.linux-x86_64-3.6/george/solvers
  copying george/solvers/trivial.py -> build/lib.linux-x86_64-3.6/george/solvers
  copying george/solvers/__init__.py -> build/lib.linux-x86_64-3.6/george/solvers
  running egg_info
  writing george.egg-info/PKG-INFO
  writing dependency_links to george.egg-info/dependency_links.txt
  writing requirements to george.egg-info/requires.txt
  writing top-level names to george.egg-info/top_level.txt
  reading manifest file 'george.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'george.egg-info/SOURCES.txt'
  copying george/kernel_interface.cpp -> build/lib.linux-x86_64-3.6/george
  creating build/lib.linux-x86_64-3.6/george/include
  copying george/include/.DS_Store -> build/lib.linux-x86_64-3.6/george/include
  creating build/lib.linux-x86_64-3.6/george/include/george
  copying george/include/george/exceptions.h -> build/lib.linux-x86_64-3.6/george/include/george
  copying george/include/george/george.h -> build/lib.linux-x86_64-3.6/george/include/george
  copying george/include/george/hodlr.h -> build/lib.linux-x86_64-3.6/george/include/george
  copying george/include/george/kernels.h -> build/lib.linux-x86_64-3.6/george/include/george
  copying george/include/george/metrics.h -> build/lib.linux-x86_64-3.6/george/include/george
  copying george/include/george/parser.h -> build/lib.linux-x86_64-3.6/george/include/george
  copying george/include/george/subspace.h -> build/lib.linux-x86_64-3.6/george/include/george
  copying george/solvers/_hodlr.cpp -> build/lib.linux-x86_64-3.6/george/solvers
  running build_ext
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-atg5mm6a/george/setup.py", line 231, in <module>
      zip_safe=True,
    File "/home/nbuser/anaconda3_501/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/nbuser/anaconda3_501/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 204, in run
      self.run_command('build')
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/nbuser/anaconda3_501/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 84, in run
      _build_ext.run(self)
    File "/home/nbuser/anaconda3_501/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
      _build_ext.build_ext.run(self)
    File "/home/nbuser/anaconda3_501/lib/python3.6/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/tmp/pip-install-atg5mm6a/george/setup.py", line 106, in build_extensions
      import pybind11
  ModuleNotFoundError: No module named 'pybind11'
  ----------------------------------------
  ERROR: Failed building wheel for george
  Running setup.py clean for george
Failed to build george
dfm commented 4 years ago

Thanks!

This is a known failure that should be fixed by https://github.com/dfm/george/pull/124 but I haven't had a chance to work on this in a while. The current recommendation is to install pybind11 first manually.