Open3d pip_install error on Mac

I’ve been installing open3d on my Mac Catalina using:

slicer.util.pip_install('open3d==0.9.0')

with no problem up until about 2 days ago. With today’s preview I’m getting the following errors:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -pthread -Wall -g -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/argon2.c -o build/temp.macosx-10.13-x86_64-3.6/extras/libargon2/src/argon2.o
  extras/libargon2/src/argon2.c:18:10: fatal error: 'string.h' file not found
  #include <string.h>
           ^~~~~~~~~~
  1 error generated.
  error: command '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for argon2-cffi
Failed to build argon2-cffi
ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 20.1.1; however, version 20.2.1 is available.
You should consider upgrading via the '/Applications/Slicer.app/Contents/bin/./python-real -m pip install --upgrade pip' command.
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 2444, in pip_install
    _executePythonModule('pip', args)
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 2420, in _executePythonModule
    logProcessOutput(proc)
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 2392, in logProcessOutput
    raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '-m', 'pip', 'install', 'open3d==0.9.0']' returned non-zero exit status 1.

The first version where I can replicate this issue is from 2 days ago. The Windows preview versions install with no problem.

@pieper I believe you are using open3d on a Mac, is this something you’ve seen?

Hi @smrolfe - I’ve been using open3d on windows, where this problem doesn’t happen.

But I think I recognize the issue. Mac no longer have the standard headers in /usr/include, so you need to set this variable in your environment when you start Slicer:

export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

The only change I can think is that this is a side effect of turning off the ParameterSerializer, but that was a week ago now. Are you sure it’s a change in Slicer and not something else?

More info at this issue:

https://mantisarchive.slicer.org/view.php?id=4681 (old mantis link)

Git follow up:

Thanks @pieper I went back and tried some archived versions and the first one with this problem is 4.11.0-2020-07-24 r29227 / 38b40eb from 6 days ago.

I installed Open3D on Windows and observed that it had to install a whole bunch of packages where some specify specific dependency versions and others don’t.

Installing collected packages: parso, jedi, backcall, wcwidth, prompt-toolkit, decorator, pygments, colorama, pickleshare, ipython-genutils, traitlets, ipython, tornado, pywin32, jupyter-core, python-dateutil, pyzmq, jupyter-client, ipykernel, prometheus-client, pywinpty, terminado, MarkupSafe, jinja2, pycparser, cffi, argon2-cffi, Send2Trash, zipp, importlib-metadata, attrs, pyrsistent, jsonschema, nbformat, testpath, webencodings, bleach, defusedxml, mistune, entrypoints, pandocfilters, nbconvert, notebook, widgetsnbextension, ipywidgets, open3d

In this case the notebook package starting with version 6.1.0 added the argon2-cffi dependency which doesn’t have a macOS wheel available for the latest release which is why it had to build a wheel from source which it failed at in your output. Notebook version 6.1.0 was released July 31st which explains why you ran into this issue just recently.

Thanks @jamesobutler that makes sense. I had fixed my Open3D version, but did not check for changes in the dependancies.

To test this, I installed the previous version of Notebook first:

slicer.util.pip_install('notebook==6.0.3')
slicer.util.pip_install('open3d==0.9.0')

And it now installs without error. I think this solution will work for now.

4 Likes

Great detective work!

1 Like