panaroo icon indicating copy to clipboard operation
panaroo copied to clipboard

AttributeError: 'numpy.ndarray' object has no attribute 'tostring'

Open PlatonB opened this issue 6 months ago • 3 comments

How I installed panaroo:

micromamba install \
  biopython networkx numpy scipy scikit-learn pandas \
  matplotlib-base tqdm gffutils joblib dendropy \
  cd-hit mafft mash

pip3 install edlib intbitset biocode

pip3 install "https://github.com/gtonkinhill/panaroo/archive/refs/tags/v1.5.2.tar.gz"

Command:

time panaroo -i /path/to/04_upd_gffs/*.gff -o /path/to/05_pangenome --clean-mode strict -t 8 --aligner mafft

Exception:

joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/platon/micromamba/envs/pharokka/lib/python3.13/site-packages/joblib/externals/loky/process_executor.py", line 490, in _process_worker
    r = call_item()
  File "/home/platon/micromamba/envs/pharokka/lib/python3.13/site-packages/joblib/externals/loky/process_executor.py", line 291, in __call__
    return self.fn(*self.args, **self.kwargs)
           ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/platon/micromamba/envs/pharokka/lib/python3.13/site-packages/joblib/parallel.py", line 607, in __call__
    return [func(*args, **kwargs) for func, args, kwargs in self.items]
            ~~~~^^^^^^^^^^^^^^^^^
  File "/home/platon/micromamba/envs/pharokka/lib/python3.13/site-packages/panaroo/prokka.py", line 198, in get_gene_sequences
    (len(gene_sequence) < 34)) or ("*" in translate(str(gene_sequence), table)[:-1]):
                                          ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/platon/micromamba/envs/pharokka/lib/python3.13/site-packages/panaroo/prokka.py", line 72, in translate
    indices[np.arange(2, len(seq), 3)]].tostring().decode('ascii')
                                        ^^^^^^^^
AttributeError: 'numpy.ndarray' object has no attribute 'tostring'
"""

PlatonB avatar Oct 19 '25 21:10 PlatonB

The error occurs with both Python 3.13 and 3.12.

PlatonB avatar Oct 19 '25 22:10 PlatonB

As a temporary solution, a significant downgrade of numpy and scipy works:

micromamba install -c conda-forge numpy=1.26.4 scipy=1.11.4

PlatonB avatar Oct 19 '25 22:10 PlatonB

Thanks for letting us know, we will try and take care of this and #351 for the next release.

nzmacalasdair avatar Oct 29 '25 14:10 nzmacalasdair