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

tljh.installer: support --user-requirements-txt-path flag alongside the --user-requirements-txt-url flag #461

Open
erinfry6 opened this issue Nov 7, 2019 · 3 comments
Labels
enhancement New feature or request priority Issue selected to have a bit higher priority

Comments

@erinfry6
Copy link

erinfry6 commented Nov 7, 2019

It would be really great if you could pip install packages from a .txt file on the VM, not necessarily from a URL .txt file.

I'm deploying on Google Cloud, so I have access to my requirements.txt in GCS easily using gcsfuse, but the URL of the file is much less reliable.

Thanks for everything!

@Milchdealer
Copy link

Milchdealer commented Dec 5, 2019

Hey erinfry6,

I know this is not really a fix, but I struggled with the same problem and took a look into the bootstrap.py.

pip_flags = ['--upgrade']
if os.environ.get('TLJH_BOOTSTRAP_DEV', 'no') == 'yes':
    pip_flags.append('--editable')
tljh_repo_path = os.environ.get(
    'TLJH_BOOTSTRAP_PIP_SPEC',
    'git+https://github.com/jupyterhub/the-littlest-jupyterhub.git'
)

run_subprocess([
    os.path.join(hub_prefix, 'bin', 'pip'),
    'install'
] + pip_flags + [tljh_repo_path])

If you look at it, you could change the ENVIRONMENT variable TLJH_BOOTSTRAP_PIP_SPEC to your dependencies (don't forgot to include the original dependencies) and it should install your requirements as well.

Did not test it yet, but I'm going to try to modify this or the bootstrap.py to get it to work. Will update if I have a proper way

*edit: I found out that the TLJH_BOOTSTRAP_PIP_SPEC can also be set to a folder

@GeorgianaElena GeorgianaElena added the enhancement New feature or request label Jan 10, 2020
@jtpio
Copy link
Contributor

jtpio commented Mar 6, 2020

@erinfry6 are you referring to the user requirements specified via --user-requirements-txt-url?

If so then it should already be supported, since the option is passed to pip directly:

utils.run_subprocess(pip_executable + [
'install',
'-r',
requirements_path
])

@consideRatio
Copy link
Member

Note that TLJH_BOOTSTRAP_PIP_SPEC is about locating the place to install the tljh package for use in the host systems root python environment that is installed via a setup.py within this repo, not additional packages for the user environment etc.

There is the --user-requirements-txt-url flag as documented here: https://tljh.jupyter.org/en/latest/topic/customizing-installer.html#installing-python-packages-in-the-user-environment

There is not a --user-requirements-txt-path or similar though to point to a local requirements.txt file. But, perhaps there should be?

For reference, these are the supported flags by the bootstrap.py script / tljh.installer, where the bootstrap.py script will just pass them onwards to the tljh.installer.

argparser.add_argument(
'--admin',
nargs='*',
action='append',
help='List of usernames set to be admin'
)
argparser.add_argument(
'--user-requirements-txt-url',
help='URL to a requirements.txt file that should be installed in the user enviornment'
)
argparser.add_argument(
'--plugin',
nargs='*',
help='Plugin pip-specs to install'
)

@consideRatio consideRatio changed the title Allow requirements.txt to be locally hosted, not URL tljh.installer: support --user-requirements-txt-path flag alongside the --user-requirements-txt-url flag Oct 25, 2021
@consideRatio consideRatio added the priority Issue selected to have a bit higher priority label Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority Issue selected to have a bit higher priority
Projects
None yet
Development

No branches or pull requests

5 participants