GithubHelp home page GithubHelp logo

python 2 and 3 compatible about espnet HOT 11 CLOSED

espnet avatar espnet commented on May 13, 2024
python 2 and 3 compatible

from espnet.

Comments (11)

ShigekiKarita avatar ShigekiKarita commented on May 13, 2024

For Python2/3 compatibility, I recommend you to use flake8/hacking linter.

$ pip install hacking
$ flake8 . | grep "incompatible" 
./src/utils/filt.py:23:17: H233  Python 3.x incompatible use of print operator
./src/utils/filt.py:25:17: H233  Python 3.x incompatible use of print operator
./src/utils/text2token.py:52:9: H233  Python 3.x incompatible use of print operator
./src/utils/text2token.py:87:9: H233  Python 3.x incompatible use of print operator
./egs/voxforge/asr1/local/filter_text.py:22:13: H233  Python 3.x incompatible use of print operator
./egs/voxforge/asr1/local/make_trans.py:20:5: H233  Python 3.x incompatible use of print operator
./egs/voxforge/asr1/local/make_trans.py:49:5: H233  Python 3.x incompatible use of print operator
./egs/csj/asr1/local/csj_rm_tag.py:25:9: H233  Python 3.x incompatible use of print operator
./egs/csj/asr1/local/csj_rm_tag.py:26:9: H233  Python 3.x incompatible use of print operator

from espnet.

kan-bayashi avatar kan-bayashi commented on May 13, 2024

@ShigekiKarita Thank you for your information.
I think at least we should add following lines to be compatible with python 3.
from __future__ import print_function
from __future__ import division

from espnet.

ShigekiKarita avatar ShigekiKarita commented on May 13, 2024

In my opinion, there are no need to make scripts in src/utils python2/3 compatible because they are single-file-complete and only depend on python2 standard lib. Even they do not need venv.

So I propose that we just use a shebang #!/usr/bin/env python2 instead of #!/usr/bin/env python until python2 dies. I've done some exps successful with PR #20

from espnet.

sw005320 avatar sw005320 commented on May 13, 2024

I found that the Unicode issue is affected by LC_ALL=C in path.sh, which causes issues even we use Python 3. we need some investigation.

from espnet.

ShigekiKarita avatar ShigekiKarita commented on May 13, 2024

could you share a snippet of LC_ALL affected one ? maybe we can avoid it by unsetting within python

import locale
locale.setlocale(locale.LC_ALL, '')

from espnet.

lahiruts avatar lahiruts commented on May 13, 2024

Is it possible to have a readme file with the changes necessary to the master when someone want to use espnet using python 3?
I believe the recommended version to use is python 2.7?

from espnet.

sw005320 avatar sw005320 commented on May 13, 2024

Thanks, I will add it. Our travis CI actually checks both python 2.7 and 3.6 , and basic parts should be OK, but I don't fully test both cases.

from espnet.

sw005320 avatar sw005320 commented on May 13, 2024

@kan-bayashi, I think you're using python 3, right? Do you have any issues now?

from espnet.

ShigekiKarita avatar ShigekiKarita commented on May 13, 2024

I'm also using python3. I have known some issues like

  • if kaldi installs python2 under tools (it can be happen when your python is 3), path.sh prefer kaldiโ€™s python
  • makefile has some hard coded lines like venv/lib/python2.7
  • some utill scripts still have #!/usr/bin/env python but it should be #!/usr/bin/env python2 because it is not compatible to python3 and do not use third party modules.

from espnet.

ShigekiKarita avatar ShigekiKarita commented on May 13, 2024

TravisCI should use tools/Makefile to setup but kaldi is a problem. It took too long time to install and there is no test requires kaldi when I setup the CI. I think Makefile
should skip the kaldi build under the CI somehow.

I think many users do not compile kaldi everytime , they might put a link in tools/kaldi or install via conda

from espnet.

lahiruts avatar lahiruts commented on May 13, 2024

@ShigekiKarita you are correct. I also use a link to my Kaldi installation under the tools folder.

from espnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.