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

Wrapper scripts break when other versions of python are loaded first #15

Closed
Comeani opened this issue May 24, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Comeani
Copy link
Contributor

Comeani commented May 24, 2022

Similar to a problem resolved in #11, admin scripts that do not rely on py_wrap.sh break when a python lmod module is loaded first.

This is an example with crc-usage.pl (calls crc_bank.py), but I'd imagine the same issue would occur if we refactor the other wrappers in the same fashion as crc-interactive.py

[nlc60@login0b ~]$ module purge
[nlc60@login0b ~]$ crc-usage.pl sam
|----------------------------------------------------------------------------------|
|      Proposal End Date       |                     04/11/23                      |
|----------------------------------------------------------------------------------|
|                       Cluster: smp, Available SUs: 1000000                       |
|--------------------|------------------------------|------------------------------|
|        User        |           SUs Used           |     Percentage of Total      |
|--------------------|------------------------------|------------------------------|
....

[nlc60@login0b ~]$ module load gcc/8.2.0 python/anaconda3.8-2020.11
[nlc60@login0b ~]$ crc-usage.pl sam
Fatal Python error: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

@djperrefort
Copy link
Member

Issues with lmod messing up the intended Python interpreter have been popping up on and off again. I would like to find a solution that avoids the problem completely.

One option is packaging the command line apps as a Python package (i.e., adding a setup.py file) and installing them with pipx. This would allow the applications to run in their own dedicated runtime environment. It would also give the developer complete control over that environment - both in terms of the python version and the requirements. The latter point alone is a huge plus for me.

There is some support for multi-tenancy environments in pipx (see this issue). However, I've never tried it myself.

All of this is just me brainstorming. Ultimately we should also see what @iamtroy412 and @buttermutter think.

@djperrefort
Copy link
Member

djperrefort commented Jul 8, 2022

PR #65 should resolve this issue but I want to wait on closing this issue until the changes are deployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants