How does setuptools determine the appropriate site-packages directory? #2813
adamjstewart
started this conversation in
General
Replies: 1 comment 18 replies
-
FYI, you should be asking about this question of pip, not setuptools. Setuptools' installation capabilities are deprecated and discouraged nowadays in favor of pip. |
Beta Was this translation helpful? Give feedback.
18 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm a developer for the Spack package manager. Spack is similar to Conda in that we have both Python and non-Python packages, and similar to Nix in that we install all packages to a separate prefix allowing for multiple versions of the same software to be installed.
When dealing with Python installations, we've noticed that third-party Python libraries may be installed in one of several directories:
lib/pythonX.Y/site-packages
on most systemslib64/pythonX.Y/site-packages
on RHEL/CentOS/Fedoralib/pythonX/dist-packages
on Debian/UbuntuWe would like to know this directory ahead of time so that we can set
PYTHONPATH
appropriately and ensure that Python libraries are installed to the same prefix as the system Python expects. Right now, we're using distutils to determine this:We then use these values to explicitly tell setuptools where to install the package to:
$ python setup.py install --root=<prefix> --install-purelib=<not-plat-specific-not-standard-lib> --install-platlib=<plat-specific-not-standard-lib> --install-scripts=bin --install-data= --install-headers=<plat-specific>
This seems to work most of the time, but I've noticed that some packages like cython will install to the
--install-platlib
directory while others like setuptools will install to the--install-purelib
directory. Also, distutils is deprecated in Python 3.10 and will be removed in 3.12, so we would like to move away from this approach. Also also, we don't want to have to run Python if possible since we may be cross-compiling. We could simply recursively search for a particular prefix, but we need to know before installation where libraries will get installed.My questions are as follows:
python setup.py install
, how does setuptools determine the appropriate site-packages directory?--install-*
like above?Pinging other Spack devs who would love to know the answers to how best to package Python libraries: @tgamblin @alalazo @skosukhin @permeakra @wspear @robertu94 @dev-zero
Links to Spack issues and PRs for additional context: spack/spack#24095 spack/spack#21446 spack/spack#24076 spack/spack#24526 spack/spack#25998 spack/spack#26546
Beta Was this translation helpful? Give feedback.
All reactions