geertj/gruvi

missing pyuv.Stream

Ed-von-Schleck opened this issue · 9 comments

First off: Thanks for your work on this library! It looks just like what we need for our current project.

I've got a litte problem getting anything to work with it, though, including the provided examples: Any attempt to connect to anywhere fails with

  File "gruvi-example1.py", line 20, in <module>
    client.connect((url.hostname, port), ssl=is_ssl)
  File "/home/…/.virtualenvs/solute-pyramid/lib/python2.7/site-packages/gruvi/http.py", line 1032, in connect
    return super(HttpClient, self).connect(address, **kwargs)
  File "/home/…virtualenvs/solute-pyramid/lib/python2.7/site-packages/gruvi/endpoints.py", line 255, in connect
    @switchpoint
  File "/home/…virtualenvs/solute-pyramid/lib/python2.7/site-packages/gruvi/endpoints.py", line 265, in connect
    self._connection = create_connection(self._protocol_factory, address, **kwargs)
  File "/home/c…virtualenvs/solute-pyramid/lib/python2.7/site-packages/gruvi/endpoints.py", line 69, in create_connection
    family=0, flags=0, local_address=None, timeout=None, mode='rw'):
  File "/home/…virtualenvs/solute-pyramid/lib/python2.7/site-packages/gruvi/endpoints.py", line 171, in create_connection
    transport = Transport(handle, mode)
  File "/home/…virtualenvs/solute-pyramid/lib/python2.7/site-packages/gruvi/transports.py", line 168, in __init__
    if not isinstance(handle, pyuv.Stream):
AttributeError: 'module' object has no attribute 'Stream'

When directly importing pyuv, I don't see any pyuv.Stream (though I do see pyuv.TCP et al. just fine). The documentation of libuv doesn't mention Stream either.

I've installed both gruvi and pyuv via pip, without hickups of any sort.

Again, thanks for your work; I look forward to using this library extensively!

Hi, nice to hear from you.

The pyuv.Stream type was recently added to pyuv at the request of Gruvi. So I think it's likely that you have an older pyuv installed. Please make sure you have 1.0.0.dev1.

Also can you run the unit tests? Those should cover the stream functionality. Use these commands:

  python setup.py develop
  python runtests.py unit

I just cloned gruvi, made a brand new virtualenv, installed cffi with pip install cffi (because I was told to do so by next command), and did python setup.py develop. All is well so far, but the installed version of pyuv is 0.10.12 – relevant pip output:

Searching for pyuv==0.10.12
Best match: pyuv 0.10.12
Processing pyuv-0.10.12-py2.7-linux-x86_64.egg
pyuv 0.10.12 is already the active version in easy-install.pth

Using /home/…/.virtualenvs/gruvi/lib/python2.7/site-packages/pyuv-0.10.12-py2.7-linux-x86_64.egg

Then I ran the tests as you said with python runtests.py unit. The result is too long to post; the gist of it is FAILED (failures=5, errors=429).

I've tried to install pyuv with pip install pyuv==dev as they say in their docs, but pip can't find it on pypi.

Cloning pyuv and trying to build it doesn't work, neither does downloading the development zip from pyuv github and pip-installing it locally (some make error with `include/uv-dtrace.h', I haven't had the time to trace it any further).

If you could provide some hints on what to try next, I'd be really thankful – or should I try to poke the pyuv guys?

Many thanks in advance!

@Ed-von-Schleck hi! pyuv author here. What problem are you getting trying to compile the v1.x branch? I plan to make a 1.0.0 release soon.

Hey saghul, great to hear from you!

As mentioned earlier, this is on a clean python 2.7 virtualenv. This is what I get with a current check-out of pyuv from github:

$ ./build_inplace 
running build_ext
libuv needs to be compiled.
Building libuv...
error: Got return value 2 while executing "make", stderr output was:
make: *** [include/uv-dtrace.h] Fehler 1

I'm not sure if there's any dependencies I need to have installed; it does not seem to come with the download pyuv triggers when trying to install it for the first time:

$ ls deps/libuv/include/
android-ifaddrs.h  tree.h             uv-darwin.h        uv-linux.h         uv-unix.h          
pthread-fixes.h    uv-aix.h           uv-errno.h         uv-sunos.h         uv-version.h       
stdint-msvc2008.h  uv-bsd.h           uv.h               uv-threadpool.h    uv-win.h           

Can you try to buiild pyuv with --libuv-force-fetch --libuv-verbose-build ?

OK, this is strange: On my home computer I can build pyuv flawlessly. I'll get back to you when I'm at work again.

At work again; fresh checkout, no virtualenv. Here's what I got:

$ ./build_inplace --libuv-force-fetch --libuv-verbose-build
running build_ext
Downloading libuv...
Building libuv...
libtoolize: putting auxiliary files in `.'.
libtoolize: linking file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: linking file `m4/libtool.m4'
libtoolize: linking file `m4/ltoptions.m4'
libtoolize: linking file `m4/ltsugar.m4'
libtoolize: linking file `m4/ltversion.m4'
libtoolize: linking file `m4/lt~obsolete.m4'
+ libtoolize
+ aclocal -I m4
+ autoconf
+ automake --add-missing --copy
configure.ac:29: installing './ar-lib'
configure.ac:26: installing './compile'
configure.ac:22: installing './config.guess'
configure.ac:22: installing './config.sub'
configure.ac:21: installing './install-sh'
configure.ac:21: installing './missing'
Makefile.am: installing './depcomp'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes

[…snip more of the same…]

checking for _FILE_OFFSET_BITS value needed for large files... no
checking for dtrace... dtrace
checking if dtrace works... yes
checking if dtrace should instrument object files... yes
checking for pkg-config... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libuv.pc
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
  GEN      include/uv-dtrace.h
/usr/bin/dtrace invalid option -xnolibs
Usage /usr/bin/dtrace [--help] [-h | -G] [-C [-I<Path>]] -s File.d [-o <File>]
make: *** [include/uv-dtrace.h] Fehler 1
error: Got return value 2 while executing "make", stderr output was:
make: *** [include/uv-dtrace.h] Fehler 1

I'm on Fedora 20; this is what my package manager says is the dtrace version I'm using:

$ dnf provides "/usr/bin/dtrace"
systemtap-sdt-devel-2.6-2.fc20.x86_64 : Static probe support tools
Quelle      : @System

At home I use Fedora 21 beta.

I see that joyent/libuv#1478 deals with the same issue and is closed as resolved, but as I said: This is a fresh checkout and therefore should work, I guess.

@Ed-von-Schleck can you pull and rebuild (using --libuv-force-fetch) the pyuv v1.x branch? I just bumped the libuv revision, so the fix you referenced should now be included in the build.

The pyuv v1.x builds, and the gruvi tests run without error. Thanks a lot for your work, and thanks for being so responsive!