Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'fasta' #53

Open
fulaibaowang opened this issue Mar 27, 2023 · 6 comments
Open

ModuleNotFoundError: No module named 'fasta' #53

fulaibaowang opened this issue Mar 27, 2023 · 6 comments

Comments

@fulaibaowang
Copy link

Hi,
I got a ModuleNotFoundError when testing the RiboCode installation with RiboCode_onestep -V
Can you help?

$ RiboCode_onestep -V
Traceback (most recent call last):
  File "/nexus/posix0/MAGE-flaski/service/projects/data/Bioinformatics/bit_pipe_ribosome_profiling/libraries/venv3/bin/RiboCode_onestep", line 5, in <module>
    from RiboCode.RiboCode_onestep import main
  File "/nexus/posix0/MAGE-flaski/service/projects/data/Bioinformatics/bit_pipe_ribosome_profiling/libraries/venv3/lib/python3.9/site-packages/RiboCode/RiboCode_onestep.py", line 16, in <module>
    from .prepare_transcripts import *
  File "/nexus/posix0/MAGE-flaski/service/projects/data/Bioinformatics/bit_pipe_ribosome_profiling/libraries/venv3/lib/python3.9/site-packages/RiboCode/prepare_transcripts.py", line 17, in <module>
    from pyfasta import Fasta
  File "/nexus/posix0/MAGE-flaski/service/projects/data/Bioinformatics/bit_pipe_ribosome_profiling/libraries/venv3/lib/python3.9/site-packages/pyfasta/__init__.py", line 3, in <module>
    from fasta import Fasta, complement, DuplicateHeaderException
ModuleNotFoundError: No module named 'fasta'

my package list

$ pip3 list
Package            Version
------------------ ---------
AGEpy              0.8.2
autopaths          1.6.0
bcrypt             3.2.0
biomart            0.9.2
biopython          1.78
certifi            2020.12.5
cffi               1.14.5
chardet            4.0.0
charset-normalizer 3.1.0
click              7.1.2
coloredlogs        15.0
colormath          3.0.0
cryptography       3.4.6
cycler             0.10.0
decorator          4.4.2
et-xmlfile         1.0.1
future             0.18.2
h5py               3.1.0
HTSeq              0.13.5
humanfriendly      9.1
idna               2.10
ipaddress          1.0.23
jdcal              1.4.1
Jinja2             2.11.3
joblib             1.0.1
kiwisolver         1.3.1
lzstring           1.0.4
Markdown           3.3.4
MarkupSafe         1.1.1
matplotlib         3.3.4
minepy             1.2.6
multiqc            1.9
networkx           2.5
numpy              1.20.1
openpyxl           3.0.6
pandas             1.2.2
paramiko           2.7.2
patsy              0.5.1
Pillow             8.1.0
pip                23.0.1
plumbing           2.11.2
py                 1.11.0
pybedtools         0.8.1
pycparser          2.20
pyfasta            0.5.2
PyNaCl             1.4.0
pyparsing          2.4.7
pysam              0.16.0.1
python-dateutil    2.8.1
pytz               2021.1
PyYAML             5.4.1
requests           2.25.1
retry              0.9.2
RiboCode           1.2.15
scikit-learn       0.24.1
scipy              1.6.1
seaborn            0.11.1
setuptools         57.5.0
sh                 2.0.3
simplejson         3.17.2
six                1.15.0
spectra            0.0.11
statsmodels        0.12.2
suds-jurko         0.6
threadpoolctl      2.1.0
tqdm               4.65.0
urllib3            1.26.3
Wand               0.6.5
wheel              0.38.4
xlrd               2.0.1
XlsxWriter         1.3.7
@ckvilas
Copy link

ckvilas commented Apr 3, 2023

I received the same error. Any tips? Thank you in advance! @zhengtaoxiao

@ckvilas
Copy link

ckvilas commented Apr 4, 2023

Update: uninstalling and re-installing fasta and Pyfasta solved the issue.

@erlun1
Copy link

erlun1 commented Nov 1, 2023

RiboCode uses pyfasta instead of the updated version pyfaidx, so I browsed through the source code of pyfasta and found that in the init.py file, the code from fasta import Fasta, complement, DuplicateHeaderException is actually intended to call the fasta.py script in the same directory, rather than importing a module named fasta. If necessary, you can manually modify the init.py file and then install it.

@erlun1
Copy link

erlun1 commented Nov 1, 2023

additionally,"pyfasta" requires Python 2, while "RiboCode" requires Python 3.6 or above.So:
In fasta.py, for Python 3.10 and above, from collections import Mapping should be changed to from collections.abc import Mapping.
In records.py, for Python 3.X, import cPickle should be changed to import _pickle as cPickle, and the long type should be removed.
In split_fasta.py, for Python 3.X, from cStringIO import StringIO should be changed to from io import StringIO.

@seeninheoi
Copy link

additionally,"pyfasta" requires Python 2, while "RiboCode" requires Python 3.6 or above.So: In fasta.py, for Python 3.10 and above, from collections import Mapping should be changed to from collections.abc import Mapping. In records.py, for Python 3.X, import cPickle should be changed to import _pickle as cPickle, and the long type should be removed. In split_fasta.py, for Python 3.X, from cStringIO import StringIO should be changed to from io import StringIO.

Hello,I can't exactly understand the step how to solve with it. How to instead the python2 to python3 in fasta? can you give me some more detail suggestions,thank you so much┭┮﹏┭┮

@pavelToman
Copy link

pavelToman commented Jul 19, 2024

For me helped:

sed -i
    -e 's/from fasta/from pyfasta.fasta/'
    -e 's/from records/from pyfasta.records/'
    -e 's/from split_fasta/from pyfasta.split_fasta/'
    pyfasta/__init__.py &&
sed -i 's/from collections/from collections.abc/' pyfasta/fasta.py &&
sed -i 's/from records/from pyfasta.records/' pyfasta/fasta.py &&
sed -i 's/import cPickle/import _pickle as cPickle/' pyfasta/records.py &&
sed -i 's/from cStringIO import StringIO/from io import StringIO/' pyfasta/split_fasta.py &&

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

No branches or pull requests

5 participants