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

报错zipfile.BadZipFile: File is not a zip file #2223

Closed
jiweizhangxu opened this issue Aug 4, 2022 · 2 comments
Closed

报错zipfile.BadZipFile: File is not a zip file #2223

jiweizhangxu opened this issue Aug 4, 2022 · 2 comments
Labels

Comments

@jiweizhangxu
Copy link

看了之前的回答,重新安装了很多次环境都没有解决这个问题,请问为什么?
报错如下:
Traceback (most recent call last):
File "/usr/local/zx/PaddleSpeech-develop/try_1.py", line 1, in
from paddlespeech.cli.tts.infer import TTSExecutor
File "/usr/local/zx/PaddleSpeech-develop/paddlespeech/cli/tts/init.py", line 14, in
from .infer import TTSExecutor
File "/usr/local/zx/PaddleSpeech-develop/paddlespeech/cli/tts/infer.py", line 32, in
from paddlespeech.t2s.exps.syn_utils import get_frontend
File "/usr/local/zx/PaddleSpeech-develop/paddlespeech/t2s/init.py", line 18, in
from . import frontend
File "/usr/local/zx/PaddleSpeech-develop/paddlespeech/t2s/frontend/init.py", line 16, in
from .phonectic import *
File "/usr/local/zx/PaddleSpeech-develop/paddlespeech/t2s/frontend/phonectic.py", line 20, in
from g2p_en import G2p
File "/root/anaconda3/envs/speech/lib/python3.9/site-packages/g2p_en/init.py", line 1, in
from .g2p import G2p
File "/root/anaconda3/envs/speech/lib/python3.9/site-packages/g2p_en/g2p.py", line 22, in
nltk.data.find('taggers/averaged_perceptron_tagger.zip')
File "/root/anaconda3/envs/speech/lib/python3.9/site-packages/nltk/data.py", line 542, in find
return ZipFilePathPointer(p, zipentry)
File "/root/anaconda3/envs/speech/lib/python3.9/site-packages/nltk/compat.py", line 41, in _decorator
return init_func(*args, **kwargs)
File "/root/anaconda3/envs/speech/lib/python3.9/site-packages/nltk/data.py", line 394, in init
zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))
File "/root/anaconda3/envs/speech/lib/python3.9/site-packages/nltk/compat.py", line 41, in _decorator
return init_func(*args, **kwargs)
File "/root/anaconda3/envs/speech/lib/python3.9/site-packages/nltk/data.py", line 935, in init
zipfile.ZipFile.init(self, filename)
File "/root/anaconda3/envs/speech/lib/python3.9/zipfile.py", line 1266, in init
self._RealGetContents()
File "/root/anaconda3/envs/speech/lib/python3.9/zipfile.py", line 1333, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

环境如下:
2 2

@dzcmingdi
Copy link

dzcmingdi commented Aug 4, 2022

我也有这个问题,我在AI Studio上安装了paddlespeech。
然后导入库的时候:

from pathlib import Path
import numpy as np
import paddle
import yaml
from yacs.config import CfgNode
from paddlespeech.t2s.models.fastspeech2 import FastSpeech2
from paddlespeech.t2s.models.fastspeech2 import FastSpeech2Inference
from paddlespeech.t2s.modules.normalizer import ZScore
from frontend import Frontend

出现错误:

---------------------------------------------------------------------------
BadZipFile                                Traceback (most recent call last)
/tmp/ipykernel_165/899723052.py in <module>
      4 import yaml
      5 from yacs.config import CfgNode
----> 6 from paddlespeech.t2s.models.fastspeech2 import FastSpeech2
      7 from paddlespeech.t2s.models.fastspeech2 import FastSpeech2Inference
      8 from paddlespeech.t2s.modules.normalizer import ZScore

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/__init__.py in <module>
     16 from . import datasets
     17 from . import exps
