[python 3.8] UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 45: ordinal not in range(128)
See original GitHub issueHello,
I’ve just made an updated conda environment for python 3.8 and I can’t read loom files using anndata.read_loom()
anymore. It gives me this error (see full traceback below):
Traceback (most recent call last):
File "<ipython-input-2-b0b79aae2f29>", line 1, in <module>
adata = anndata.read_loom('/home/clarice/Documents/SingleCell_PseudoTime/data/CHLA9.loom')
File "/home/clarice/.local/lib/python3.8/site-packages/anndata/_io/read.py", line 225, in read_loom
var = dict(lc.row_attrs)
File "/home/clarice/anaconda3/lib/python3.8/site-packages/loompy/attribute_manager.py", line 102, in __getitem__
return self.__getattr__(thing)
File "/home/clarice/anaconda3/lib/python3.8/site-packages/loompy/attribute_manager.py", line 119, in __getattr__
vals = loompy.materialize_attr_values(self.ds._file[a][name][:])
File "/home/clarice/anaconda3/lib/python3.8/site-packages/loompy/normalize.py", line 98, in materialize_attr_values
result = np.array([html.unescape(x) for x in temp.astype(str)], dtype=object)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 45: ordinal not in range(128)
Of note: I can read the same file in my python3.7 environment, but it prints a message:
Variable names are not unique. To make them unique, call '.var_names_make_unique'.
It’s always been like this. After running .var_names_make_unique
, it all works out perfectly.
Any idea why UnicodeDecoder is failing? Is there anything I can do?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
'ascii' codec can't decode byte 0xd1 in position 2: ordinal not ...
The reason for the error being that Python is trying to automatically decode it from the default encoding, ASCII, so that it can...
Read more >'Ascii' Codec Can't Decode Byte 0Xe9 In Position 20 - ADocLib
[python 3.8] UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 45: ordinal not in range128 #149. Python UnicodeDecodeError: 'cp950' codec can ...
Read more >'ascii' codec can't decode byte 0xb0 in position 37: ordinal not ...
UnicodeDecodeError : 'ascii' codec can't decode byte 0xb0 in position 37: ordinal not in range(128). An unexpected error has occurred:.
Read more >'ascii' codec can't decode byte 0xc3 in position 27: ordinal not ...
Hi everyone;i'm trying to add constraints of unicity;i can show the message in the beginning but after 2 tests i show this message:...
Read more >Python UnicodeDecodeError utf-8 codec can t decode byte ...
Python UnicodeDecodeError utf-8 codec can t decode byte 0xa0 in position ... against non-ASCII input which is not allowed by my application.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I think I got it. It should also take care of #141 . After some hours of debugging I realized that the file
gencode.v31.metadata.tab
, which I downloaded fromhttps://storage.googleapis.com/linnarsson-lab-www-blobs/human_GRCh38_gencode.v31.tar.gz
contains non-ASCII symbols:I played around with the locale settings of my Docker container, but it didn’t bring much. I ended up patching the file
normalize.py
as follows:I’m not sure how
x.decode("utf-8")
impacts the performance, therefore, the modified branch is only executed for the few lines above that would otherwise make UnicodeDecoder fail.The fix is in your git code, but this is too new to be installed with “pip install loompy”. So I likely just need to wait. Until then an install from git is sufficient to fix the problem. No pull request necessary any more. But Thank you!