NWChemEx / ParallelZone

You're travelling through another dimension, a dimension not only of CPUs and threads but of GPUs; a journey into a wondrous land whose boundaries are bandwidth limited. That's the signpost up ahead - your next stop, the ParallelZone!
https://nwchemex.github.io/ParallelZone/
Apache License 2.0
0 stars 1 forks source link

Error Installing Cppyy #84

Closed ryanmrichard closed 1 year ago

ryanmrichard commented 1 year ago

Description

I forgot to pre-install Cppyy and ran into a build error when FindCppyy.cmake tries to install Cppyy (N.B. this issue still exists). I can't remember why we were recommending pre-installing Cppyy (maybe it was this?), nor did I see an issue tied to this error.

To Reproduce

I'm using the master branch with some slight changes. First, in FindCppyy.cmake I've set set(cppyy_version "2.4.0") (that's the version suggested on Slack). My toolchain is:

#Compilers
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)
set(MPI_C_COMPILER "/usr/bin/mpicc")
set(MPI_CXX_COMPILER "/usr/bin/mpicxx")

# Token for private repos
set(CPP_GITHUB_TOKEN "SuperSecretToken")

# Build Settings
set(BUILD_TESTING ON)
set(BUILD_SHARED_LIBS ON)

and this is a clean build. I'm not using Python virtual environments or anything like that either.

The Error

