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

Not working for !Ubuntu linux #103

Closed
mysticaltech opened this issue Mar 22, 2024 · 25 comments
Closed

Not working for !Ubuntu linux #103

mysticaltech opened this issue Mar 22, 2024 · 25 comments

Comments

@mysticaltech
Copy link

mysticaltech commented Mar 22, 2024

Describe the bug
Errors when running both server and client on linux.

01 --server

➜ 01 --server                


○                                                                                                                                                                            

Starting...                                                                                                                                                                  


INFO:     Started server process [247252]
INFO:     Waiting for application startup.
Task exception was never retrieved
future: <Task finished name='Task-6' coro=<put_kernel_messages_into_queue() done, defined at /home/karim/01/lib/python3.11/site-packages/01OS/server/utils/kernel.py:58> exception=FileNotFoundError(2, 'No such file or directory')>
Traceback (most recent call last):
  File "/home/karim/01/lib/python3.11/site-packages/01OS/server/utils/kernel.py", line 60, in put_kernel_messages_into_queue
    text = check_filtered_kernel()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/karim/01/lib/python3.11/site-packages/01OS/server/utils/kernel.py", line 47, in check_filtered_kernel
    messages = get_kernel_messages()
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/karim/01/lib/python3.11/site-packages/01OS/server/utils/kernel.py", line 23, in get_kernel_messages
    with open('/var/log/dmesg', 'r') as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/log/dmesg'


Ready.                                                                                                                                                                       


INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

01 --client

