FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Patch .bashrc to set up pip to enable pip install by d1jang · Pull Request #243 · Kaggle/docker-python · GitHub

Patch .bashrc to set up pip to enable pip install - #243

Merged
d1jang merged 2 commits into
masterfrom
pip_install_support
Jul 26, 2018
Merged

d1jang merged 2 commits into
masterfrom
pip_install_support

Conversation

d1jang commented Jul 25, 2018

Copy link
Copy Markdown

Create a directory for pip to install modules via users' "pip install" command.

Set up PIP_CONFIG_FILE & PYTHONPATH to use those modeuls in a Kernel session.

Currently this change is no-op until we populate KAGGLE_WORKING_DIR from the worker.

Create a directory for pip to install modules via users' "pip install" command.

Set up PIP_CONFIG_FILE & PYTHONPATH to use those modeuls in a Kernel session.

Currently this change is no-op until we populate KAGGLE_WORKING_DIR from the worker.
d1jang requested review from cchamberlain, emzeq and rosbo July 25, 2018 19:22

cchamberlain left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM - Left comments but not a python guru (#goals) so I trust your implementation.

Comment thread Dockerfile Outdated
# Set up pip to enable pip install.
ADD patches/kaggle_bashrc /root/.bashrc
# Patch the system-wide bashrc file for non-root users.
RUN cat /root/.bashrc >> /etc/bash.bashrc

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do root shells not load /etc/bash.bashrc? If they do load it, why not just patch the system-wide bashrc?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Done.

Comment thread patches/kaggle_bashrc
# a user to use his/her installed one.
# TODO(dsjang): Currently "lib/python3.6/site-packages" is hard-coded
# throughout Dockerfile. Parameterize it to avoid a version mismatch.
export PYTHONPATH=${PIP_INSTALL_PREFIX_DIR}/lib/python3.6/site-packages:${PYTHONPATH}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

+1 on the parameterization in future. Could probably read in python version and interpolate I'm assuming though unsure if we'll support multiple versions or chicken / egg scenario with python command being dependent on PYTHONPATH hah.

cchamberlain Jul 25, 2018 •
edited
Loading

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Another thing to possibly investigate in the future (if you haven't already) is leaving the top level implementation alone for reserved read-only control and instead setting PYTHONUSERBASE, then documenting to users that they should use:

!pip install --user ...

Unsure on any gotchas that might be relevant there, just feels nice since they're effectively installing custom user specific packages on top of our base. Also using virtualenv to put users into their own sandbox within the working directory is another option that might be worth investigating at some point.

https://stackoverflow.com/a/29103053/769871

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Acked. Thanks for the very useful feedback.

Your suggested method was actually what I wanted to use, but unfortunately we're using PYTHONUSERBASE for monkeypatching something while python is first loaded. I stashed your comment in case we want to clean things up better in the future.

Thanks!

Comment thread patches/kaggle_bashrc
# a user to use his/her installed one.
# TODO(dsjang): Currently "lib/python3.6/site-packages" is hard-coded
# throughout Dockerfile. Parameterize it to avoid a version mismatch.
export PYTHONPATH=${PIP_INSTALL_PREFIX_DIR}/lib/python3.6/site-packages:${PYTHONPATH}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Did you confirm that this doesn't have an adverse effect on the existing installed libs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Except for excessive disk use by installing extra packages, it's hard to predict any problems here.

Without changing how our docker containers' filesystem is structured, this seems to be the only way to make pip install work AFAIK.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Was more worried about it interfering in some way without doing a pip install. We should be covered there with run_green.

emzeq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

d1jang merged commit fe0f773 into master Jul 26, 2018
rosbo deleted the pip_install_support branch March 20, 2019 19:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL