-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Enable Installation of Python Package with System lib in a Virtual Environment #9349
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the work on improved support with venv. However, I got a bit confused by the paths now. Maybe we need a new option that's more general as discussed in #6706, specifically #6706 (comment). Without a new option, it's difficult to handle the diversity of packaging methods. In the case of venv, the shared object can be in /usr/lib
or myvenv/lib
, or myvenv/lib/python3.x/site-packages/xgboost/lib
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are times when we need to use sys.prefix. Example: libxgboost is installed inside a Conda enviornment. This PR will break the conda-forge recipe for XGBoost.
I think mamba always copies the python executable, so the base_prefix and the prefix are the same:
I expect conda to have the same behavior. |
It would be nice to make paths user configurable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that this PR doesn't break Conda. For now this change is fine. In a future PR, we can add user configuration for paths.
I canceled the job for the stalling test. It's caused by an issue in column-split test, which has been fixed in master branch. Will rebase the PR. |
1939230
to
7c36134
Compare
@hcho3 @oliverholworthy After reading the mamba document: https://mamba.readthedocs.io/en/latest/advanced_usage/more_concepts.html#linking I think this PR might be problematic if there are users who prefer soft-links for working across file system partitions. |
Thanks, I opened #9376 as a reminder. |
Goal
Enable Installation of Python Package with System lib in a Virtual Environment
Details
sys.prefix
withsys.base_prefix
sys.base_prefix
instead ofsys.prefix
enables installation of package in a virtual environment when the xgboost is already installed on the systemMotivation
Setting up tests to run inside a virtual environment in an image that has xgboost pre-installed as a system lib. (e.g.
nvcr.io/nvidia/tensorflow:23.06-tf2-py3
). When in a virtual environment, thesys.prefix
changes to point to thelib
directory inside the virtualenvironment instead of the system lib path.use_system_libxgboost=True
in a virtual environmenttox
virtual environment withsitepackages=true
to pickup an xgboost installation present on the system already