➜ 01 --client
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/karim/01/lib/python3.11/site-packages/start.py:84 in run                                   │
│                                                                                                  │
│   81 │   │   │   │   except FileNotFoundError:                                                   │
│   82 │   │   │   │   │   client_type = "linux"                                                   │
│   83 │   │                                                                                       │
│ ❱ 84 │   │   module = importlib.import_module(f".clients.{client_type}.device", package='01OS    │
│   85 │   │   client_thread = threading.Thread(target=module.main, args=[server_url])             │
│   86 │   │   client_thread.start()                                                               │
│   87                                                                                             │
│                                                                                                  │
│ ╭──────────────────────────────────── locals ────────────────────────────────────╮               │
│ │                 client = True                                                  │               │
│ │            client_type = 'linux'                                               │               │
│ │         context_window = 2048                                                  │               │
│ │                 expose = False                                                 │               │
│ │            handle_exit = <function run.<locals>.handle_exit at 0x7f5cfe207600> │               │
│ │            llm_service = 'litellm'                                             │               │
│ │ llm_supports_functions = False                                                 │               │
│ │    llm_supports_vision = False                                                 │               │
│ │                  local = False                                                 │               │
│ │             max_tokens = 4096                                                  │               │
│ │                  model = 'gpt-4'                                               │               │
│ │                 server = False                                                 │               │
│ │            server_host = '0.0.0.0'                                             │               │
│ │            server_port = 8000                                                  │               │
│ │             server_url = '0.0.0.0:8000'                                        │               │
│ │            stt_service = 'openai'                                              │               │
│ │            system_type = 'Linux'                                               │               │
│ │            temperature = 0.8                                                   │               │
│ │            tts_service = 'openai'                                              │               │
│ │         tunnel_service = 'bore'                                                │               │
│ ╰────────────────────────────────────────────────────────────────────────────────╯               │
│                                                                                                  │
│ /home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/importlib/__init__.py:126 in           │
│ import_module                                                                                    │
│                                                                                                  │
│   123 │   │   │   if character != '.':                                                           │
│   124 │   │   │   │   break                                                                      │
│   125 │   │   │   level += 1                                                                     │
│ ❱ 126 │   return _bootstrap._gcd_import(name[level:], package, level)                            │
│   127                                                                                            │
│   128                                                                                            │
│   129 _RELOADING = {}                                                                            │
│                                                                                                  │
│ ╭────────────── locals ───────────────╮                                                          │
│ │ character = 'c'                     │                                                          │
│ │     level = 1                       │                                                          │
│ │      name = '.clients.linux.device' │                                                          │
│ │   package = '01OS'                  │                                                          │
│ ╰─────────────────────────────────────╯                                                          │
│ in _gcd_import:1204                                                                              │
│ ╭─────────────── locals ────────────────╮                                                        │
│ │   level = 1                           │                                                        │
│ │    name = '01OS.clients.linux.device' │                                                        │
│ │ package = '01OS'                      │                                                        │
│ ╰───────────────────────────────────────╯                                                        │
│ in _find_and_load:1176                                                                           │
│ ╭────────────────────── locals ──────────────────────╮                                           │
│ │ import_ = <function _gcd_import at 0x7f5cff94fd80> │                                           │
│ │  module = <object object at 0x7f5cff984050>        │                                           │
│ │    name = '01OS.clients.linux.device'              │                                           │
│ ╰────────────────────────────────────────────────────╯                                           │
│ in _find_and_load_unlocked:1126                                                                  │
│ ╭──────────────────────── locals ────────────────────────╮                                       │
│ │     import_ = <function _gcd_import at 0x7f5cff94fd80> │                                       │
│ │        name = '01OS.clients.linux.device'              │                                       │
│ │      parent = '01OS.clients.linux'                     │                                       │
│ │ parent_spec = None                                     │                                       │
│ │        path = None                                     │                                       │
│ ╰────────────────────────────────────────────────────────╯                                       │
│ in _call_with_frames_removed:241                                                                 │
│ ╭──────────────────── locals ─────────────────────╮                                              │
│ │ args = ('01OS.clients.linux',)                  │                                              │
│ │    f = <function _gcd_import at 0x7f5cff94fd80> │                                              │
│ │ kwds = {}                                       │                                              │
│ ╰─────────────────────────────────────────────────╯                                              │
│ in _gcd_import:1204                                                                              │
│ ╭──────────── locals ────────────╮                                                               │
│ │   level = 0                    │                                                               │
│ │    name = '01OS.clients.linux' │                                                               │
│ │ package = None                 │                                                               │
│ ╰────────────────────────────────╯                                                               │
│ in _find_and_load:1176                                                                           │
│ ╭────────────────────── locals ──────────────────────╮                                           │
│ │ import_ = <function _gcd_import at 0x7f5cff94fd80> │                                           │
│ │  module = <object object at 0x7f5cff984050>        │                                           │
│ │    name = '01OS.clients.linux'                     │                                           │
│ ╰────────────────────────────────────────────────────╯                                           │
│ in _find_and_load_unlocked:1140                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │         child = 'linux'                                                                      │ │
│ │       import_ = <function _gcd_import at 0x7f5cff94fd80>                                     │ │
│ │          name = '01OS.clients.linux'                                                         │ │
│ │        parent = '01OS.clients'                                                               │ │
│ │ parent_module = <module '01OS.clients' from                                                  │ │
│ │                 '/home/karim/01/lib/python3.11/site-packages/01OS/clients/__init__.py'>      │ │
│ │   parent_spec = ModuleSpec(name='01OS.clients',                                              │ │
│ │                 loader=<_frozen_importlib_external.SourceFileLoader object at                │ │
│ │                 0x7f5cfe21d950>,                                                             │ │
│ │                 origin='/home/karim/01/lib/python3.11/site-packages/01OS/clients/__init__.p… │ │
│ │                 submodule_search_locations=['/home/karim/01/lib/python3.11/site-packages/01… │ │
│ │          path = ['/home/karim/01/lib/python3.11/site-packages/01OS/clients']                 │ │
│ │          spec = None                                                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named '01OS.clients.linux'

To Reproduce
Steps to reproduce the behavior:
On Fedora 39 latest (same one used by Linus Torvalds):

  1. Get the needed packages: sudo dnf install portaudio-devel ffmpeg cmake
  2. Create a python 3.11 env, as default is 3.12 and activate it: python3.11 -m venv 01 and source 01/bin/activate
  3. Prepare to install, as gcc is version 13, this is needed sudo ln -s $(which gcc) /usr/local/bin/gcc-11 also export CC=gcc and export CCACHE_DISABLE=1
  4. Install 01: pip install 01OS, this should complete successfully.
  5. Run the client and run the server to see the above errors.

Expected behavior
Both client and server should work when they are run.

Screenshots
(Same as the above errors)

Desktop (please complete the following information):

  • OS: Linux 6.7.9-200.fc39.x86_64 (Fedora 39 Gnome, wayland)
  • Python Version 3.11.8

Additional context
So impatient to try it!

@mysticaltech
Copy link
Author

mysticaltech commented Mar 22, 2024

The best way to try and debug this IMHO is via setting up a Fedora VM, from any OS. Just use the default Fedora Workstation version, no changes, vanilla. You can get the images here: https://fedoraproject.org/workstation/download

You can use VirtualBox or other, the setup should be fast enough, less than third minutes to get going. https://www.virtualbox.org/

And my instructions to reproduce should be clear. I have included all steps.

@0xSt1ng3R
Copy link

0xSt1ng3R commented Mar 23, 2024

same client error in wsl - clean ubuntu 22.04.3 and 3.11.5.
server running w/o problem.

@mysticaltech mysticaltech changed the title Not running on Fedora Linux Not running on Linux Mar 24, 2024
@akashkuttappa
Copy link

While I was initially facing the same issue on Raspberry Pi OS, I later switched to Ubuntu 23.10 and was able to get both the Server and Client running fine. Faced other ALSA errors but I was able to get past them and now I'm able to interface both ways.

image

@mysticaltech
Copy link
Author

Thanks for sharing @akashkuttappa, so that issue seems more for non-Ubuntu, probably non-Debian based linux.

@mysticaltech mysticaltech changed the title Not running on Linux Not running on !Ubuntu Linux Mar 25, 2024
@kill136
Copy link

kill136 commented Mar 27, 2024

i run success but i do not known how to talk to o1? where can i input text to chat it?
1711551497744

@hpsaturn
Copy link
Contributor

hpsaturn commented Mar 28, 2024

I have a similar issue. I'm using Llama2 and running it locally with poetry run 01 --local, and is detected my spacebar, but I have maybe a ALSA issue:

Starting...                                                                                                                                                                                    



▌ 01 is compatible with several local model providers.                                                                                                                                       

[?] Which one would you like to use?: 
 > Ollama
   LM Studio

1 Ollama model found. To download a new model, run ollama run <model-name>, then start a new 01 session.                                                                                       

For a full list of downloadable models, check out https://ollama.com/library                                                                                                                   

[?] Select a downloaded Ollama model: 
 > llama2


Using Ollama model: llama2                                                                                                                                                                     

Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/avp/tmp/src/openia_01/software/source/server/server.py", line 413, in main
    service_instance = ServiceClass(config)
  File "/home/avp/tmp/src/openia_01/software/source/server/services/tts/piper/tts.py", line 13, in __init__
    self.install(config["service_directory"])
  File "/home/avp/tmp/src/openia_01/software/source/server/services/tts/piper/tts.py", line 64, in install
    urllib.request.urlretrieve(asset_url, os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME))
UnboundLocalError: local variable 'asset_url' referenced before assignment
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
Recording started...
Recording stopped.
Recording started...
Recording stopped.

My OS:

Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11

@hpsaturn
Copy link
Contributor

the "assert_url" issue was fixed with the PR #175 in my Debian, but now I have the next error:

Starting...                                                                                                                                                                              


ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
INFO:     Started server process [2556990]
INFO:     Waiting for application startup.
Task exception was never retrieved
future: <Task finished name='Task-6' coro=<put_kernel_messages_into_queue() done, defined at /home/avp/tmp/src/openia_01/software/source/server/utils/kernel.py:63> exception=FileNotFoundError(2, 'No such file or directory')>
Traceback (most recent call last):
  File "/home/avp/tmp/src/openia_01/software/source/server/utils/kernel.py", line 65, in put_kernel_messages_into_queue
    text = check_filtered_kernel()
  File "/home/avp/tmp/src/openia_01/software/source/server/utils/kernel.py", line 47, in check_filtered_kernel
    messages = get_kernel_messages()
  File "/home/avp/tmp/src/openia_01/software/source/server/utils/kernel.py", line 23, in get_kernel_messages
    with open('/var/log/dmesg', 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/var/log/dmesg'


Ready.                                                                                                                                                                                   


INFO:     Application startup complete.

@hpsaturn
Copy link
Contributor

With a simple touch a fixed the issue:

sudo touch /var/log/dmesg

Well, now is only missing the ALSA issue.. I'm close..

This was referenced Mar 29, 2024
@rbrisita
Copy link
Contributor

rbrisita commented Apr 4, 2024

I am looking into the /var/log/dmesg issue.

@rbrisita
Copy link
Contributor

rbrisita commented Apr 4, 2024

While I was initially facing the same issue on Raspberry Pi OS, I later switched to Ubuntu 23.10 and was able to get both the Server and Client running fine. Faced other ALSA errors but I was able to get past them and now I'm able to interface both ways.

image

How did you get past the ALSA issues?

@rbrisita
Copy link
Contributor

rbrisita commented Apr 4, 2024

@mysticaltech Could you please rename this issue in regard to accessing /var/log/dmesg. Maybe "Accessing dmesg in Linux"?

@rbrisita
Copy link
Contributor

rbrisita commented Apr 4, 2024

The issue here is that software\source\server\utils\kernel.py function get_kernel_messages is trying to access a file that doesn't exist. Unfortunately, similar logs like /var/log/syslog and /var/log/kern.log have access restrictions. This is a security concern.

To resolve this issue without any code changes run this command and change the access to the file:

sudo touch /var/log/dmesg
sudo chmod go+w /var/log/dmesg
sudo dmesg --follow > /var/log/dmesg &

@mysticaltech
Copy link
Author

mysticaltech commented Apr 4, 2024

@rbrisita But it's not just this, there is an issue for both client and server.

Edit: Just did the rename

@mysticaltech mysticaltech changed the title Not running on !Ubuntu Linux Accessing dmesg in Linux Apr 4, 2024
@rbrisita
Copy link
Contributor

rbrisita commented Apr 4, 2024

Ah, I see... sorry I just saw the dmesg thing becuase that was the error I was having. In regards to your other errors, I believe it has to do with your OS and Python version:

OS: Linux 6.7.9-200.fc39.x86_64 (Fedora 39 Gnome, wayland)
Python Version 3.11.8

Please see issue #219.

@rbrisita
Copy link
Contributor

rbrisita commented Apr 4, 2024

Proposed PR solution:

  1. Test for the existence of binary dmesg
  2. Pipe dmesg to /tmp/dmesg
  3. Return the path /tmp/dmesg to be used in get_kernel_messages function or None

Any input from team members would be appreciated.

@mysticaltech
Copy link
Author

mysticaltech commented Apr 5, 2024

To resolve this issue without any code changes run this command and change the access to the file:

sudo touch /var/log/dmesg
sudo chmod go+w /var/log/dmesg
sudo dmesg --follow > /var/log/dmesg &

Before the above, I also fixed my PATH env variable to pickup dmesg from the OS directly and not brew.

And the commands above did the trick! 🫡

Screenshot from 2024-04-05 02-50-01

@mysticaltech
Copy link
Author

mysticaltech commented Apr 5, 2024

Thanks @rbrisita! So server fixed! Now for the client, please see my response on the other issue. The client still does not work even when using Xorg in place of Wayland, same error ModuleNotFoundError: No module named '01OS.clients.linux'.

@mysticaltech mysticaltech changed the title Accessing dmesg in Linux Not working for !Ubuntu linux Apr 5, 2024
@mysticaltech
Copy link
Author

mysticaltech commented Apr 5, 2024

Also just for clarification, that needs to be run everytime before starting the server correct? sudo dmesg --follow > /var/log/dmesg &

@mysticaltech
Copy link
Author

@rbrisita Progress not perfection. So cloning the project directly, I have been able to get much farther after your above recommendations. Now it's an Alsa issue. Fedora uses pipewire, and Alsa is also installed, but does not seem to work.

03:23:47 in 01/software on  main via 01os-O75aX4we-py3.10 
➜ poetry run 01                                   


○                                                                                                                           

Starting...                                                                                                                 


INFO:     Started server process [28795]
INFO:     Waiting for application startup.


Ready.                                                                                                                      


INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10001 (Press CTRL+C to quit)
ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pipewire.so (/home/linuxbrew/.linuxbrew/Cellar/alsa-lib/1.2.11/lib/alsa-lib/libasound_module_pcm_pipewire.so: cannot open shared object file: No such file or directory)
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pipewire.so (/home/linuxbrew/.linuxbrew/Cellar/alsa-lib/1.2.11/lib/alsa-lib/libasound_module_pcm_pipewire.so: cannot open shared object file: No such file or directory)
ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pipewire.so (/home/linuxbrew/.linuxbrew/Cellar/alsa-lib/1.2.11/lib/alsa-lib/libasound_module_pcm_pipewire.so: cannot open shared object file: No such file or directory)
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pipewire.so (/home/linuxbrew/.linuxbrew/Cellar/alsa-lib/1.2.11/lib/alsa-lib/libasound_module_pcm_pipewire.so: cannot open shared object file: No such file or directory)
INFO:     ('127.0.0.1', 37364) - "WebSocket /" [accepted]

Hold the spacebar to start recording. Press CTRL-C to exit.INFO:     connection open

 Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2050
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2721
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2845
Exception in thread Thread-11 (record_audio):
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/karim/code/01/software/source/clients/base_device.py", line 157, in record_audio
    stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK)
  File "/home/karim/.cache/pypoetry/virtualenvs/01os-O75aX4we-py3.10/lib/python3.10/site-packages/pyaudio/__init__.py", line 639, in open
    stream = PyAudio.Stream(self, *args, **kwargs)
  File "/home/karim/.cache/pypoetry/virtualenvs/01os-O75aX4we-py3.10/lib/python3.10/site-packages/pyaudio/__init__.py", line 441, in __init__
    self._stream = pa.open(**arguments)
OSError: [Errno -9997] Invalid sample rate

@mysticaltech
Copy link
Author

Ok, so I had alsa-lib installed via brew too. So removed that via brew uninstall alsa-lib gource openapi-generator openjdk openjdk@11 pulseaudio sdl2 sdl2_image and it seems to be working way better now. Will play with it and confirm or deny soon.

03:35:28 in 01/software on  main 
➜ poetry run 01                                                                                 


○                                                                                                                           

Starting...                                                                                                                 


INFO:     Started server process [132777]
INFO:     Waiting for application startup.


Ready.                                                                                                                      


INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10001 (Press CTRL+C to quit)
ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib confmisc.c:1377:(snd_func_refer) Unable to find definition 'cards.0.pcm.modem.0:CARD=0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave
INFO:     ('127.0.0.1', 48382) - "WebSocket /" [accepted]

Hold the spacebar to start recording. Press CTRL-C to exit.
INFO:     connection open
 Recording started...
Recording stopped.
 Recording started...
                                  Recording stopped.
audio/wav /tmp/input_20240405033602788720.wav /tmp/output_20240405033602788879.wav
>  Test one two test one

                                                                                                                            
  I'm here and ready to assist! How can I help you today?                                                                   
                                                                                                                            
  Let me know what you'd like to do next.                                                                                   
                                                                                                                            
 Recording started...
                                                                                                                                                                                                                                                        Recording stopped.
audio/wav /tmp/input_20240405033628071344.wav /tmp/output_20240405033628071920.wav
>  okay please I would like to open a browser with Google loaded

                                                                                                                            
  Sure, let me open it for you.                                                                                             
                                                                                                                            


                                                                                                                            
  computer.browser.open("https://www.google.com")            

@mysticaltech
Copy link
Author

mysticaltech commented Apr 5, 2024

Ok, so getting better. I can talk, some errors some time, but it seems to be working more or less. Note that, I needed to use:

sudo dnf install python3.10 python3.10-devel python3.10-tkinter
poetry env use /usr/bin/python3.10

The only thing, is that now I cannot open a browser, it gives me the following:

  AttributeError                            Traceback (most recent call last)                                              
  Cell In[49], line 2                                                                                                      
        1 print('##active_line1##')                                                                                        
  ----> 2 computer.browser.visit('https://www.google.com')                                                                
                                                                                                                           
  AttributeError: 'Browser' object has no attribute 'visit'    

Any ideas on how to fix this?

@mysticaltech
Copy link
Author

mysticaltech commented Apr 5, 2024

It's working for me now, not the mac experience yet, but it's working. Freezes sometimes, and does not seem to be able to do everything, but am sure it will improve with time. So closing this issue for now.

@rbrisita Thanks again for the unlock, really appreciate it.

@rbrisita
Copy link
Contributor

rbrisita commented Apr 5, 2024

Great to hear that you made so much progress!

Will look into what you did with the ALSA issue and hopefully that works for me.

And yes, you should run sudo dmesg --follow > /var/log/dmesg & each time you reboot the computer or exit the job. Could be automated but this should be a temporary fix as it is a security concern overall. Will create a new issue with my proposed code solution.

@rbrisita
Copy link
Contributor

rbrisita commented Apr 5, 2024

I got a clean boot of 01OS! It responded in Arabic at first but then I told it not to and it fixed itself. Lol, a surprise. 🤯

Found a way to resolve the ALSA errors: #138 (comment)

Also, I realized that you don't have to run sudo dmesg --follow > /var/log/dmesg & each time, just the existence of it works but it isn't getting updated because it stops in the background. I'll resolve this later and update this issue.

@rbrisita
Copy link
Contributor

Created this PR #239.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants