SAME-Project / same-project

https://sameproject.ml/
Apache License 2.0
20 stars 8 forks source link

Instead of parsing imports from a notebook, nudge user towards requirements.txt #93

Closed lukemarsden closed 2 years ago

lukemarsden commented 2 years ago

Encourage the user to write down the specific versions of dependencies they have for their notebook in a requirements.txt.

  1. Support specifying e.g. ./requirements.txt or ./pyproject.toml in the same.yaml
  2. Parse those requirements and auto-install them in the KFP container (we already have code to do this)
  3. Consider checking (somehow) whether all the imports in a notebook are captured by the requirements.txt. If they're not, suggest lines that the user could add to their requirements.txt to install versions compatible with the versions currently installed in their local environment (if any)
lukemarsden commented 2 years ago

3 is an easier problem than going from import foo --> pip install foobar. In particular, we could (in theory) pull out all the import X as Y lines in a notebook, create a new virtualenv, install the requirements.txt in it, then try to run all the import lines. If they succeed, tell the user it's all good. If they fail, tell the user they need to add some lines to the requirements.txt.

Bubblyworld commented 2 years ago

Maybe that could be a separate command, something like same program verify? I imagine pulling down all dependencies into a new virtualenv could be expensive, specially if they're using stuff like numpy, tensorflow etc.

Bubblyworld commented 2 years ago

Decided to go the route of injecting the requirements.txt file into the kubeflow containers, since that way we can support the full requirements.txt spec without worrying about parsing it ourselves. Example of a same run with a configured requirements.txt file:

Screenshot 2022-04-28 at 12 01 45
Bubblyworld commented 2 years ago

Closing this as the same verify and requirements: [...] features cover this.