Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packages don't build due to Setuptools and Distutils collision #196

Closed
hollmmax opened this issue Jul 28, 2022 · 3 comments
Closed

Packages don't build due to Setuptools and Distutils collision #196

hollmmax opened this issue Jul 28, 2022 · 3 comments

Comments

@hollmmax
Copy link

Some packages in noetic don't build with the following error:

error: invalid command '<pkg>'
CMake Error at /nix/store/<catkin_store>/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  
  execute_process(/tmp/<pkg_derivation>/build/catkin_generated/env_cached.sh
  "/nix/store/<python3_store>/bin/python3"
  "/nix/store/<catkin_store>/share/catkin/cmake/interrogate_setup_dot_py.py"
  "<pkg>"
  "/tmp/<pkg_derivation>/setup.py"
  "/tmp/<pkg_derivation>/build/catkin_generated/setup_py_interrogation.cmake")
  returned error code 1
Call Stack (most recent call first):
  /nix/store/<catkin_store>/share/catkin/cmake/catkin_python_setup.cmake:46 (safe_execute_process)
  CMakeLists.txt:23 (catkin_python_setup)

(Nix paths redacted for readability's sake)

The error also includes a warning from python suggesting a fix:

UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.

Replacing distutils.core with setuptools in setup.py as recommended fixes the problem.

Packages encountered so far:

  • angles
  • roslint
  • laser-geometry
  • resource-retriever

cc @wentasah

@lopsided98
Copy link
Owner

I think I already fixed this in staging. I submitted a patch upstream to import setuptools before distutils (ros/catkin#1176), but I haven't followed up on it because it turns out that the real problem is related to how setuptools is packaged in nixpkgs. setuptools' monkey patching still works correctly on other distros even if you import distutils before setuptools.

@hollmmax
Copy link
Author

hollmmax commented Aug 3, 2022

I can't tell what change fixed it, but it does work in staging.
Thank you for the fix, closing.

@hollmmax hollmmax closed this as completed Aug 3, 2022
@wentasah
Copy link
Contributor

wentasah commented Aug 3, 2022

I think it's this commit :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants