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

#273: Added jupyterenv/bin to environment variable PATH inside the Entrypoint #314

Merged
merged 16 commits into from
Aug 13, 2024

Conversation

ckunki
Copy link
Contributor

@ckunki ckunki commented Aug 8, 2024

Closes #273

  • At least the Docker Edition of the AI-Lab, already contains a system-wide installation of pip in /usr/bin/pip
  • Hence, directory /home/jupyter/jupyterenv/bin needs to be prepended to environment variable PATH in order to override the system-wide binary
  • python -m pip would also be fine since python and pip both are aware of the directory of the initially called binary

Actually, inside a Jupyter notebook the Jupyter virtual env should be activated anyway, but we have observations not confirming this assumption.

rather than relying on shell variable expansion
@ckunki ckunki had a problem deploying to approve-test-execution August 8, 2024 13:24 — with GitHub Actions Failure
@ckunki ckunki changed the title #273: Added jupyterenv/bin to evironment variable PATH inside the DockerContainer #273: Added jupyterenv/bin to environment variable PATH inside the DockerContainer Aug 8, 2024
tomuben
tomuben previously approved these changes Aug 9, 2024
Copy link
Contributor

@tomuben tomuben left a comment

Choose a reason for hiding this comment

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

Approved. But honestly a not so nice solution. wouldn't it be better to investigate why the Jupyrer venv is (sometimes?) not active in Notebooks?

@@ -175,7 +183,8 @@ def _commit_container(
"Env": [
f"VIRTUAL_ENV={virtualenv}",
f"NOTEBOOK_FOLDER_FINAL={notebook_folder_final}",
f"NOTEBOOK_FOLDER_INITIAL={notebook_folder_initial}"
f"NOTEBOOK_FOLDER_INITIAL={notebook_folder_initial}",
f"PATH={path}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can not go here, because the we can not activate the the environment for the whole system. It would be also for the wrong user. This needs to go into the entry point because there we are calling the correct python version and only there this addition to PATH is valid.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We actually need to do the same for the AMI and VMs, this means we should use the entry point in the systemd unit. We already have a ticket for that. Please, work on that afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, see next push.

@@ -75,6 +79,11 @@ def arg_parser():
return parser


def command_with_venv(venv_activate: Path, command: List[str]) -> List[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah - left over from an experiment.
Thanks!
Removed in next push.

@@ -18,6 +18,7 @@ Version: 2.1.0
* #279: Made the notebooks tests running in SaaS as well as in the Docker-DB.
* #19: Added SLC notebook
* #301: Added CloudFront distribution for example data S3 bucket
* #273: Added `jupyterenv/bin` to environment variable `PATH` inside the DockerContainer
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* #273: Added `jupyterenv/bin` to environment variable `PATH` inside the DockerContainer
* #273: Added `jupyterenv/bin` to environment variable `PATH` inside the Entrypoint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks!
See next push.

@tkilias tkilias changed the title #273: Added jupyterenv/bin to environment variable PATH inside the DockerContainer #273: Added jupyterenv/bin to environment variable PATH inside the Entrypoint Aug 12, 2024
@ckunki ckunki temporarily deployed to approve-test-execution August 13, 2024 09:52 — with GitHub Actions Inactive
@ckunki ckunki merged commit c70cb4a into main Aug 13, 2024
9 of 10 checks passed
@ckunki ckunki deleted the feature/#273-Add_jupyterenv_bin_to_PATH branch August 13, 2024 11:19
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.

Add jupyterenv to PATH
3 participants