Module sox not found

Hi
I’m still trying to get chatgpt working on my pidog.

It mostly works except that I am not getting any sound from the TTS . My speaker works perfectly for all the other examples, so there’s no issue there.

My dialog is as follows

sudo python gpt_dog.py
config_file: /home/robot/.config/pidog/pidog.conf
robot_hat init … done
imu_sh3001 init … done
rgb_strip init … done
dual_touch init … done
sound_direction init … done
sound_effect init … done
ultrasonic init … done
vilib 0.3.9 launching …
picamera2 0.3.22

Web display on:[0:01:40.180068931] [2520] ERROR IPAModule ipa_module.cpp:171 Symbol ipaModuleInfo not found
[0:01:40.180144820] [2520] ERROR IPAModule ipa_module.cpp:291 v4l2-compat.so: IPA module has no valid info

  http://192.168.4.198:9000/mjpg

Starting web streaming …

  • Serving Flask app ‘vilib.vilib’
  • Debug mode: off

listening …
stt takes: 4.913 s
1732786352.974 user >>> Good morning
1732786359.887 PiDog >>> {“actions”: [“wag_tail”], “answer”: “Good morning! What a fine day to be a Pidog in this lovely home!”}
chat takes: 6.914 s
actions or TTS error: No module named ‘sox’
listening …
^Ccamera close
Stopping and returning to the initial position …
^CPlease wait
Quit

Which suggests that sox is not installed however, if I then try to install sox, I see

(my_venv) robot@robot: $ pip install sox
Looking in indexes: Simple index, piwheels - Simple index
Requirement already satisfied: sox in /home/robot/my_venv/lib/python3.11/site-packages (1.5.0)
Requirement already satisfied: numpy>=1.9.0 in /usr/lib/python3/dist-packages (from sox) (1.24.2)
Requirement already satisfied: typing-extensions>=3.7.4.2 in /home/robot/my_venv/lib/python3.11/site-packages (from sox) (4.12.2)

Could you please advise?
I’m running

Linux robot 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux

Thanks

I’ve just tried to create a brand new venv, and re-installing the full AI code therein from scratch, I still get the same error.

I’ve also reinstalled the pidog code in case I’d got some old versions lyimg around. Same error. All other examples/basic_examples in this new area work fine

My best guess would be that the sox being installed was compiled for a different python version, but as others have got this working recently, that seems unlikely.

Solved.

I had different versions of sox (and openai) installed in my site packages directory and venv. The venv does not appear to have resolved this correctly.

I do not know why.

Clearly on a brand new install, this would not be a problem. It seems to be just my mix and match legacy.

I have updated both packages using --break-system-packages, not ideal! Therefore I am running all of my code (inc gpt_chat) outside of any venv.

However, so far, nothing on pidog or otherwise appears to be broken and gpt_chat now works with both text and microphone/speaker.

I will continue to run regression testing to be sure.

I do not recommend this solution though! and I am not 100% certain to have interpreted the errors correctly, but it now works.