bastibe / SoundCard

A Pure-Python Real-Time Audio Library
https://soundcard.readthedocs.io
BSD 3-Clause "New" or "Revised" License
659 stars 71 forks source link

Pyinstaller doesn't create soundcard path while using soundcard package #92

Open PasaOpasen opened 4 years ago

PasaOpasen commented 4 years ago

I'm compiling this file by pyinstaller.

Compile is successful:

C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry>pyinstaller soundcard_report.py
110 INFO: PyInstaller: 3.6
111 INFO: Python: 3.8.3
111 INFO: Platform: Windows-10-10.0.18362-SP0
113 INFO: wrote C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry\soundcard_report.spec
116 INFO: UPX is not available.
125 INFO: Extending PYTHONPATH with paths
['C:\\Users\\qtckp\\OneDrive\\Рабочий стол\\SpeechLogger\\SecondTry',
 'C:\\Users\\qtckp\\OneDrive\\Рабочий стол\\SpeechLogger\\SecondTry']
125 INFO: checking Analysis
126 INFO: Building Analysis because Analysis-00.toc is non existent
126 INFO: Initializing module dependency graph...
128 INFO: Caching module graph hooks...
139 INFO: Analyzing base_library.zip ...
4133 INFO: Processing pre-find module path hook   distutils
4134 INFO: distutils: retargeting to non-venv dir 'c:\\users\\qtckp\\appdata\\local\\programs\\python\\python38\\lib'
7909 INFO: Caching module dependency graph...
8108 INFO: running Analysis Analysis-00.toc
8141 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\qtckp\appdata\local\programs\python\python38\python.exe
8644 INFO: Analyzing C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry\soundcard_report.py
9861 INFO: Processing pre-find module path hook   site
9862 INFO: site: retargeting to fake-dir 'c:\\users\\qtckp\\appdata\\local\\programs\\python\\python38\\lib\\site-packages\\PyInstaller\\fake-modules'
12771 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
16596 INFO: Processing module hooks...
16597 INFO: Loading module hook "hook-distutils.py"...
16600 INFO: Loading module hook "hook-encodings.py"...
16710 INFO: Loading module hook "hook-lib2to3.py"...
16717 INFO: Loading module hook "hook-numpy.core.py"...
16876 INFO: Loading module hook "hook-numpy.py"...
16878 INFO: Loading module hook "hook-pkg_resources.py"...
17173 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
17229 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
17636 INFO: Excluding import '__main__'
17639 INFO:   Removing import of __main__ from module pkg_resources
17640 INFO: Loading module hook "hook-pycparser.py"...
17642 INFO: Loading module hook "hook-pydoc.py"...
17645 INFO: Loading module hook "hook-scipy.py"...
17655 INFO: Loading module hook "hook-setuptools.py"...
18372 INFO: Loading module hook "hook-sysconfig.py"...
18375 INFO: Loading module hook "hook-xml.dom.domreg.py"...
18377 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
18379 INFO: Loading module hook "hook-xml.py"...
18380 INFO: Loading module hook "hook-_tkinter.py"...
18555 INFO: checking Tree
18555 INFO: Building Tree because Tree-00.toc is non existent
18556 INFO: Building Tree Tree-00.toc
18673 INFO: checking Tree
18673 INFO: Building Tree because Tree-01.toc is non existent
18675 INFO: Building Tree Tree-01.toc
18770 INFO: Looking for ctypes DLLs
18881 INFO: Analyzing run-time hooks ...
18890 INFO: Including run-time hook 'pyi_rth__tkinter.py'
18893 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
18898 INFO: Including run-time hook 'pyi_rth_pkgres.py'
18916 INFO: Looking for dynamic libraries
20027 INFO: Looking for eggs
20027 INFO: Using Python library c:\users\qtckp\appdata\local\programs\python\python38\python38.dll
20029 INFO: Found binding redirects:
[]
20044 INFO: Warnings written to C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry\build\soundcard_report\warn-soundcard_report.txt
20277 INFO: Graph cross-reference written to C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry\build\soundcard_report\xref-soundcard_report.html
20376 INFO: checking PYZ
20376 INFO: Building PYZ because PYZ-00.toc is non existent
20378 INFO: Building PYZ (ZlibArchive) C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry\build\soundcard_report\PYZ-00.pyz
22385 INFO: Building PYZ (ZlibArchive) C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry\build\soundcard_report\PYZ-00.pyz completed successfully.
22431 INFO: checking PKG
22432 INFO: Building PKG because PKG-00.toc is non existent
22433 INFO: Building PKG (CArchive) PKG-00.pkg
22474 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
22477 INFO: Bootloader c:\users\qtckp\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
22477 INFO: checking EXE
22478 INFO: Building EXE because EXE-00.toc is non existent
22479 INFO: Building EXE from EXE-00.toc
22480 INFO: Appending archive to EXE C:\Users\qtckp\OneDrive\Рабочий стол\SpeechLogger\SecondTry\build\soundcard_report\soundcard_report.exe
22497 INFO: Building EXE from EXE-00.toc completed successfully.
22506 INFO: checking COLLECT
22506 INFO: Building COLLECT because COLLECT-00.toc is non existent
22507 INFO: Building COLLECT COLLECT-00.toc
26461 INFO: Building COLLECT COLLECT-00.toc completed successfully.

