-
Notifications
You must be signed in to change notification settings - Fork 276
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
JSONDecodeError when determining list of installed Python packages #2866
Comments
I can reproduce this outside an EasyBuild run using the following Python script: import os
print("COLUMNS: %s" % os.getenv('COLUMNS'))
print("LINES: %s" % os.getenv('LINES'))
from easybuild.tools.options import set_up_configuration
from easybuild.tools.modules import modules_tool
from easybuild.tools.run import run_cmd
set_up_configuration()
del os.environ['PYTHONPATH']
modtool = modules_tool()
modtool.load(['Python/3.10.4-GCCcore-11.3.0'])
print(os.getenv('PYTHONPATH'))
out, ec = run_cmd("/apps/gent/RHEL8/cascadelake-ib/software/Python/3.10.4-GCCcore-11.3.0/bin/python -m pip list --isolated --disable-pip-version-check --format json")
if out:
print("Output of 'pip list': %s..." % out[:20])
else:
print("empty output of 'pip list'!") To trigger the problem, I need to be in an interactive shell session, in which the terminal width/height is not set correctly, as shown by the
The
|
This problem was sort of self-inflicted, it's caused by running EasyBuild in a strange shell environment, one that was started as follows: $ echo $COLUMNS $LINES
272 58
$ python3
Python 3.6.8 (default, Jun 14 2022, 12:54:58)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pty
>>> pty.spawn(['/usr/bin/srun', '--export=USER,HOME,TERM', '--pty', '/bin/bash'])
srun: job 53639925 queued and waiting for resources
srun: job 53639925 has been allocated resources
$ echo $COLUMNS $LINES
80 24 A shell session started with So other than avoiding the nasty crash when |
It seems like
pip list ... --format json
sometimes returns nothing at all, which isn't being handled well.This happened during the installation of
spglib-python-2.0.0-foss-2022a.eb
, and it was a fluke because it didn't happen on 2nd iteration, and there definitely are Python packages installed (since there's a bunch included withPython
).The text was updated successfully, but these errors were encountered: