-
Notifications
You must be signed in to change notification settings - Fork 820
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
bug: BentoML unexpected behavior when interacting with Editable Pip Modules #4217
Comments
This indeed seems to be the way that Bentoml searches for the specified A dirty workaround is to ensure that all of your systemwide modules have unique |
The issue comes from When you
Thus, lines 84-86 does not trigger
And when it comes time to import at line 137, the first instance of
Regardless of what's passed in by This issue is solvable by always prepending the current working dir at the start of the path and always removing the first instance of it at the end. This is a bit of a brute force solution and there's probably a better way of doing it with less ramifications (that I'm unaware of), but this solves my use case. |
Hi @tokotchd - "This issue is solvable by always prepending the current working dir at the start of the path and always removing the first instance of it at the end. " - do you need to modify BentoML code in I think always prepending the |
…wanted behavior when other bentofiles are on the system PATH This is especially evident when trying to use bentoml cli on python folders that are also pip modules see bentoml#4217
@parano I threw up a quick PR. |
Describe the bug
If you happen to be using bentoml as a build server involving modular code that you're installing via
pip install -e <path_to_folder>
, you're going to encounter very strange/bad behavior:bentoml build
andbentoml build --containerize
etc.
To reproduce
Simplest possible reproduction of the bug:
Start with the following folder structure (describable as a bento project overtop of an installable python module):
Then, install both python modules:
pip install -e module_1
pip install -e module_2
Finally, attempt to
bentoml build
inmodule_2
If we look at the --verbose flag, we're seeing that while the build process starts with the correct bentofile, it manages to lose it during the builds/imports process and ends up using another's instead due to the symlinks created by
pip install -e
bentoml_bug.zip
Expected behavior
The ideal behavior would be that coincidentally having a
bentofile.yaml
anywhere on the system that happens to be in a python module installed withpip install -e
will not break thebentoml build
CLI.I'm guessing the behavior I'm seeing is more due to path/symlink changes caused by pip than bentoML itself.
If the fix is outside of the scope of bentoML than I'm happy to at least have documented the issue here with the ask of adding something to BentoML documentation that the
bentoML
cli does not play well with editable python modules.Environment
bentoml==1.1.6
Python 3.9.15
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: