Open timholy opened 9 months ago
Turns out I can work around this, but then get a different error:
julia> ENV["XDG_SESSION_TYPE"] = "x11"
"x11"
julia> using JustSayIt
julia> start()
[ Info: JustSayIt: I am initializing...
[ Info: No accurate large model for the type language (English (United States)) found in its default location (/home/tim/.local/share/JustSayIt/models/vosk-model-en-us-daanzu-20200905): download (optional) accurate large model (vosk-model-en-us-daanzu-20200905.zip) from 'https://alphacephei.com/vosk/models' (~1-2 GB)?
Type "yes" or "no":
no
┌ Warning: Not downloading large accurate model for typing the default language (English (United States)): falling back to default model for typing.
└ @ JustSayIt ~/.julia/packages/JustSayIt/w35dO/src/init_jsi.jl:182
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/tim/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'sounddevice.PortAudioError'>
PortAudioError('Error querying device -1')
File "/home/tim/.julia/conda/3/lib/python3.10/site-packages/sounddevice.py", line 1192, in __init__
_StreamBase.__init__(self, kind='input', wrap_callback='buffer',
File "/home/tim/.julia/conda/3/lib/python3.10/site-packages/sounddevice.py", line 817, in __init__
_get_stream_parameters(kind, device, channels, dtype, latency,
File "/home/tim/.julia/conda/3/lib/python3.10/site-packages/sounddevice.py", line 2660, in _get_stream_parameters
info = query_devices(device)
File "/home/tim/.julia/conda/3/lib/python3.10/site-packages/sounddevice.py", line 569, in query_devices
raise PortAudioError(f'Error querying device {device}')
Stacktrace:
[1] pyerr_check
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/exception.jl:75 [inlined]
[2] pyerr_check
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/exception.jl:79 [inlined]
[3] _handle_error(msg::String)
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/exception.jl:96
[4] macro expansion
@ ~/.julia/packages/PyCall/1gn3u/src/exception.jl:110 [inlined]
[5] #107
@ ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:43 [inlined]
[6] disable_sigint
@ ./c.jl:473 [inlined]
[7] __pycall!
@ ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:42 [inlined]
[8] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{}, nargs::Int64, kw::PyCall.PyObject)
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:29
[9] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{}, kwargs::@Kwargs{…})
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:11
[10] #_#114
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:86 [inlined]
[11] start_recording(; id::String, audio_input_cmd::Nothing)
@ JustSayIt ~/.julia/packages/JustSayIt/w35dO/src/recorder.jl:68
[12] start_recording
@ ~/.julia/packages/JustSayIt/w35dO/src/recorder.jl:63 [inlined]
[13] start(; default_language::String, type_languages::String, commands::Nothing, subset::Nothing, max_speed_subset::Nothing, modeldirs::Nothing, noises::Dict{…}, audio_input_cmd::Nothing)
@ JustSayIt ~/.julia/packages/JustSayIt/w35dO/src/start.jl:159
[14] start()
@ JustSayIt ~/.julia/packages/JustSayIt/w35dO/src/start.jl:132
[15] top-level scope
@ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.
I note that the errors are all in the Python libraries, not your Julia code.
Thank you for your interest! I'm sorry that you ran into these errors, which as you noted are in the dependencies. It looks like for some reason it cannot detect your microphone (PortAudioError('Error querying device -1')
). Are you using some non-standard microphone or driver?
Possibly due to WSL? Today I tried it on Windows, and got this:
julia> cd("C:\\Users\\timho\\Downloads\\VoiceAssist")
(@v1.10) pkg> activate .
Activating project at `C:\Users\timho\Downloads\VoiceAssist`
julia> using JustSayIt
[ Info: Running `conda config --set pip_interop_enabled true --file 'C:\Users\timho\.julia\conda\3\condarc-julia.yml'` in root environment
ERROR: InitError: IOError: could not spawn setenv(`'C:\Users\timho\.julia\conda\3\Scripts\conda.exe' config --set pip_interop_enabled true --file 'C:\Users\timho\.julia\conda\3\condarc-julia.yml'`,["WINDIR=C:\\WINDOWS", "PATH=C:\\Users\\timho\\.julia\\conda\\3\\Library\\bin;C:\\Users\\timho\\.julia\\conda\\3\\lib\\site-packages\\vosk;C:\\Users\\timho\\.julia\\conda\\3\\Library\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\Users\\timho\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\timho\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\timho\\AppData\\Local\\Pandoc\\;C:\\texlive\\2023\\bin\\windows", "USERDOMAIN_ROAMINGPROFILE=DIVA", "ZES_ENABLE_SYSMAN=1", "JSI_USE_PYTHON=1", "LOCALAPPDATA=C:\\Users\\timho\\AppData\\Local", "HOMEPATH=\\Users\\timho", "PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 154 Stepping 3, GenuineIntel", "NUMBER_OF_PROCESSORS=16", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC", "SYSTEMROOT=C:\\WINDOWS", "APPDATA=C:\\Users\\timho\\AppData\\Roaming", "PSMODULEPATH=C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules", "COMMONPROGRAMW6432=C:\\Program Files\\Common Files", "PROGRAMDATA=C:\\ProgramData", "PUBLIC=C:\\Users\\Public", "USERDOMAIN=DIVA", "OS=Windows_NT", "PROCESSOR_REVISION=9a03", "TMP=C:\\Users\\timho\\AppData\\Local\\Temp", "COMMONPROGRAMFILES(X86)=C:\\Program Files (x86)\\Common Files", "COMSPEC=C:\\WINDOWS\\system32\\cmd.exe", "OPENBLAS_DEFAULT_NUM_THREADS=1", "NSPR_NATIVE_THREADS_ONLY=1", "ALLUSERSPROFILE=C:\\ProgramData", "COMMONPROGRAMFILES=C:\\Program Files\\Common Files", "COMPUTERNAME=DIVA", "JULIA_NUM_THREADS=4", "ONEDRIVE=C:\\Users\\timho\\OneDrive", "USERNAME=timho", "PROGRAMFILES(X86)=C:\\Program Files (x86)", "PROGRAMFILES=C:\\Program Files", "CONDARC=C:\\Users\\timho\\.julia\\conda\\3\\condarc-julia.yml", "LOGONSERVER=\\\\DIVA", "ONEDRIVECONSUMER=C:\\Users\\timho\\OneDrive", "USERPROFILE=C:\\Users\\timho", "DRIVERDATA=C:\\Windows\\System32\\Drivers\\DriverData", "CONDA_PREFIX=C:\\Users\\timho\\.julia\\conda\\3", "PROCESSOR_LEVEL=6", "SYSTEMDRIVE=C:", "=C:=C:\\Users\\timho\\Downloads\\VoiceAssist", "PROGRAMW6432=C:\\Program Files", "TEMP=C:\\Users\\timho\\AppData\\Local\\Temp", "HOMEDRIVE=C:", "OPENBLAS_MAIN_FREE=1", "PROCESSOR_ARCHITECTURE=AMD64", "PYTHONIOENCODING=UTF-8"]): operation not supported on socket (ENOTSUP)
Stacktrace:
[1] _spawn_primitive(file::String, cmd::Cmd, stdio::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
@ Base .\process.jl:128
[2] #784
@ Base .\process.jl:139 [inlined]
[3] setup_stdios(f::Base.var"#784#785"{Cmd}, stdios::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
@ Base .\process.jl:223
[4] _spawn
@ Base .\process.jl:138 [inlined]
[5] run(::Cmd; wait::Bool)
@ Base .\process.jl:479
[6] run
@ Base .\process.jl:477 [inlined]
[7] runconda(args::Cmd, env::String)
@ Conda C:\Users\timho\.julia\packages\Conda\sDjAP\src\Conda.jl:182
[8] pip_interop (repeats 2 times)
@ Conda C:\Users\timho\.julia\packages\Conda\sDjAP\src\Conda.jl:622 [inlined]
[9] pyimport_pip(modulename::String; dependency::String, channel::String)
@ JustSayIt C:\Users\timho\.julia\packages\JustSayIt\w35dO\src\shared.jl:446
[10] pyimport_pip
@ JustSayIt C:\Users\timho\.julia\packages\JustSayIt\w35dO\src\shared.jl:440 [inlined]
[11] __init__()
@ JustSayIt C:\Users\timho\.julia\packages\JustSayIt\w35dO\src\shared.jl:25
[12] run_module_init(mod::Module, i::Int64)
@ Base .\loading.jl:1128
[13] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
@ Base .\loading.jl:1116
[14] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
@ Base .\loading.jl:1061
[15] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
@ Base .\loading.jl:1575
[16] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1932
[17] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1806
[18] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[19] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[20] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1797
[21] macro expansion
@ Base .\loading.jl:1784 [inlined]
[22] macro expansion
@ Base .\lock.jl:267 [inlined]
[23] __require(into::Module, mod::Symbol)
@ Base .\loading.jl:1747
[24] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[25] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[26] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1740
during initialization of module JustSayIt
caused by: PyError (PyImport_ImportModule
The Python package pywinctl could not be imported by pyimport. Usually this means
that you did not install pywinctl in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the pywinctl module, you can
use `pyimport_conda("pywinctl", PKG)`, where PKG is the Anaconda
package that contains the module pywinctl, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'pywinctl'")
Stacktrace:
[1] pyimport(name::String)
@ PyCall C:\Users\timho\.julia\packages\PyCall\1gn3u\src\PyCall.jl:558
[2] pyimport_pip(modulename::String; dependency::String, channel::String)
@ JustSayIt C:\Users\timho\.julia\packages\JustSayIt\w35dO\src\shared.jl:443
[3] pyimport_pip
@ JustSayIt C:\Users\timho\.julia\packages\JustSayIt\w35dO\src\shared.jl:440 [inlined]
[4] __init__()
@ JustSayIt C:\Users\timho\.julia\packages\JustSayIt\w35dO\src\shared.jl:25
[5] run_module_init(mod::Module, i::Int64)
@ Base .\loading.jl:1128
[6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
@ Base .\loading.jl:1116
[7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
@ Base .\loading.jl:1061
[8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
@ Base .\loading.jl:1575
[9] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1932
[10] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1806
[11] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[12] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[13] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1797
[14] macro expansion
@ Base .\loading.jl:1784 [inlined]
[15] macro expansion
@ Base .\lock.jl:267 [inlined]
[16] __require(into::Module, mod::Symbol)
@ Base .\loading.jl:1747
[17] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[18] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[19] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1740
julia> pyimport_conda("pywinctl", "pywinctl")
ERROR: UndefVarError: `pyimport_conda` not defined
Stacktrace:
[1] top-level scope
@ REPL[4]:1
I got the same error from Conda.add("pywinctl")
. (Julia packages are much easier to install than Python packages!!)
(Julia packages are much easier to install than Python packages!!) That's definitely very true!
That's very unfortunate that the same package causes also in windows a problem. pyimport_conda
is a function of the package PyCall
if you want to try the suggestion in the error message...
Concerning the error of the python package sounddevice
on Linux: maybe the installation of the dependency portaudio
, which is not a python dependency, was not successful. It should have been triggered here:
https://github.com/omlins/JustSayIt.jl/blob/main/src/shared.jl#L20
... and installed with conda as you can see here: https://github.com/omlins/JustSayIt.jl/blob/main/src/shared.jl#L440-L464
Maybe you can try to do these steps manually and see if this brings you further?
I am giving this exciting project a try, and getting this:
The error with
ENV
was just to show that nothing is defined forENV["PYTHON"]
. Also:This is on WSL.