Open yonil7 opened 1 year ago
Thanks for the report. Could you please share more details abot how to reproduce this? I'm wondering what could lead to non-unicode output.
The error seems to be because pip installation of gpustat-1.1.1
fails. (Getting requirements to build wheel: finished with status 'error'
)
gpustat-1.1.1
is not listed in my env.yaml
(conda-lock input file), but If I add gpustat-1.1.1
as explicit dependency to this file (from conda-forge) there is no error.
Anyway, I think its safer not to assume p.stderr
stream is unicode encoded and try to unicode decode it without expecting exception.
Could you please share your environment.yml
? I still don't know how to reproduce this.
Unfortunately I cant. But as I said, its anyway safer for the code to not assume p.stderr
stream is always unicode.
Ok, then I'll go out on a limb and invent a fictional scenario in which pip
is running some setup.py
script which is outputting non-utf8 characters. I'm inclined to say that in 2023, this is a bug with your setup.py
script, and not the responsibility of conda-lock. That said, in my imaginary scenario you're personally completely fed up with this garbage legacy setup.py
script which probably does all sorts of other horrible things. However, you and your organization are stuck with it for the foreseeable future.
So what would you like to have happen here? Perhaps the easiest solution would be to set errors="replace"
in subprocess.Popen
?
I agree this is probably a bug in gpustat
setup.py
(not sure) and I agree that any package setup.py
should not output non-utf8 characters to their stderr
/stdout
streams.
Replacing these unexpected non-utf8 characters as you suggested (using errors="replace"
) seems like a great solution for making conda-lock
more bulletproof.
Great! Would you be able to submit a PR for this?
Rather than silently continue when a replacement occurs, it would be nice to detect it (perhaps by simply detecting the replacement character?) and complaining with a warning.
This line raise exception when
p.stderr
is not utf-8 or has non utf-8 codes in it.Using conda-lock 2.2.0
Full error message: