libigl-python-bindings icon indicating copy to clipboard operation
libigl-python-bindings copied to clipboard

`python setup.py develop` fails

Open alecjacobson opened this issue 3 years ago • 5 comments

I'm trying to learn how to write a new python binding. As a first step, I tried to build the bindings locally. When I clone this repository and issue as per the README.md

python setup.py develop

I get these errors:

running develop
running egg_info
creating igl.egg-info
writing igl.egg-info/PKG-INFO
writing dependency_links to igl.egg-info/dependency_links.txt
writing requirements to igl.egg-info/requires.txt
writing top-level names to igl.egg-info/top_level.txt
writing manifest file 'igl.egg-info/SOURCES.txt'
reading manifest file 'igl.egg-info/SOURCES.txt'
writing manifest file 'igl.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 20, in run
    out = subprocess.check_output(['cmake', '--version'])
  File "/Users/ajx/opt/miniconda3/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/ajx/opt/miniconda3/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/ajx/opt/miniconda3/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/ajx/opt/miniconda3/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'cmake'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 71, in <module>
    setup(
  File "/Users/ajx/opt/miniconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 161, in setup
    return distutils.core.setup(**attrs)
  File "/Users/ajx/opt/miniconda3/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/ajx/opt/miniconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Users/ajx/opt/miniconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/ajx/opt/miniconda3/lib/python3.8/site-packages/setuptools/command/develop.py", line 38, in run
    self.install_for_development()
  File "/Users/ajx/opt/miniconda3/lib/python3.8/site-packages/setuptools/command/develop.py", line 140, in install_for_development
    self.run_command('build_ext')
  File "/Users/ajx/opt/miniconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Users/ajx/opt/miniconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 22, in run
    raise RuntimeError(
RuntimeError: pyigl

Are there some dependencies or prerequisites not listed in the README.md which I should take care of first?

alecjacobson avatar Sep 29 '21 14:09 alecjacobson

It seems that python cannot find cmake. Is it in the path?

teseoch avatar Sep 29 '21 14:09 teseoch

Seems that the script was not successfully finding my cmake. I had it installed at /Applications/CMake.app and my terminal had the alias alias cmake="/Applications/CMake.app/Contents/bin/cmake".

To avoid having to change this script, I deleted my cmake application and installed cmake via homebrew:

brew install cmake

Seems like the setup script could find it now. (It's crunching away on compilation now, but so far looks reasonable)

alecjacobson avatar Sep 29 '21 14:09 alecjacobson

I see that setup.py is trying to catch not having cmake installed and print a nice error. This didn't happen (see above). Is there a better way to detect this?

alecjacobson avatar Sep 29 '21 14:09 alecjacobson

I'm not sure about python error catching. It's currently catching OSError. Should it (also) be catching FileNotFoundError ?

alecjacobson avatar Sep 29 '21 14:09 alecjacobson

No. I think it's catching the error but somehow just printing pyigl instead of the RuntimeError message. I'll continue to debug. If anyone sees an easy fix, please let me know.

alecjacobson avatar Sep 29 '21 15:09 alecjacobson