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

If using an external Python, the bin directory might not be in PATH #32662

Closed
3 tasks done
mdorier opened this issue Sep 15, 2022 · 9 comments · Fixed by #40773
Closed
3 tasks done

If using an external Python, the bin directory might not be in PATH #32662

mdorier opened this issue Sep 15, 2022 · 9 comments · Fixed by #40773
Assignees

Comments

@mdorier
Copy link
Contributor

mdorier commented Sep 15, 2022

Steps to reproduce

If you install a python package, the resulting files will be located in <prefix>/local instead of <prefix>. While this doesn't seem to be a problem for importing the module, it is a problem when the python package installs executables in bin. These executables end up in <prefix>/local/bin, which in not in PATH when loading the package or when in an environment that contains the package.

To reproduce, simply try installing a python package that has executables (e.g. py-flake8), then try to use said executable.

Error message

No response

Information on your system

  • Spack: 0.19.0.dev0 (123354e)
  • Python: 3.10.4
  • Platform: linux-ubuntu22.04-sandybridge
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output
@mdorier mdorier added bug Something isn't working triage The issue needs to be prioritized labels Sep 15, 2022
@adamjstewart adamjstewart self-assigned this Sep 15, 2022
@adamjstewart
Copy link
Member

This was also reported in #31939. It seems to be due to distro-specific patches to the system Python. Only current workaround is to use Spack-installed Python instead of system Python.

@adamjstewart
Copy link
Member

@trws @pradyunsg

@mdorier
Copy link
Contributor Author

mdorier commented Sep 15, 2022

Any chance spack could just add local/bin in addition to bin in PATH?

@adamjstewart
Copy link
Member

That would break a lot of external packages. For example, imagine you have Python 3.7 in /usr/bin/python and Python 3.9 in /usr/local/bin/python. If you use:

- spec: python
  prefix: /usr

which will it pick up?

@tmadlener
Copy link
Contributor

tmadlener commented Apr 10, 2023

After just running into this (with meson in my case); Is there any news on this or on #31939? Or is this currently waiting for the upstream situation to resolve somehow?

@adamjstewart
Copy link
Member

It looks like there was some recent discussion on this in https://discuss.python.org/t/linux-distro-patches-to-sysconfig-are-changing-pip-install-prefix-outside-virtual-environments/18240/27 by @pradyunsg and @FFY00, not sure if they have anything else to add.

@FFY00
Copy link

FFY00 commented Apr 10, 2023

No, not yet unfortunately, but shouldn't users be using a Spack-provided Python?

@adamjstewart
Copy link
Member

Spack supports using external installations of all packages. A lot of users who don't care about Python and just need it as a dependency for their HPC code will use an external copy of Python instead of letting Spack built it from source to save time. We have a spack external find command that automatically searches the OS and picks up as many system-installed packages as it can.

@alalazo alalazo added this to the v0.20.0 milestone Apr 12, 2023
@alalazo alalazo changed the title bin directory of python packages no longer in PATH If using an external Python, the bin directory might not be in PATH Apr 12, 2023
@alalazo alalazo modified the milestones: v0.20.0, v0.21.0 May 2, 2023
@adamjstewart
Copy link
Member

adamjstewart commented May 12, 2023

For anyone who encounters this issue, see pypa/pip#10978 for the upstream tracking issue. For now, the best workaround is to use a Spack-installed Python instead of using the system Python.

This issue has been reported several times already:

I've closed these issues so we can track this issue in only a single place.

@alalazo alalazo removed this from the v0.21.0 milestone Jun 7, 2023
@alalazo alalazo added impact-low and removed triage The issue needs to be prioritized labels Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants