Closed stuaxo closed 9 years ago
Last time I checked, the only thing missing from Numpypy was np.frombuffer
. When I replaced the buffer logic with strings, it worked. According to http://buildbot.pypy.org/numpy-status/latest.html that is supposed to work now.
Are you running the latest version of Numpypy? np.frombuffer
is apparently supported since 2.7.6.
Why are you using LC_ALL=C
?
If I don't use LC_ALL=C I get this weird error (maybe my setup though)
Command /mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/bin/pypy -c "import setuptools, tokenize;__file__='/mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/build/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-b1X3aP-record/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/include/site/python2.7 failed with error code 1 in /mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/build/numpy
Traceback (most recent call last):
File "app_main.py", line 75, in run_toplevel
File "/mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/bin/pip", line 11, in <module>
sys.exit(main())
File "/mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/site-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/site-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 72: ordinal not in range(128)
As I'm doing pip install -u pysoundcard
could it be trying to download numpy instead of using numpypy ?
Can you import numpy
in pypy? If so, the setup.py should do the right thing. If not, try changing
install_requires=['numpy',
'cffi>=0.6'],
into
install_requires=['numpypy',
'cffi>=0.6'],
It could also be worth trying to download pysoundcard and pypy setup.py install
directly instead of pip install pysoundcard
. That way, you would skip the pip
part of the installation, which is where your error message seems to originate from.
Alternatively, try import pysoundcard
as a simple file without installing it. This should skip any trouble with pip
or setuptools
. You need to have cffi
and numpy
installed for this.
I upgraded to pypy 2.4, created a new virtualenv with everything updated + installed pysoundcard by running setup.py install
in a checkout of pysoundcard - now I'm getting this, during a call to Stream .read
with Stream(sample_rate=44100, block_length=16) as s:
while self.quit is False:
vec = s.read(NUM_SAMPLES)
File "/usr/lib/pypy/lib-python/2.7/threading.py", line 806, in __bootstrap_inner
self.run()
File "shoebot_code", line 59, in run
File "/mnt/data/home/stu/.virtualenvs/shoebot-pgi-pypy/site-packages/PySoundCard-0.5.0-py2.7.egg/pysoundcard.py", line 612, in read
self._handle_error(_pa.Pa_ReadStream(self._stream, data, frames))
NameError: global name 'frames' is not defined
This is indeed a serious error in pysoundcard. I will fix it tomorrow and add a test case.
If you want to continue working right now, I suspect that line 612 of pysoundcard should say
self._handle_error(_pa.Pa_ReadStream(self._stream, data, num_frames)) # note the *num_*
BTW, Did num_frames used to be optional ? My older code seemed to just call stream.read() and was fine.
In other news, that works and my terrible music vis runs a lot faster in pypy.
http://imgur.com/a/EMZr8 < basic fft music vis, pysoundcard + shoebot :)
Indeed, num_frames
used to be optional. We figured that it doesn't make sense to read an arbitrary amount of frames though, in particular since read
and write
are supposed to work similar to the Posix functions.
If you disagree with this, we would be very interested in your opinion and reasoning, since this is very much open to discussion!
Anyway, great to see that PySoundCard works with Pypy! This is fantastic news, and something I have personally waited for quite a while! Also, cool visualization. I like it!
Hi, Any idea if this runs in pypy ?
I can install it (using LC_ALL=C pip install pysoundcard) but can't seem to sample any sound with it
Cheers S