intxcc/pyaudio_portaudio

Can build it for 32bit environment

Vonham opened this issue · 14 comments

Hello, I love your work. Thank you for sharing
Can I build this for 32bit env?

I would like to build it for 32bit as well. Trying to figure out what that involves

Everything seems to be working for 32bit, the only change I needed to make was in setup.py
Around line 80 I changed the extra_link_args to also look at the Win32 portaudio lib as follows
```
bits = platform.architecture()[0]
elif '64' in bits:
extra_link_args.append(os.path.join(portaudio_path, 'build/msvc/x64/Release/portaudio.lib'))
else:
extra_link_args.append(os.path.join(portaudio_path, 'build/msvc/Win32/Release/portaudio.lib'))


after that I could build it in Win32 with setup.py, and then I ran setup.py install --skip-build

Merged your code. I can't verify it, but the code looks plausible.
Commit: fc19193

Everything seems to be working for 32bit, the only change I needed to make was in setup.py
Around line 80 I changed the extra_link_args to also look at the Win32 portaudio lib as follows

**bits = platform.architecture()[0]**
**elif '64' in bits**:
extra_link_args.append(os.path.join(portaudio_path, 'build/msvc/x64/Release/portaudio.lib'))
**else: extra_link_args.append(os.path.join(portaudio_path, 'build/msvc/Win32/Release/portaudio.lib'))**

after that I could build it in Win32 with setup.py, and then I ran setup.py install --skip-build

可用!!!
不过会出现ImportError: DLL load failed问题,将portaudio_x86.dll文件copy到你的python37-32的安装目录地下“lib/site-pakages/PyAudio-0.2.11-py3.7-win32.egg”即可。

Hi @YuHuangqi could you please write your comment in english, as I am sadly not able to read chinese. Otherwise I won't be able to help if you experience problems with this fork.

Thank you.

Hi @YuHuangqi could you please write your comment in english, as I am sadly not able to read chinese. Otherwise I won't be able to help if you experience problems with this fork.

Thank you.

English version:
It works!!!
But it may prompt "ImportError: DLL load failed" error. In order to fix this issue, should copy portaudio_x86.dll to “lib/site-pakages/PyAudio-0.2.11-py3.7-win32.egg” which is under your python37-32 installation directory.

My words:
I hope you can understand my English version. I am going to install x86 32bit version, hope it works. Have a good day.

@lxu0118
Thank for your translation!

Can anyone please provide detailed information on how to proceed to install for 32 bit? I am having issues attempting to install it.

Thanks!

VS2019 32-bit Instructions. I made PR for this, but in the meantime, you can follow the readme here https://github.com/elibroftw/pyaudio_portaudio

Here's the Python 3.8 32-bit version https://github.com/elibroftw/music-caster/blob/master/build_files/PyAudio-0.2.11-cp38-cp38-win32.whl

@ntpincus @intxcc Sorry for digging in an old thread, but any chance you have a pre-compiled wheel for Py37 on 32 bit? I would appreciate any help or suggestion :)

@ntpincus @intxcc Sorry for digging in an old thread, but any chance you have a pre-compiled wheel for Py37 on 32 bit? I would appreciate any help or suggestion :)

I wrote the instructions above. Just follow them. I have the py38 32bit wheel if you need it (the link above your reply).
I'm going to fork and make a PR.

@elibroftw Appreciate your response. I actually know how to build a wheel. I'm just very low on storage on my laptop (a notebook, to be precise). Installing VS alongside C++ build tools and Windows 10 SDK would take up around 6 GB of space (excluding VS, the IDE). I don't have that much space :( . I only need either PyAudio wheel for my system or any other forked project to get mic input.

@pssolanki111 for the past hour I tried to create a Github actions but I got to the msbuild part where I ran into some issues on how the linking works. How I compiled the wheel for 32 bit is by dynamic linking but for msbuild to work I need static linking but then the setup.py doesn't work. I tried my best but if you really can't spare the storage and you need this, you'll have to create a Github workflow yourself.

@elibroftw hmm. Well thank you for giving it a try. I haven't worked with Github Workflows before, but I'll try to pick it up on the fly.