hobuinc/laz-perf

Issue with Python package 0.0.9 from pypi

elemoine opened this issue · 3 comments

I just installed lazperf 0.0.9 from pypi in an isolated virtual env, and import lazperf fails:

(lazperf) [hookipa lopocs (refacto *%)]$ python -c 'import lazperf'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/elemoine/.virtualenvs/lazperf/lib/python3.5/site-packages/lazperf/__init__.py", line 2, in <module>
    from .pylazperfapi import PyDecompressor as Decompressor
ImportError: No module named 'lazperf.pylazperfapi

Is this a known issue?

I use Python 3.5.3 on Debian Sid.

hobu commented

I may have done the relative imports incorrectly? I never did do any virtual env thing with them.

Also, I would build from source in ./python rather than take anything from PyPI at this time.

I found the issue. It is not related to virtualenv. It is related to cython and whether cython was available at the time you installed lazperf the first time.

If cython isn't installed when you install lazperf the first time then a non-functional wheel, which misses the pylazperfapi.cpython.so file, will be created and cached in .cache/pip (~/Library/Caches/pip/wheels on OSX). If cypthon is installed when installing lazperf the first time then the generated and cached wheel wil include the pylazperfapi.cpython.so file.

So the issue is that the lazperf setup.py script does not fail when cython is not installed. It seems to me that cython is required for lazperf, so the setup.py script should probably stop and generate an error when cython is not available.

Here is a gist that shows what works and what does not work: https://gist.github.com/elemoine/89bf051656957f491976b66174ebd62c.

The conclusion is that it does not work when pip creates a wheel using setup.py bdist_wheel.