I have a "core.so" in my site-packages/gevent directory, but I don't
have a "core.py." Am I supposed to?
Check for directories named "gevent" on your filesystem, you'll
probably find one that does not have core.so file.
No, core.so is the right one.
CentOS 5.0 (i686), Python 2.4.3
CentOS 5.2 (i686), Python 2.6.2
CentOS 5.2 (x64), Python 2.6.4
They all fail. CentOS ships with libevent 1.1a, however I couldn't
even get gevent to build correctly using that version. I uninstalled
1.1a using my package manager, downloaded libevent 1.4.13, and
compiled it from source. Gevent now builds correctly, but on every
system I've tried, the import simply does not work.
On Feb 20, 11:05 pm, Denis Bilenko <denis.bile...@gmail.com> wrote:
> It's probably because you have an incomplete installation somewhere on
> PYTHONPATH.
>
> Check for directories named "gevent" on your filesystem, you'll
> probably find one that does not have core.so file.
>
-Bob
On Feb 21, 1:10 am, Bob Van Zant <b...@veznat.com> wrote:
> My favorite way to get the ImportError for core is to run python and then
> try an import gevent from the build directory. This doesn't work. A cd ..
> Always works for me. Trivial, I know, but I've seen it happen to a co-worker
> as well.
>
> -Bob
>
Any idea how to prevent this from happening?
One thing that comes to mind is to catch that ImportError and re-raise
it with a more
helpful message.
I'm not quite sure how to make it work. I use setuptools for my Cython
modules and then I get the 'develop' option which makes this use case work
(it drops the .so in the source directory). I wouldn't recommend setuptools
for a project like this since it's yet another dependency and they aren't
super friendly to cython (vs. pyrex) just yet.
To force python to use the one in site-packages you could rename the gevent
directory to like 'src' or something. Then map it in the call to setup()
with a package_dir={'gevent', 'src'}. Unfortunately this doesn't feel very
pythonic. I tried this out and it does solve our problem. In addition to
that package_dir karg to setup() there are two places in setup.py that
explicitly reference the gevent/ directory that need to be changed. Not
worth sending a patch though.
-Bob
I don't use setuptools, but I do have a symlink from buid/core.so to
gevent/core.so
which has the same effect as setuptools' "develop". I setup PYTHONPATH
to point to the development version of gevent and use it without installing it.
>
> To force python to use the one in site-packages you could rename the gevent
> directory to like 'src' or something. Then map it in the call to setup()
> with a package_dir={'gevent', 'src'}. Unfortunately this doesn't feel very
> pythonic. I tried this out and it does solve our problem. In addition to
> that package_dir karg to setup() there are two places in setup.py that
> explicitly reference the gevent/ directory that need to be changed. Not
> worth sending a patch though.
That's an interesting idea. Unfortunately it breaks the workflow I
described above.
That is, using gevent from working directory rather than from
site-packages becomes
not possible with this.
Maybe hack "./setup.py build" to drop symlink of build/core.so to
gevent/core.so
automatically?
Denis.
> Maybe hack "./setup.py build" to drop symlink of build/core.so to
> gevent/core.so
> automatically?
I think that will work. I hesitate to put even more junk into gevent's
setup.py but this might be a worthwhile hack. I manually do something
similar to this for some other package I work on.
I went to PyCon this past weekend and attended at least one talk that
covered python packaging. I walked away with the impression that python
packaging is fundamentally broken and not getting fixed anytime soon. Total
bummer.
-Bob
Here's a patch: http://bitbucket.org/denis/gevent/changeset/db27d72a78af/
Please verify that it does not break setup.py in some other way.
Cheers,
Denis.
core.so ->
/data/crap/xsa_dependencies/gevent-0.12.0/build/lib.linux-x86_64-2.6/gevent/
core.so
-Bob
> I don't use setuptools, but I do have a symlink from buid/core.so to
> gevent/core.so
> which has the same effect as setuptools' "develop".
just a quick tip: You could also run python setup.py build_ext --inplace.
Wow, that's... Amazing. I had no idea. Thanks for that.
-L