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 pythonpath #1609
Fix pythonpath #1609
Conversation
docker/Dockerfile
Outdated
@@ -44,6 +44,8 @@ RUN apt install -y python3-pprintpp; exit 0 | |||
RUN apt clean -y all | |||
|
|||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 | |||
RUN mkdir -p `python -m site --user-site` | |||
ENV PYTHONPATH `python -m site --user-site` |
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.
When I build this image I'm seeing $PYTHONPATH
equal to "`python -m site --user-site`" and not the actual output of that command (confirmed by various articles). Might need to figure out something more clever to set this dynamically
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 options I'm seeing are:
- set it in the
CMD
(don't think this will work with multiple stages since theRUN
steps will run in different shells - store it in a file? (doesn't really solve anything if we need to run a script to set the env var)
- change the site-packages directory to something we know, so that we know where cyclus is installed and we can safely hardcode the PYTHONPATH (I'm trying to see if this is possible)
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.
Actually... do we need to explicitly set the PYTHONPATH
env var? When I omit that line and build images, the correct site-packages directory is in sys.path
and all tests pass (besides test_main.py of course). The best solution might be to delete lines 48 and 110 altogether
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.
Looks good, thanks @gonuke
Ensure user-site path is created at right stage.
Fix PYTHONPATH to be not hardcoded
Fixes #1610