-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix missing package error when first using docker-compose setup #1158
Conversation
@jwodder please have a look if aligns with your understanding of the moving pieces here |
@AlmightyYakob Instead of using |
Interesting, I wasn't aware of this. I can try that out, and if that solves our issues more elegantly, I'll close this PR in favor of that one. |
What's your source for this behavior? In any test that I run, I need to install
|
@AlmightyYakob Yes, dandiapi needs to be installed no matter what, but the code shouldn't need to be there at install time. I interpreted this line from the OP:
as referring to this folder and the |
It seems I was a bit confused initially on this. You're correct in that when we run I've tested just installing the package locally without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only potential problem I see here is anyone using docker to run things would lose the ability to easily make code changes to installed libraries (mainly thinking of our use of dandischema
here), since we're doing non-editable mode pip install. I suppose we could just say, if you want the ability to do that you must run the python code natively, outside of docker. Either way, it's not something I've had to do often enough to be concerned about.
This was already the case though, wasn't it? Any third party libraries aren't present on the local machine itself, they're installed in the docker container's site packages. How does this change modify that setup? |
Looking back, I'm not sure what I was getting at here - I was referring to the case where you might do an editable install of your local |
🚀 PR was released in |
Due to the following linedandi-archive/dandiapi/__init__.py
Line 8 in 5d72170
The existing dev docker setup doesn't work as it's described in theREADME.md
, as thedandiapi
folder isn't copied into the container at the time of pip install, causing thedandiapi
package to not be found. This wasn't an issue before, since we didn't rely on pip actually having knowledge of ourdandiapi
package to run django. However, due to our current versioning setup, any time our app is run, it runs the above line, to determine the current version. At that point, it finds that thedandiapi
package isn't installed, causing an error.We can't just copy thedandiapi
directory into the container before pip install is run, since when we overwrite the current directory with ourdocker-compose
setup, that folder will be gone, leaving us with the same problem. There's then two solutions:1. Copy thedandiapi
folder into the container at build time, before pip install. Then instead of mounting the entire directory withdocker-compose
, mount only the files/folders we need, so that the.egg-info
folder isn't overwritten.2. Add a step in the README to run pip install, which will then place a.egg-info
folder in the cloned repo outside of the container. After that, it will always get mounted into the container when docker-compose is run, and behave normally.This PR takes the latter approach, since imo maintaining an exhaustive list of all files needed in the container could lead to all kinds of issues, which would likely not be caught since the dev setup isn't tested.My initial report was a red herring, this PR has been updated to address the real cause, outlined in #1158 (comment).