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

Fix pythonpath #1609

Merged
merged 3 commits into from Oct 21, 2023
Merged

Fix pythonpath #1609

merged 3 commits into from Oct 21, 2023

Conversation

gonuke
Copy link
Member

@gonuke gonuke commented Oct 21, 2023

Ensure user-site path is created at right stage.

Fix PYTHONPATH to be not hardcoded

Fixes #1610

@gonuke gonuke added the Infrastructure: CI Related to automated testing as part of continuous integration label Oct 21, 2023
@gonuke gonuke self-assigned this Oct 21, 2023
@@ -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`
Copy link
Contributor

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

Copy link
Contributor

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:

  1. set it in the CMD (don't think this will work with multiple stages since the RUN steps will run in different shells
  2. store it in a file? (doesn't really solve anything if we need to run a script to set the env var)
  3. 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)

Copy link
Contributor

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

Copy link
Contributor

@bennibbelink bennibbelink left a 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

@bennibbelink bennibbelink merged commit bc3785e into main Oct 21, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure: CI Related to automated testing as part of continuous integration
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Make sure python path is created and set in correct place
2 participants