I'm trying to put together my first PyPi package and am growing confused about some basic aspects of it.
My package depends on SNPknock
. When I try to install it on a fresh system (Ubuntu 18.04), I get:
pip install snpknock
Collecting snpknock
Using cached https://files.pythonhosted.org/packages/68/a0/ceb6adc2b7f1a3009f2077c157a99640094021a66f881cb678ecf4
78887f/SNPknock-0.5.2.tar.gz
Complete output from command python setup.py egg_info:
You don't seem to have Cython installed. Please get a
copy from www.cython.org and install it
I've extracted the setup.py
from the tarball here, which includes that error message.
Here is my confusion. The setup.py
file specifies Cython as a dependency:
DEPENDENCIES = ['Cython>='+CYTHON_MIN_VERSION,
'numpy>='+NUMPY_MIN_VERSION]
However, it also imports Cython, but it seems that it needs to do that in order to cythonize some modules. It all seems a little circular, but I suspect that either I (or the author of this package) are missing something about this process.
The problem seems to be there are no wheels/eggs for you platform. In that case pip
downloads sources and runs python setup.py install
. If setup.py
imports Cython
it doesn't matter if said Cython
is listed as a dependency. You must have Cython
before running pip install
because pip
cannot get a list of dependencies from source code without running setup.py
and setup.py
requires Cython
to be importable.
If snpknock
were ever release an egg or a wheel for your Python version pip
would download it, get a list of dependencies and install them without consulting setup.py
; after that it'd install the package. In that case pip
would automatically download Cython
or install compiled extensions right from the egg/wheel.