OHDSI / bayes-bridge

Bayesian sparse regression with regularized shrinkage and conjugate gradient acceleration
https://bayes-bridge.readthedocs.io/en/latest/
18 stars 7 forks source link

pyx files not found when building wheel #8

Closed aki-nishimura closed 2 years ago

aki-nishimura commented 2 years ago

When calling python -m build (https://github.com/aki-nishimura/bayes-bridge/commit/bc6ded78cfddca16d9636955132a719d78ac185b), the source distribution builds fine, but building wheel from sdist fails with the error

ValueError: 'bayesbridge/random/tilted_stable/tilted_stable.pyx' doesn't match any files https://github.com/aki-nishimura/bayes-bridge/commit/bc6ded78cfddca16d9636955132a719d78ac185b

Any idea why this happens @chinandrew ? Not sure if this is any helpful, but the error comes from Cython's create_extension_list(), which in turn is called by setuptools's get_requires_for_build_wheel().

(For now, I have manually generated the cythonized C files and modified the setup.py, so that I can upload updated versions of the package to PyPI.)

chinandrew commented 2 years ago

Hmm interesting. Both python setup.py build and python setup.py sdist bdist_wheel are working for me on master. Are you running from the right directory?

aki-nishimura commented 2 years ago

Actually, python setup.py build and python setup.py sdist bdist_wheel are working for me as well, though python -m build is still failing. (Previously, I thought python setup.py ... was failing because I forgot to rm -rf dist when updating package on TestPyPI.)

Maybe python -m build requires completely switching from setup.py to setup.cfg? In any case, since I can just use python setup.py ..., I will revert bc6ded7. Thanks for the help.

chinandrew commented 2 years ago

Ah sorry, misread that. python -m build works for me as well :thinking:

aki-nishimura commented 2 years ago

Ha, good to know python -m build is working for you, though I still have no idea why it's failing on my end (macOS Catalina). I tried to look into the error, but pdb throws an error of its own during post mortem debugging (😂) and can't find any helpful info on the web.

I will leave the issue open, but will not worry further about this for now since python setup.py sdist bdist_wheel works fine.

aki-nishimura commented 2 years ago

Adding *.pyx files via MANIFEST.in solves the issue c70744f994f8cae7f9b09d64e3ee1585c1927471 (silly me 🤦‍♂️). I somehow could not get the package_data argument to setup() working, but oh well.

setup_requires=['setuptools_scm'] seems like a better approach moving forward (https://www.remarkablyrestrained.com/python-setuptools-manifest-in/), so I will give it a try later.