nomelif / Audionodes

Audio generation in blender nodes
Other
88 stars 10 forks source link

Installing PyAudio for py3.5 into Blender's python distribution #1

Closed zeffii closed 7 years ago

zeffii commented 7 years ago

i'm using the Python compiled with Blender, and win10 64bit

all i did was a python -m pip install pyaudio , into my local Python installation. Then copied these (or their *nix equivalent) files over into blender's python/lib/site-packages

python/lib/site-packages/PyAudio-0.2.9.dist-info/..
python/lib/site-packages/_portaudio.cp35-win_amd64.pyd
python/lib/site-packages/pyaudio.py
nomelif commented 7 years ago

This actually works?! I have been engineering mad science including patching pip into a live python with exec.

nomelif commented 7 years ago

Also, python/lib/site-packages (to my understanding) isn't writable with Blender installed as admin on Windozes. Am I right with that?

zeffii commented 7 years ago

i've never installed Blender with an installer, I use the portable zip and launch with a shortcut, but unless the user has the site-packages inside ProgramFiles, there should be no barrier to adding files to the Blender provided python/lib/site-packages directory.

nomelif commented 7 years ago

That is precisely where it is located. C:\Program Files\Blender Foundation\Blender\2.78\python\lib\site-packages to be exact.

zeffii commented 7 years ago

yikes.. of course it is ;(

nomelif commented 7 years ago

Ok, I consistently get this in my VM:

(Installed throuhg pip in a native install of python 3.5, copied over)

zeffii commented 7 years ago

ok, then on windows PyGame and PyAudio can be injected temporarily into sys.path. Wherever the user has their py35 distribution with those modules

import sys

local_py35_packages = r'C:\Users\zeffi\Anaconda3\Lib\site-packages`
if not local_py35_packages in sys.path:
    sys.path.append(local_py35_packages)

import pygame
import pyaudio
nomelif commented 7 years ago

That was what I was working on before. That seemed to function indeed, but orchestrating the baroque waltz of msi installers, pip installs and digging up of the paths takes some time. That also has the benefit of solving the writability problems.

nomelif commented 7 years ago

On the flip side:

image

I thought that worked. The os is a naked win 7 vm snapshotted on first boot. Installed Python and Blender, then installed pygame via pip.

The install worked out fine and everything seemed OK:

image

nomelif commented 7 years ago

My personal guess: Blender runs cp 3.5.1 and the installed python is cp 3.5.2. I will attempt to install cp 3.5.1, but that sounds quite far-fetched.

zeffii commented 7 years ago

I would not be surprised at all if that was the problem. mismatch dll versions...

zeffii commented 7 years ago

image

nomelif commented 7 years ago

What standalone python are you running?

zeffii commented 7 years ago

from anaconda3 64bit

C:\Program Files (x86)>python
Python 3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
nomelif commented 7 years ago

Wait? The thing works across 3.5.1 / 3.5.2 and CP / Anaconda?! DLL -problems don't really seem likely.

zeffii commented 7 years ago

and : http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame precompiled.. ?

zeffii commented 7 years ago

hope this isn't bogging you down, I think it should be up to the users to get the right version during early development, and lateron take more time to figure out easy installs.

nomelif commented 7 years ago

Pip on 3.5.1 fails to find pygame at all.

Well, if I can't set up the thing by hand, I guess having it work is a high priority.

zeffii commented 7 years ago

that's the pain of adding dependencies. thanks be to the blendergods that numpy is included :)

nomelif commented 7 years ago

Yep. Though including pip wouldn't hurt too much. Also, packaging the blender Python so that one can run it as python ....

zeffii commented 7 years ago

the pain is also a reason why we (sverchok) don't include any 3rd party stuff yet. hassle.

nomelif commented 7 years ago

Well, we are kind of cornered with sound-related stuff. Aud only lets you play an audio file written to disk by path as a string. Performance would be... interesting.

nomelif commented 7 years ago

The compiled package you pointed to:

image

Whatever that means, 32bit windows vm with 32 bit python 3.5.1

zeffii commented 7 years ago

and you win7 version is what? 32 bit ? are you sure? :)

nomelif commented 7 years ago

image

Pretty sure.

Would making a proposal for the inclusion of pip in Blender proper make sense? Getting numpy in was the fruit of such an action.

zeffii commented 7 years ago

oh.. >>> wmic os get osarchitecture

C:\Users\zeffi>wmic os get osarchitecture
OSArchitecture
64-bit
zeffii commented 7 years ago

can you install win32's python 3.5 anaconda on that image ?

nomelif commented 7 years ago

I am going to be afk for about 30min. I will try the Anaconda if you deem it useful. Also, is this a problem inherent to win32? I would be more than happy to drop it like a hot rock if that is what is needed.

zeffii commented 7 years ago

drop win32. can't support everything for everyone forever.

zeffii commented 7 years ago

Also, is this a problem inherent to win32?

I don't know for sure, but it seems plausable that this is localized to that module. Whereas the error does seems to crop up elsewhere.

nomelif commented 7 years ago

Ok, I am back. I will try to set up a x86_64 vm. The only moderately good thing to ever grow out of IE: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

nomelif commented 7 years ago

I will give win10 a try.

nomelif commented 7 years ago

By

Also, is this a problem inherent to win32?

I mean 32-bit windows, not the Python module.