muon icon indicating copy to clipboard operation
muon copied to clipboard

pysam installation issue on Windows

Open khanthanan opened this issue 3 years ago • 3 comments

I got a warning and an error regarding the dependency of pysam when I tried to run the atac-seq tutorial. I tried installing pysam a couple of times but keep having issues. After a little search on google, I found that pysam cannot be installed on windows OS. Was wondering whether is it true or is there any solution for this.

Best, Thank you,

khanthanan avatar May 09 '22 23:05 khanthanan

Hey, seems like pysam can be used with WSL: https://github.com/pysam-developers/pysam/issues/575#issuecomment-468836983.

Just to note it here, pysam should only be required for some of the steps of the current tutorials. If there's something that breaks unexpectedly, please feel free to report it here.

gtca avatar May 09 '22 23:05 gtca

Thank you very much for your prompt reply. Sorry for the delay to respond you. I couldn't test it due to some other issues with my computer. I managed to use pysam with WSL. However, I'm facing another issue when working within WSL platform.

I keep getting the following error when I tried to save my mdata object as .h5mu file. mdata.write("data/data_processed.h5mu")

`--------------------------------------------------------------------------- TypeError Traceback (most recent call last) File ~/.local/lib/python3.8/site-packages/anndata/_io/utils.py:214, in report_write_key_on_error..func_wrapper(elem, key, val, *args, **kwargs) 213 try: --> 214 return func(elem, key, val, *args, **kwargs) 215 except Exception as e:

File ~/.local/lib/python3.8/site-packages/anndata/_io/specs/registry.py:175, in write_elem(f, k, elem, modifiers, *args, **kwargs) 174 else: --> 175 _REGISTRY.get_writer(dest_type, t, modifiers)(f, k, elem, *args, **kwargs)

File ~/.local/lib/python3.8/site-packages/anndata/_io/specs/registry.py:64, in IORegistry.get_writer(self, dest_type, typ, modifiers) 63 if (dest_type, typ, modifiers) not in self.write: ---> 64 raise TypeError( 65 f"No method has been defined for writing {typ} elements to {dest_type}" 66 ) 68 return self.write[(dest_type, typ, modifiers)]

TypeError: No method has been defined for writing <class 'mudata._core.mudata.MuAxisArrays'> elements to <class 'h5py._hl.group.Group'>

The above exception was the direct cause of the following exception:

TypeError Traceback (most recent call last) Input In [70], in <cell line: 1>() ----> 1 mdata.write("data/data_processed.h5mu")

File ~/.local/lib/python3.8/site-packages/mudata/_core/mudata.py:1086, in MuData.write_h5mu(self, filename, **kwargs) 1084 raise ValueError("Provide a filename!") 1085 else: -> 1086 write_h5mu(filename, self, **kwargs) 1087 if self.isbacked: 1088 self.file.filename = filename

File ~/.local/lib/python3.8/site-packages/mudata/_core/io.py:209, in write_h5mu(filename, mdata, **kwargs) 206 from .. import version, mudataversion, anndataversion 208 with h5py.File(filename, "w", userblock_size=512) as f: --> 209 _write_h5mu(f, mdata, **kwargs) 210 with open(filename, "br+") as f: 211 nbytes = f.write( 212 f"MuData (format-version={mudataversion};creator=muon;creator-version={version})".encode( 213 "utf-8" 214 ) 215 )

File ~/.local/lib/python3.8/site-packages/mudata/_core/io.py:46, in _write_h5mu(file, mdata, write_data, **kwargs) 34 write_attribute( 35 file, 36 "obs", 37 mdata.strings_to_categoricals(mdata._shrink_attr("obs", inplace=False)), 38 dataset_kwargs=kwargs, 39 ) 40 write_attribute( 41 file, 42 "var", 43 mdata.strings_to_categoricals(mdata._shrink_attr("var", inplace=False)), 44 dataset_kwargs=kwargs, 45 ) ---> 46 write_attribute(file, "obsm", mdata.obsm, dataset_kwargs=kwargs) 47 write_attribute(file, "varm", mdata.varm, dataset_kwargs=kwargs) 48 write_attribute(file, "obsp", mdata.obsp, dataset_kwargs=kwargs)

File ~/.local/lib/python3.8/site-packages/anndata/_io/utils.py:134, in write_attribute(*args, **kwargs) 128 from .specs import write_elem 130 warn( 131 "This internal function has been deprecated, please use write_elem instead", 132 DeprecationWarning, 133 ) --> 134 return write_elem(*args, **kwargs)

File ~/.local/lib/python3.8/site-packages/anndata/_io/utils.py:220, in report_write_key_on_error..func_wrapper(elem, key, val, *args, **kwargs) 218 else: 219 parent = _get_parent(elem) --> 220 raise type(e)( 221 f"{e}\n\n" 222 f"Above error raised while writing key {key!r} of {type(elem)} " 223 f"to {parent}" 224 ) from e

TypeError: No method has been defined for writing <class 'mudata._core.mudata.MuAxisArrays'> elements to <class 'h5py._hl.group.Group'>

Above error raised while writing key 'obsm' of <class 'h5py._hl.files.File'> to /`

I should say, I get this error only when I access Jupyter notebook with WSL. It works perfectly with anaconda notebooks. I was wondering whether you know a solution for this.

Thank you again for your help.

Best

khanthanan avatar May 21 '22 20:05 khanthanan

Hey @khanthanan, does this issue persist for the most recent mudata version? The main branch on GitHub now supports AnnData v0.8 that had some breaking changes, which might have been the issue here.

gtca avatar Jun 27 '22 19:06 gtca