---> 18 from . import frontend
     19 from . import models
     20 from . import modules

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/__init__.py in <module>
     14 from .generate_lexicon import *
     15 from .normalizer import *
---> 16 from .phonectic import *
     17 from .punctuation import *
     18 from .tone_sandhi import *

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/phonectic.py in <module>
     18 import numpy as np
     19 import paddle
---> 20 from g2p_en import G2p
     21 from g2pM import G2pM
     22 

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/g2p_en/__init__.py in <module>
----> 1 from .g2p import G2p

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/g2p_en/g2p.py in <module>
     20 
     21 try:
---> 22     nltk.data.find('taggers/averaged_perceptron_tagger.zip')
     23 except LookupError:
     24     nltk.download('averaged_perceptron_tagger')

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/data.py in find(resource_name, paths)
    658                 if os.path.exists(p):
    659                     try:
--> 660                         return ZipFilePathPointer(p, zipentry)
    661                     except IOError:
    662                         # resource not in zipfile

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/compat.py in _decorator(*args, **kwargs)
    226     def _decorator(*args, **kwargs):
    227         args = (args[0], add_py3_data(args[1])) + args[2:]
--> 228         return init_func(*args, **kwargs)
    229 
    230     return wraps(init_func)(_decorator)

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/data.py in __init__(self, zipfile, entry)
    504         """
    505         if isinstance(zipfile, string_types):
--> 506             zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))
    507 
    508         # Check that the entry exists:

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/compat.py in _decorator(*args, **kwargs)
    226     def _decorator(*args, **kwargs):
    227         args = (args[0], add_py3_data(args[1])) + args[2:]
--> 228         return init_func(*args, **kwargs)
    229 
    230     return wraps(init_func)(_decorator)

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/data.py in __init__(self, filename)
   1053         if not isinstance(filename, string_types):
   1054             raise TypeError('ReopenableZipFile filename must be a string')
-> 1055         zipfile.ZipFile.__init__(self, filename)
   1056         assert self.filename == filename
   1057         self.close()

/opt/conda/envs/python35-paddle120-env/lib/python3.7/zipfile.py in __init__(self, file, mode, compression, allowZip64, compresslevel)
   1223         try:
   1224             if mode == 'r':
-> 1225                 self._RealGetContents()
   1226             elif mode in ('w', 'x'):
   1227                 # set the modified flag so central directory gets written

/opt/conda/envs/python35-paddle120-env/lib/python3.7/zipfile.py in _RealGetContents(self)
   1290             raise BadZipFile("File is not a zip file")
   1291         if not endrec:
-> 1292             raise BadZipFile("File is not a zip file")
   1293         if self.debug > 1:
   1294             print(endrec)

BadZipFile: File is not a zip file

我的所有pip包:

Package                Version
---------------------- ---------------
absl-py                0.8.1
aiohttp                3.8.1
aiosignal              1.2.0
alembic                1.8.1
anyio                  3.6.1
appdirs                1.4.4
argon2-cffi            21.3.0
argon2-cffi-bindings   21.2.0
aspy.yaml              1.3.0
astor                  0.8.1
astroid                2.4.1
async-generator        1.10
async-timeout          4.0.2
asynctest              0.13.0
attrs                  21.4.0
audioread              2.1.8
autopep8               1.6.0
Babel                  2.8.0
backcall               0.1.0
bce-python-sdk         0.8.53
beautifulsoup4         4.11.1
bleach                 5.0.1
Bottleneck             1.3.5
cachetools             4.0.0
certifi                2019.9.11
certipy                0.1.3
cffi                   1.15.1
cfgv                   2.0.1
chardet                3.0.4
charset-normalizer     2.1.0
Click                  7.0
cloudpickle            1.6.0
cma                    2.7.0
colorama               0.4.4
coloredlogs            15.0.1
colorlog               4.1.0
cryptography           37.0.4
cycler                 0.10.0
Cython                 0.29
datasets               2.4.0
debugpy                1.6.2
decorator              4.4.2
defusedxml             0.7.1
dill                   0.3.4
Distance               0.1.3
easydict               1.9
editdistance           0.6.0
entrypoints            0.4
et-xmlfile             1.0.1
fastapi                0.79.0
fastjsonschema         2.16.1
filelock               3.0.12
flake8                 4.0.1
Flask                  1.1.1
Flask-Babel            1.0.0
Flask-Cors             3.0.8
flatbuffers            2.0
forbiddenfruit         0.1.3
frozenlist             1.3.1
fsspec                 2022.7.1
funcsigs               1.0.2
future                 0.18.0
g2p-en                 2.1.0
g2pM                   0.1.2.5
gast                   0.3.3
gitdb                  4.0.5
GitPython              3.1.14
google-auth            1.10.0
google-auth-oauthlib   0.4.1
graphviz               0.13
greenlet               1.1.2
grpcio                 1.35.0
gunicorn               20.0.4
gym                    0.12.1
h11                    0.13.0
h5py                   2.9.0
huggingface-hub        0.8.1
humanfriendly          10.0
identify               1.4.10
idna                   2.8
imageio                2.6.1
imageio-ffmpeg         0.3.0
importlib-metadata     4.2.0
importlib-resources    5.8.0
inflect                6.0.0
ipykernel              6.9.1
ipython                7.34.0
ipython-genutils       0.2.0
ipywidgets             7.6.5
isort                  4.3.21
itsdangerous           1.1.0
jdcal                  1.4.1
jedi                   0.18.1
jieba                  0.42.1
Jinja2                 3.0.0
joblib                 0.14.1
JPype1                 0.7.2
json5                  0.9.5
jsonlines              3.1.0
jsonschema             4.7.2
jupyter-archive        3.2.1
jupyter-client         7.3.4
jupyter-core           4.11.1
jupyter-lsp            1.5.1
jupyter-server         1.12.0
jupyter-telemetry      0.1.0
jupyterhub             1.3.0
jupyterlab             3.1.12
jupyterlab-pygments    0.2.2
jupyterlab-server      2.10.3
jupyterlab-widgets     1.1.1
kaldiio                2.17.2
kiwisolver             1.1.0
lazy-object-proxy      1.4.3
librosa                0.8.1
lightgbm               3.1.1
llvmlite               0.31.0
loguru                 0.6.0
lxml                   4.9.1
Mako                   1.2.1
Markdown               3.1.1
MarkupSafe             2.0.1
matplotlib             2.2.3
matplotlib-inline      0.1.3
mccabe                 0.6.1
mistune                0.8.4
mock                   4.0.3
more-itertools         7.2.0
moviepy                1.0.1
mpmath                 1.2.1
multidict              6.0.2
multiprocess           0.70.12.2
nara-wpe               0.0.8
nbclassic              0.3.1
nbclient               0.5.13
nbconvert              6.4.5
nbformat               5.4.0
nest-asyncio           1.5.5
netifaces              0.10.9
networkx               2.4
nltk                   3.4.5
nodeenv                1.3.4
notebook               5.7.8
numba                  0.48.0
numpy                  1.21.6
oauthlib               3.1.0
objgraph               3.4.1
onnxruntime            1.12.0
opencv-python          4.1.1.26
openpyxl               3.0.5
opt-einsum             3.3.0
packaging              21.3
paddle-bfloat          0.1.7
paddle2onnx            0.9.8
paddleaudio            1.0.1
paddlefsl              1.1.0
paddlehub              2.0.4
paddlenlp              2.3.5
paddlepaddle           2.3.1
paddlespeech           1.0.1
paddlespeech-feat      0.1.0
pamela                 1.0.0
pandas                 1.1.5
pandocfilters          1.5.0
parl                   1.4.1
parso                  0.8.3
pathlib                1.0.1
pathos                 0.2.8
pattern-singleton      1.2.0
pexpect                4.7.0
pickleshare            0.7.5
Pillow                 8.2.0
pip                    22.1.2
plotly                 5.8.0
pluggy                 1.0.0
pooch                  1.6.0
portalocker            2.5.1
pox                    0.3.1
ppft                   1.7.6.5
praatio                5.0.0
pre-commit             1.21.0
prettytable            0.7.2
proglog                0.1.9
prometheus-client      0.14.1
prompt-toolkit         2.0.10
protobuf               3.20.0
psutil                 5.7.2
ptyprocess             0.7.0
py4j                   0.10.9.2
pyarrow                9.0.0
pyasn1                 0.4.8
pyasn1-modules         0.2.7
pycodestyle            2.8.0
pycparser              2.21
pycryptodome           3.9.9
pydantic               1.9.1
pydocstyle             5.0.2
pyflakes               2.4.0
pyglet                 1.4.5
Pygments               2.12.0
pylint                 2.5.2
pynvml                 8.0.4
pyOpenSSL              22.0.0
pyparsing              3.0.9
pypinyin               0.47.0
pypinyin-dict          0.3.0
pypmml                 0.9.11
pyrsistent             0.18.1
python-dateutil        2.8.2
python-json-logger     2.0.4
python-jsonrpc-server  0.3.4
python-language-server 0.33.0
python-lsp-jsonrpc     1.0.0
python-lsp-server      1.5.0
pytz                   2019.3
pyworld                0.3.0
PyYAML                 5.1.2
pyzmq                  23.2.0
rarfile                3.1
recordio               0.1.7
regex                  2022.7.25
requests               2.24.0
requests-oauthlib      1.3.0
resampy                0.2.2
responses              0.18.0
rope                   0.17.0
rsa                    4.0
ruamel.yaml            0.17.21
ruamel.yaml.clib       0.2.6
sacrebleu              2.2.0
scikit-learn           0.22.1
scipy                  1.3.0
seaborn                0.10.0
Send2Trash             1.8.0
sentencepiece          0.1.96
seqeval                1.2.2
setuptools             41.4.0
shellcheck-py          0.7.1.1
six                    1.16.0
sklearn                0.0
smmap                  3.0.5
sniffio                1.2.0
snowballstemmer        2.0.0
SoundFile              0.10.3.post1
soupsieve              2.3.2.post1
SQLAlchemy             1.4.39
starlette              0.19.1
sympy                  1.10.1
tabulate               0.8.10
tb-nightly             1.15.0a20190801
tb-paddle              0.3.6
tenacity               8.0.1
tensorboard            2.1.0
tensorboardX           1.8
termcolor              1.1.0
terminado              0.15.0
testpath               0.4.2
TextGrid               1.5
timer                  0.2.2
tinycss2               1.1.1
toml                   0.10.0
tornado                6.2
tqdm                   4.64.0
traitlets              5.3.0
typed-ast              1.4.1
typeguard              2.13.3
typing_extensions      4.3.0
ujson                  5.4.0
urllib3                1.25.11
uvicorn                0.18.2
virtualenv             16.7.9
visualdl               2.3.0
wcwidth                0.1.7
webencodings           0.5.1
webrtcvad              2.0.10
websocket-client       1.3.3
websockets             10.3
Werkzeug               0.16.0
whatthepatch           1.0.2
wheel                  0.33.6
widgetsnbextension     3.5.2
wrapt                  1.12.1
xarray                 0.16.2
xgboost                1.3.3
xlrd                   1.2.0
xxhash                 3.0.0
yacs                   0.1.8
yapf                   0.26.0
yarl                   1.8.1
zhon                   1.1.5
zipp                   3.8.1

@yt605155624
Copy link
Collaborator

yt605155624 commented Aug 4, 2022

Duplicate of #1925

@yt605155624 yt605155624 added the T2S label Aug 4, 2022
@yt605155624 yt605155624 marked this as a duplicate of #1925 Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants