# Module "pyo" in standalone 2023.2.0 on macOS

**URL:** <https://discourse.psychopy.org/t/module-pyo-in-standalone-2023-2-0-on-macos/36003>\
**Category:** Coding\
**Created:** [August 4, 2023, 1:52pm UTC](https://discourse.psychopy.org/t/module-pyo-in-standalone-2023-2-0-on-macos/36003 "2023-08-04T13:52:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maltemaxmoeller](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/maltemaxmoeller/32/4764_2.png) [@maltemaxmoeller](https://discourse.psychopy.org/u/maltemaxmoeller)\
**Post date:** [August 4, 2023, 1:52pm UTC](https://discourse.psychopy.org/t/module-pyo-in-standalone-2023-2-0-on-macos/36003/1 "2023-08-04T13:52:32Z")

</div>

Hi all,

I am running PsychoPy 2023.2.0 as standalone on a Mac M1 (macOS Ventura 13.5). I want to use the module _pyo_ in a project to send sounds to 1,2 or 3 out of 4 output channels. I am starting with the following code in the coder:

```auto
import pyo as pyoSound
pyoServer = pyoSound.Server()

```

Running `import pyo as pyoSound` runs without problems, suggesting that the module is installed. However, subsequently creating the sound server with `pyoServer = pyoSound.Server()` fails, returning the error message `AttributeError: module 'pyo' has no attribute 'Server'`.

Running the very same lines in e.g. PyCharm with Python 3.8.18 in a _pyenv_ with _pyo_ installed via _pip_ executes fine, showing _pyoServer_ as (`<pyo.lib.server.Server object at 0x100a5b4c0>)`.

Running:

```auto
import pyo
pyo

```

in the PsychoPy console returns `<module 'pyo' from '/Applications/PsychoPy.app/Contents/Resources/lib/python38.zip/pyo/ __init__.pyc'>`

I remember having problems with importing _pyo_ in previous versions of PsychoPy (something like 1.8.x, IIRC). Can someone point me into a direction here or has successfully used _pyo_ in a recent project (but not as sound backend)? Any pointers are very much appreciated!

Best,

Malte

---

<div class="post-metadata">

**Author:** ![TParsons](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/tparsons/32/8301_2.png) [@TParsons](https://discourse.psychopy.org/u/TParsons)\
**Post date:** [August 7, 2023, 8:27am UTC](https://discourse.psychopy.org/t/module-pyo-in-standalone-2023-2-0-on-macos/36003/2 "2023-08-07T08:27:51Z")

</div>

In 2023.1.0 we moved the pyo backend to a plugin, do you have `psychopy-pyo` installed? You can manage plugins from Builder via “Tools → Plugins/Packages manager…” in the menu bar. With that plugin you should just be able to use Sound components/stims and just set the backend, without worrying about directly interacting with pyo.

It could also be to do with the version of pyo installed, I’m not overly familiar with the module but could it be that Server has been moved/renamed between the version in your standalone install and the version in your venv install?

---

<div class="post-metadata">

**Author:** ![maltemaxmoeller](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/maltemaxmoeller/32/4764_2.png) [@maltemaxmoeller](https://discourse.psychopy.org/u/maltemaxmoeller)\
**Post date:** [August 25, 2023, 1:57pm UTC](https://discourse.psychopy.org/t/module-pyo-in-standalone-2023-2-0-on-macos/36003/3 "2023-08-25T13:57:36Z")

</div>

Hi and sorry for the late response. I just managed to post the question before my vacation.

Thanks for the information about the new way the backends are implemented in the current version of PsychoPy. Also pointing me towards the “Plugins/Packages manager” was great! Did not know about that. That is a great addition! That helped me with other things, but did to solve my current problem.

To provide some more background first: I do not want to use _pyo_ as a backend for the sound class, but instead play sound via its functions directly. A basic code snippet would look like this:

```auto
import pyo
pyoServer = pyo.Server(nchnls=2)
pyoServer.boot().start()
snd1 = pyo.SfPlayer(path="/sounds/440_Hz_500_ms.wav)
snd1.out(1)

```

The _pyo_ module is not listed in the “Packages” tab in the "Plugins/Packages manager, but could also not be installed via _pip_ or _file_ from there. The former stopped with an error:

```auto
      In file included from src/engine/ad_portaudio.c:21:
      include/ad_portaudio.h:24:10: fatal error: 'Python.h' file not found
      #include <Python.h>
               ^ ~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

```

Trying to install _pyo_ using **any** of the macOS files (downloaded from [pyo · PyPI](https://pypi.org/project/pyo/#files)) yielded the error:

```auto
ERROR: pyo-1.0.5-cp39-cp39-macosx_13_0_arm64.whl is not a supported wheel on this platform.

```

Out of curiosity, I tested the code snipped on our lab computers running the standalone on Windows 11 and it worked. Unfortunately, that seems to be a macOS problem. Still, I hope there will be a solution for that. I will continue testing and try to install the package directly and access the functions from within PsychoPy. I will post (hopefully) positive results :-). If there are any other ideas and/or solutions, please let me know.

Best,

Malte
