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

Isolate .local (i.e. pip) installations for each environment #2133

Closed
kcpevey opened this issue Nov 28, 2023 · 6 comments · Fixed by #2191
Closed

Isolate .local (i.e. pip) installations for each environment #2133

kcpevey opened this issue Nov 28, 2023 · 6 comments · Fixed by #2191
Assignees
Labels
area: integration/conda-store area: JupyterLab area: user experience 👩🏻‍💻 needs: discussion 💬 Needs discussion with the rest of the team needs: investigation 🔍 Someone in the team needs to find the root cause and replicate this bug type: enhancement 💅🏼 New feature or request
Milestone

Comments

@kcpevey
Copy link
Contributor

kcpevey commented Nov 28, 2023

Feature description

Currently, if I pip install a package into a conda env from the command line, the packages get added to my private .local space. However, if I have a second environment which does the same thing, THOSE get added to the .local space as well. This creates a situation where the pip packages from BOTH environments are now available in BOTH environments.

The real kicker is that if the second environment required different versions of the pip packages, it goes ahead and updates the .local, leaving the first environment in a broken state.

This happens very much behind the scenes and users have no idea what happened to their first environment since they "didn't touch it".

We should isolate the pip installed packages so that there is no cross-contamination between environments.

Value and/or benefit

Clean, isolated environments that pip can't break and happy users :)

Anything else?

No response

@costrouc
Copy link
Member

costrouc commented Nov 28, 2023

A hack that could be added into a notebook to load a given venv on top of conda-store

python .... create venv
import sys
sys.path.append(venv python path)
import os
os.environ['PATH'] = venv bin path + os.environ['PATH']

Also other things that we mentioned is completely disabling pip usage within the jupyterlab notebook. With the pip environment variable.

We should not allow installing things inside of pip .local. The only use case I can imagine of needing to pip install ... is for development of a package. Otherwise conda-store should be used.

Alternative to prevent adding a new virtual environment. This will work pretty well for most use cases.

import sys
sys.path.append('path to library')
python -m ...

@pavithraes
Copy link
Member

pavithraes commented Nov 28, 2023

Short-term -- disallow pip installation in JupyterLab/terminal, point folks to using pip through conda-store + docs
long-term - implement/document the hack Chris mentioned above for development use-cases

Edit: See the next comment

@pavithraes pavithraes added needs: discussion 💬 Needs discussion with the rest of the team needs: investigation 🔍 Someone in the team needs to find the root cause and replicate this bug labels Nov 28, 2023
@pavithraes pavithraes added this to the 2023.12.1 milestone Nov 28, 2023
@dharhas
Copy link
Member

dharhas commented Nov 28, 2023

correction.

short-term -

disallow pip installation in JupyterLab/terminal, point folks to using pip through conda-store + docs
test and document the hack Chris mentioned above for development use-cases

long-term -

Think through how to make pip package installation easier in conda-store ui, currently this an advanced feature requiring using the yaml editor and knowing how env.yaml are structured.

@viniciusdc
Copy link
Contributor

viniciusdc commented Jan 9, 2024

I discussed this last week with @costrouc; I will push a PR this afternoon. There is two env variables that will be included in the jupyterlab (user) pod, that will block usage of pip in an environment -- based on the docs so far this seems to work just fine, but I need to test it first

@dharhas
Copy link
Member

dharhas commented Jan 13, 2024

I discussed this last week with @costrouc; I will push a PR this afternoon. There is two env variables that will be included in the jupyterlab (user) pod, that will block usage of pip in an environment

I only see one env var in the PR?

@pavithraes pavithraes moved this from TODO 📬 to In progress 🏗 in 🪴 Nebari Project Management Jan 16, 2024
@pavithraes pavithraes moved this from In progress 🏗 to In review/QA 👀 in 🪴 Nebari Project Management Jan 16, 2024
@github-project-automation github-project-automation bot moved this from In review/QA 👀 to Done 💪🏾 in 🪴 Nebari Project Management Jan 16, 2024
@kcpevey
Copy link
Contributor Author

kcpevey commented Mar 12, 2024

Documentation for developing packages on nebari now that the pip option is disabled: nebari-dev/nebari-docs#411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: integration/conda-store area: JupyterLab area: user experience 👩🏻‍💻 needs: discussion 💬 Needs discussion with the rest of the team needs: investigation 🔍 Someone in the team needs to find the root cause and replicate this bug type: enhancement 💅🏼 New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

5 participants