conda-forge / portaudio-feedstock

A conda-smithy repository for portaudio.
BSD 3-Clause "New" or "Revised" License
2 stars 9 forks source link

ImportError/build error when using portaudio with pyaudio on Windows x64 #10

Closed aleneum closed 3 years ago

aleneum commented 5 years ago

I filed this issue previously at pyaudio-feedstock. Short summary: portaudio provided by conda-forge does not work for me on Windows (ImportError) and I can also not use it to build pyaudio (so far) due to missing headers.

Usage issue

As there is no conda-forge version of pyaudio, conda tries to install

  portaudio          conda-forge/win-64::portaudio-19.6.0-h6538335_2
  pyaudio            pkgs/main/win-64::pyaudio-0.2.11-py37hfa6e2cd_1

This installation causes and ImportError due to DLL loading failures:

>>> import pyaudio
...
# trying C:\Miniconda3-x64\envs\test-environment\lib\site-packages\_portaudio.cp37-win_amd64.pyd
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Miniconda3-x64\envs\test-environment\lib\site-packages\pyaudio.py", line 116, in <module>
    import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.

If I manually override portaudio with portaudio pkgs/main/win-64::portaudio-19.6.0-hfa6e2cd_3 pyaudio works (at least I can import it).

Build Issue

Now @ocefpaf suggested to add Windows support to the conda-forge recipe of pyaudio. I gave that a try and stumbled upon missing headers. The official portaudio package seems to install headers (e.g portaudio.h) into %CONDA%\envs\%ENV%\Library\include. I could not find these headers when installing portaudio from conda-forge.

Do you have any suggestions about how to make pyaudio work with portaudio on Windows? How do the portaudio packages in pkgs/main and conda-forge differ? What needs to be done to allow pyaudio to build with portaudio on Windows?

scopatz commented 5 years ago

Help is defintiely needed here!

traversaro commented 3 years ago

Not sure, but this could be related to the fact that portaudio in this recipe is built with msys2, while Python and most of C++ libraries on Windows in conda-forge are built with the MSVC toolchain?

traversaro commented 3 years ago

Not sure, but this could be related to the fact that portaudio in this recipe is built with msys2, while Python and most of C++ libraries on Windows in conda-forge are built with the MSVC toolchain?

If maintainers @conda-forge/portaudio agree, I would be happy to provide a PR to compile portaudio for MSVC.

traversaro commented 3 years ago

At a first glance, https://github.com/conda-forge/pyaudio-feedstock seems to be the only conda-forge package that depends on portaudio on Windows, so I think this change is probably safe.

ocefpaf commented 3 years ago

If maintainers @conda-forge/portaudio agree, I would be happy to provide a PR to compile portaudio for MSVC.

Yep please! BTW, if you want, add yourself as a maintainer too!

NihaLRekatla commented 2 years ago

image

Hey im getting this error pls help me! i have aldready installed pyaudio