But after run .exe file it raises error err that there is no directory for soundcard (it's true). This problem exists with anaconda enviroment too (conda 4.8.3)

Version of SoundCard is 0.3.3

bastibe commented 4 years ago

@Bob-Thomas , do you know what the issue is, here?

Bob-Thomas commented 4 years ago

Ah yeah it looks like it is missing the pywin32 dependency. Maybe that causes the install not to complete

PasaOpasen commented 4 years ago

Ah yeah it looks like it is missing the pywin32 dependency. Maybe that causes the install not to complete

No, no results

Bob-Thomas commented 4 years ago

Uhm are you running the lastest pyinstaller and latest soundcard.

Soundcard on pypi doesn't contain the pyinstaller update yet I think.

On Mon, May 25, 2020, 19:24 Demetry Pasсal notifications@github.com wrote:

Ah yeah it looks like it is missing the pywin32 dependency. Maybe that causes the install not to complete

No, no results

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bastibe/SoundCard/issues/92#issuecomment-633660225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVH7PO4XLQLZBSK57DZ4ATRTKSWNANCNFSM4NIQVOTA .

bastibe commented 4 years ago

Soundcard on pypi doesn't contain the pyinstaller update yet I think.

Facepalm. I should have said that right in the beginning! Sorry about that.

Please try running the latest git version, to make SoundCard play nice with pyinstaller.

bastibe commented 4 years ago

I just published the current version to PyPi. Please try installing that and see if it fixes your issue.

PasaOpasen commented 4 years ago

I have run command

pip install --upgrade soundcard

to upgrade, but there is no results with pyinstaller still.

Also I have some problems with my code now:

def speech_to_text_from_speaker(speaker,time = 200_000,samplerate = 48000, lang = 'ru-RU'):
    with speaker.recorder(samplerate=samplerate) as mic:
        dt = mic.record(time)        
        write("tmp.wav", 
              samplerate, 
              np.int16(dt * (32767/np.max(np.abs(np.array([dt.min(),dt.max()]))))))

    return speech_to_text_from_wav(lang)

where speaker is the speaker from sc.all_microphones(include_loopback=True). So the problem is zero dt array because of very small time of listening. At version 0.3.3 that time was about 1-1.5 sec, now it's less that 0.5 maybe

bastibe commented 4 years ago

Please open a new issue for new problems. Let's try ans solve one issue at a time ;-)

Did the error message change with the new version?

PasaOpasen commented 4 years ago

Yes, with new version)

So I will use 0.3.3, it's not important so

bastibe commented 4 years ago

Also, we forgot to mention that the pyinstaller hook in the latest version of SoundCard only works with pyinstaller 4, which I believe is not released yet, but will be soon.