[cmake] Collecting cppyy==2.4.0
[cmake]   Downloading cppyy-2.4.0.tar.gz (24 kB)
[cmake]   Installing build dependencies: started
[cmake]   Installing build dependencies: finished with status 'done'
[cmake]   Getting requirements to build wheel: started
[cmake]   Getting requirements to build wheel: finished with status 'done'
[cmake]   Installing backend dependencies: started
[cmake]   Installing backend dependencies: finished with status 'error'
[cmake]   error: subprocess-exited-with-error
[cmake]   
[cmake]   × pip subprocess to install backend dependencies did not run successfully.
[cmake]   │ exit code: 1
[cmake]   ╰─> [87 lines of output]
[cmake]       Collecting cppyy-backend==1.14.9
[cmake]         Downloading cppyy-backend-1.14.9.tar.gz (34 kB)
[cmake]         Installing build dependencies: started
[cmake]         Installing build dependencies: finished with status 'done'
[cmake]         Getting requirements to build wheel: started
[cmake]         Getting requirements to build wheel: finished with status 'done'
[cmake]         Preparing metadata (pyproject.toml): started
[cmake]         Preparing metadata (pyproject.toml): finished with status 'done'
[cmake]       Collecting cppyy-cling==6.27.0
[cmake]         Using cached cppyy_cling-6.27.0-py2.py3-none-manylinux2014_x86_64.whl (32.4 MB)
[cmake]       Building wheels for collected packages: cppyy-backend
[cmake]         Building wheel for cppyy-backend (pyproject.toml): started
[cmake]         Building wheel for cppyy-backend (pyproject.toml): finished with status 'error'
[cmake]         error: subprocess-exited-with-error
[cmake]       
[cmake]         × Building wheel for cppyy-backend (pyproject.toml) did not run successfully.
[cmake]         │ exit code: 1
[cmake]         ╰─> [63 lines of output]
[cmake]             running bdist_wheel
[cmake]             running build
[cmake]             running build_ext
[cmake]             creating build/temp.linux-x86_64-3.10/src
[cmake]             x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/tmp/pip-build-env-i8bdaaej/overlay/local/lib/python3.10/dist-packages/cppyy_backend/include -I/usr/include/python3.10 -c src/clingwrapper.cxx -o build/temp.linux-x86_64-3.10/src/clingwrapper.o -O2 -pthread -std=c++1z -m64
[cmake]             creating build/lib.linux-x86_64-3.10
[cmake]             creating build/lib.linux-x86_64-3.10/cppyy_backend
[cmake]             creating build/lib.linux-x86_64-3.10/cppyy_backend/lib
[cmake]             x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 build/temp.linux-x86_64-3.10/src/clingwrapper.o -L/usr/lib/x86_64-linux-gnu -o build/lib.linux-x86_64-3.10/cppyy_backend/lib/libcppyy_backend.so -Wl,-Bsymbolic-functions
[cmake]             running install
[cmake]             running install_lib
[cmake]             Traceback (most recent call last):
[cmake]               File "/tmp/tmpzertntz6_in_process.py", line 363, in <module>
[cmake]                 main()
[cmake]               File "/tmp/tmpzertntz6_in_process.py", line 345, in main
[cmake]                 json_out['return_val'] = hook(**hook_input['kwargs'])
[cmake]               File "/tmp/tmpzertntz6_in_process.py", line 261, in build_wheel
[cmake]                 return _build_backend().build_wheel(wheel_directory, config_settings,
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 230, in build_wheel
[cmake]                 return self._build_with_temp_dir(['bdist_wheel'], '.whl',
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
[cmake]                 self.run_setup()
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 267, in run_setup
[cmake]                 super(_BuildMetaLegacyBackend,
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
[cmake]                 exec(compile(code, __file__, 'exec'), locals())
[cmake]               File "setup.py", line 182, in <module>
[cmake]                 setup(
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
[cmake]                 return distutils.core.setup(**attrs)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
[cmake]                 return run_commands(dist)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 163, in run_commands
[cmake]                 dist.run_commands()
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
[cmake]                 self.run_command(cmd)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
[cmake]                 cmd_obj.run()
[cmake]               File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 335, in run
[cmake]                 self.run_command('install')
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
[cmake]                 self.distribution.run_command(command)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
[cmake]                 cmd_obj.run()
[cmake]               File "setup.py", line 144, in run
[cmake]                 _install.run(self)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 68, in run
[cmake]                 return orig.install.run(self)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/install.py", line 622, in run
[cmake]                 self.run_command(cmd_name)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
[cmake]                 self.distribution.run_command(command)
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 985, in run_command
[cmake]                 cmd_obj.ensure_finalized()
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
[cmake]                 self.finalize_options()
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 17, in finalize_options
[cmake]                 self.set_undefined_options('install',('install_layout','install_layout'))
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 290, in set_undefined_options
[cmake]                 setattr(self, dst_option, getattr(src_cmd_obj, src_option))
[cmake]               File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 103, in __getattr__
[cmake]                 raise AttributeError(attr)
[cmake]             AttributeError: install_layout. Did you mean: 'install_platlib'?
[cmake]             [end of output]
[cmake]       
[cmake]         note: This error originates from a subprocess, and is likely not a problem with pip.
[cmake]         ERROR: Failed building wheel for cppyy-backend
[cmake]       Failed to build cppyy-backend
[cmake]       ERROR: Could not build wheels for cppyy-backend, which is required to install pyproject.toml-based projects
[cmake]       [end of output]
[cmake]   
[cmake]   note: This error originates from a subprocess, and is likely not a problem with pip.
[cmake] error: subprocess-exited-with-error
[cmake] 
[cmake] × pip subprocess to install backend dependencies did not run successfully.
[cmake] │ exit code: 1
[cmake] ╰─> See above for output.
wadejong commented 1 year ago

I just took the master branch, set the toolchain you have and did a clean install, including cppyy. It built without a problem.

keceli commented 1 year ago

What is your Python version? Cppyy build problems I have observed so far are either related to Python 3.11 (not supported by cppyy, yet) or conflicting versions of cppyy dependencies installed in the system. I'd uninstall cppyy and its dependencies and let cmake to build cppyy.

I created a PR to update cppyy to 2.4.1 and for a possible fix (not tested) for this issue.

ryanmrichard commented 1 year ago

I'm using Python 3.10.7. pip list doesn't show Cppyy as being installed and I don't have any user packages for Python 3.10.7. I admittedly do have user packages, including cppyy, for older versions of Python. I'll try deleting those.

ryanmrichard commented 1 year ago

update: tried deleting user packages from other Python versions still have the same problem.

keceli commented 1 year ago

If you are getting the same error message, AttributeError: install_layout. Did you mean: 'install_platlib'?, you can try pip install -U setuptools. See here. But before doing that, could you replace the FindCppyy.cmake file with this one and try again. This will help us learn weather the configuration halts as expected, or not.

ryanmrichard commented 1 year ago

The change does indeed crash CMake when Cppyy is not found. I tried updating setuptools, but still got the same error.

keceli commented 1 year ago

Good to know that it crashes. I'll move the PR to .github.

Looks like there could be many different triggers for the error you see related to setuptools. Maybe this is related if you are using Debian/Ubuntu. Suggested workaround is to set SETUPTOOLS_USE_DISTUTILS=stdlib.

ryanmrichard commented 1 year ago

I am using Ubuntu. I'll try using that workaround in a bit (I'm working on something else at the moment).

ryanmrichard commented 1 year ago

I changed line 55 of FindCppyy.cmake to:

    execute_process(COMMAND SETUPTOOLS_USE_DISTUTILS=stdlib ${Python3_EXECUTABLE} -m pip install ${_pypkg_name} ${_pip_args})

and got the same error.

keceli commented 1 year ago

Unfortunately, I cannot reproduce your problem, so it is hard to debug. I'd try reinstalling setuptools and starting with a clean virtual environment. I have used this tool in the past to remove packages including the dependencies. Before reinstalling it is also worth trying to clear pip cache. You can do it with pip cache remove * and pip cache purge or use --no-cache-dir option while installing.

ryanmrichard commented 1 year ago

@keceli I sincerely appreciate your time and effort. I tried adding the --no-cache-dir option, but still no dice. For the moment I'm developing with Python bindings disabled. Once I finish the PR I'm working on, I'll try installing Cppyy myself (I've been trying to let FindCppyy.cmake do it for me). I've had Cppyy working on my computer before; I'll see if I can find my notes.

ryanmrichard commented 1 year ago

I think this is the same issue (not sure why the error is different) as NWChemEx-Project/NWXCMake#4, so I'm going to close this one.