Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

UnicodeDecodeError accured! #265

Closed
LDoubleZhi opened this issue Dec 12, 2018 · 11 comments
Closed

UnicodeDecodeError accured! #265

LDoubleZhi opened this issue Dec 12, 2018 · 11 comments

Comments

@LDoubleZhi
Copy link

❓ 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)

@fmassa
Copy link
Contributor

fmassa commented Dec 12, 2018

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:

@LDoubleZhi
Copy link
Author

@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?

@LDoubleZhi
Copy link
Author

@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:

@LDoubleZhi
Copy link
Author

the error still exist

@LDoubleZhi
Copy link
Author

/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

@LDoubleZhi
Copy link
Author

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

@fmassa
Copy link
Contributor

fmassa commented Dec 13, 2018

@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

@LDoubleZhi
Copy link
Author

LDoubleZhi commented Dec 14, 2018

@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()

@fmassa
Copy link
Contributor

fmassa commented Dec 14, 2018

Thanks for the explanation. I've opened an issue in pytorch/pytorch#15214 so that it can be fixed.

@fmassa fmassa closed this as completed Dec 14, 2018
@Swjtu-only
Copy link

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.
 

@KyuminHwang
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants