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

MacOS pythonscriptspath error #513

Closed
sundermann opened this issue May 24, 2022 · 10 comments
Closed

MacOS pythonscriptspath error #513

sundermann opened this issue May 24, 2022 · 10 comments

Comments

@sundermann
Copy link

On MacOS the pythonscriptspath extension fails with the following error:

[61.423s] ERROR:colcon.colcon_core.environment:Exception in environment extension 'pythonscriptspath': '/usr/local/bin' is not in the subpath of '/Users/ssundermann/Sourcecode/ros2_humble/install' OR one path is relative and the other is absolute.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/colcon_core/environment/__init__.py", line 175, in create_environment_hooks
    hooks = extension.create_environment_hooks(prefix_path, pkg_name)
  File "/usr/local/lib/python3.10/site-packages/colcon_core/environment/path.py", line 57, in create_environment_hooks
    rel_bin_path = bin_path.relative_to(prefix_path)
  File "/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 816, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/usr/local/bin' is not in the subpath of '/Users/ssundermann/Sourcecode/ros2_humble/install' OR one path is relative and the other is absolute.

I installed python3.10 through brew and symlinked it into /usr/local

The issue seems to be related to #504

@sundermann
Copy link
Author

colcon-core==0.8.1 fails with a similar error, however version 0.7.1 works fine:

[10.030s] ERROR:colcon.colcon_core.environment:Exception in environment extension 'pythonpath': '/usr/local/lib/python3.10/site-packages' is not in the subpath of '/Users/ssundermann/Sourcecode/ros2_humble/install' OR one path is relative and the other is absolute.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/colcon_core/environment/__init__.py", line 175, in create_environment_hooks
    hooks = extension.create_environment_hooks(prefix_path, pkg_name)
  File "/usr/local/lib/python3.10/site-packages/colcon_core/environment/pythonpath.py", line 28, in create_environment_hooks
    rel_python_path = python_path.relative_to(prefix_path)
  File "/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 816, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/usr/local/lib/python3.10/site-packages' is not in the subpath of '/Users/ssundermann/Sourcecode/ros2_humble/install' OR one path is relative and the other is absolute.

@sundermann
Copy link
Author

It seems that the python parts of the packages are installed to /usr/local/lib/python3.10/site-packages instead of the ros2_humble/install/... directory.

@sundermann
Copy link
Author

I was able to resolve these issues by reverting the switch to sysconfig and falling back to the deprecated distutils.

@cottsay
Copy link
Member

cottsay commented May 24, 2022

Hi @sundermann, can you please give #512 a try instead of reverting to the deprecated behavior?

@sundermann
Copy link
Author

Hi @cottsay. I installed your branch using python3 -m pip install -U git+https://github.com/colcon/colcon-core.git@cottsay/sitecustomize --force-reinstall. Unfortunately, the install directory is still broken and colcon errors out with the same problems as before.

@cottsay
Copy link
Member

cottsay commented May 24, 2022

Well, it looks like Homebrew is engaging in the same shenanigans as Debian and Fedora, and we'll need to specifically work around it.

Here's the spot: https://github.com/Homebrew/homebrew-core/blob/2f008323193f636d32c4a970caa9e8b528c6c430/Formula/python%403.10.rb#L62-L68

@sundermann
Copy link
Author

Is there a hack or workaround available?

@cottsay
Copy link
Member

cottsay commented May 24, 2022

You'll need both #512 and #514 to get around the platform patch.

@sundermann
Copy link
Author

Having #512 and #514 applied fixes the issue on MacOS. Thanks!

@cottsay
Copy link
Member

cottsay commented May 24, 2022

Great news, thanks for reporting back.

@cottsay cottsay closed this as completed Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants