Maskrcnn-benchmark: UnicodeDecodeError accured!

Created on 12 Dec 2018  ·  11Comments  ·  Source: facebookresearch/maskrcnn-benchmark

❓ Questions and Help

When I train fasterrcnn, error accured blow:
/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 44, in run
err = err.decode("ascii")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 22: ordinal not in range(128)

dependency bug

Most helpful comment

When I modify to utf-8, the following problems occurred:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 25: invalid start byte。
so, i tryed to change to gbk ,it work well.
 

All 11 comments

This is a bug in PyTorch.

Please copy and paste the output from the
environment collection script from PyTorch
(or fill out the checklist below manually).

You can get the script and run it with:

wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
  • PyTorch Version (e.g., 1.0):
  • OS (e.g., Linux):
  • How you installed PyTorch (conda, pip, source):
  • Build command you used (if compiling from source):
  • Python version:
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • Any other relevant information:

@fmassa Thanks for your reply. I copy and paste but it still doesn't work. I used pytorch1.0 stable.maybe I should use the nightly one?

@fmassa
PyTorch Version (e.g., 1.0): pytorch1.0 nightly
OS (e.g., Linux): centos
How you installed PyTorch (conda, pip, source): conda
Build command you used (if compiling from source): yes
Python version: 3.6
CUDA/cuDNN version:9.0 7.4
GPU models and configuration:
Any other relevant information:

the error still exist

/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/bin/python /home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py
Collecting environment information...
Traceback (most recent call last):
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 350, in
main()
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 345, in main
output = get_pretty_env_info()
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 340, in get_pretty_env_info
return pretty_str(get_env_info())
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 238, in get_env_info
os=get_os(run_lambda),
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 176, in get_os
desc = get_lsb_version(run_lambda)
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 154, in get_lsb_version
return run_and_parse_first_match(run_lambda, 'lsb_release -a', r'Description:\t(.*)')
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 59, in run_and_parse_first_match
rc, out, _ = run_lambda(command)
File "/home/liulinzhi/anaconda3/envs/maskrcnn_benchmark/lib/python3.6/site-packages/torch/utils/collect_env.py", line 45, in run
err = err.decode("ascii")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 22: ordinal not in range(128)

Process finished with exit code 1

I solve it by using “utf-8”....

@LDoubleZhi can you be a bit more precise on what you changed?
Also, you didn't copy-paste the output of the script here, so that I could see the versions of the libraries etc. That could help identify the issue

@fmassa I modify the collect_env.py
def run(command): ........ if PY3: output = output.decode("utf-8") err = err.decode("utf-8") return rc, output.strip(), err.strip()

Thanks for the explanation. I've opened an issue in https://github.com/pytorch/pytorch/issues/15214 so that it can be fixed.

When I modify to utf-8, the following problems occurred:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 25: invalid start byte。
so, i tryed to change to gbk ,it work well.
 

@Swjtu-only I suffered from same problem. I caught to error using Swjtu-only's solution. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kaaier picture kaaier  ·  3Comments

YuShen1116 picture YuShen1116  ·  4Comments

KuribohG picture KuribohG  ·  3Comments

IenLong picture IenLong  ·  4Comments

hadim picture hadim  ·  4Comments