pyAudioAnalysis icon indicating copy to clipboard operation
pyAudioAnalysis copied to clipboard

Python 3 support

Open philipperemy opened this issue 7 years ago • 20 comments

Hey guys, Is there a schedule for python3 compatibility? Thanks

philipperemy avatar Apr 11 '17 09:04 philipperemy

I would also like to find out if there are any plans. Currently I am working on a Python 3 port anyway, but since there is a lot of unpickling involved, I am not sure how much I will be able to cover for now. sklearn is already warning me about the perils of unpickling pre-0.18 SVMs and such.

keryil avatar Apr 17 '17 13:04 keryil

@keryil yes it's not very straight forward. That's why I opened a ticket there!

Let me know if you can complete it. If so, please open a Pull Request!

philipperemy avatar Apr 24 '17 01:04 philipperemy

@philipperemy If you want to use this library with python 3, you just have to convert the source. Use '2to3.py' script given in the "tools" directory of python.

hydra324 avatar May 25 '17 11:05 hydra324

@hydra324 at least for me it is not that easy.

gannebamm avatar May 29 '17 12:05 gannebamm

@gannebamm did you test this library? How was the performance?

hydra324 avatar May 29 '17 12:05 hydra324

2to3 didnt do a good job

dmoham1476 avatar Nov 02 '17 23:11 dmoham1476

Why "2to3 didnt do a good job"?

eduamf avatar Dec 11 '17 03:12 eduamf

@eduamf because it's not as simple as running a 2to3 script.

Google has millions of legacy code in python2 and probably will never migrate it to python3 because it requires a huge work.

2to3 works well when it comes to replace print "hello" by print("hello") but on many more complex tasks, it's very difficult to have it working.

philipperemy avatar Dec 11 '17 03:12 philipperemy

I've migrated enough code so that I'm able to run SVM classification on Python 3 (in my fork).

I can't guarantee that everything else will work, but feel free to file a pull request. I've also added setup.py to make it possible to install using pip install git+https://github.com/naktinis/pyAudioAnalysis.git.

I hope that @tyiannak will some day have time to do something similar in the original repository.

naktinis avatar Feb 12 '18 21:02 naktinis

In the README.md file, a note should be added regarding the Python Version needed by the library.

I've also managed to port it to Python 3.6.3, but it took some effort.

A problem exists with libmagic used by eye package in Windows 64 bit. Solved it after looking here, and making changes in the magic.py file, regarding the constructor of the class to use the specific magic.mgc file, residing -in my case- at: C:\Users\kmout\Downloads\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64\Lib\site-packages\magic.py The change made in the 'class Magic:' line 42: def __init__(self, mime=False, magic_file="C:\\Users\\kmout\\Downloads\\python_lib\\libmagicwin64\\magic.mgc", mime_encoding=False, keep_going=False, uncompress=False):

I used winPython 64bit on Windows 10 64bit (WinPython-64bit-3.6.3.0Qt5).

kmouts avatar Feb 15 '18 17:02 kmouts

Do you know this guy? https://github.com/ksingla025/pyAudioAnalysis3 is he part of the developers do you recommend this repository?

RefiPeretz avatar Mar 01 '18 14:03 RefiPeretz

@naktinis thank you very much

philipperemy avatar Mar 02 '18 01:03 philipperemy

@ksingla025 hey! How confident are you with your python3 implementation? Thanks

philipperemy avatar Mar 02 '18 01:03 philipperemy

@RefiPeretz I've contacted the guy. Let's wait for his response (if any).

philipperemy avatar Mar 02 '18 01:03 philipperemy

hi! does anyone know which version of python is this code compatible with? Clearly not python 3+ but which version of python 2 is this for? Thanks.

tsando avatar Mar 08 '18 14:03 tsando

@tsando worked well with 2.7 as far as I remember

philipperemy avatar Mar 08 '18 14:03 philipperemy

@tsando i use 2.7

andreaschandra avatar Apr 10 '18 03:04 andreaschandra

Hi, sorry never saw these messages. the one I shared works perfectly and is just forked from original. converted using 2to3 and then some minor syntax fixes. It works perfectly, have been using it in my work.

ksingla025 avatar Aug 07 '18 16:08 ksingla025

The README says that it is supposed to support Python3, but the unit tests still fail on Python3. It seems there are a bunch of places where print is used as a statement rather than a function (namely audioAnalysisRecordAlsa.py, analyzeMovieSound.py, data/testComputational.py, audacityAnnotation2WAVs.py, and data/recordRadio.py). Using from __future__ import print_function can make print work the same in Python 2 as it does in Python2. There may be other issues as well.

toddrjen avatar Jan 16 '19 16:01 toddrjen

Just an update on this trainClassifier fails on 3.8. The function time.clock() has been removed

AttributeError: module 'time' has no attribute 'clock'

Edit: looks like this was fixed in #299

ncrmro avatar Aug 05 '20 04:08 ncrmro