deeptools / pyBigWig

A python extension for quick access to bigWig and bigBed files
MIT License
218 stars 49 forks source link

pyBigWig fails to find numpy installation when installing from PyPI #131

Closed EricR86 closed 2 years ago

EricR86 commented 2 years ago

I cannot reliably get pyBigWig to install with numpy features enabled as a dependency. In a docker image with numpy pre-installed I can get two different outcomes depending on whether or not I install from source or not.

For examples in the source directory (on current HEAD), if I run: python3 -m pip install -vv --upgrade --force-reinstall . numpy features are enabled

Outside the source directory if I run: python3 -m pip install -vv --upgrade --force-reinstall pybigwig numpy features are disabled

This is very problematic to having pyBigWig as a dependency especially when the numpy features are needed.

Thanks for your time.

dpryan79 commented 2 years ago

That's very confusing. It should look for numpy if it can run from numpy.distutils.misc_util import get_info. Can you try running python3 -c "from numpy.distutils.misc_util import get_info; print('worked')"? It should print "worked" in both cases.

EricR86 commented 2 years ago

Both on an install with numpy features enabled and disabled both print the same message:

python3 -c "from numpy.distutils.misc_util import get_info; print('worked')"
<string>:1: DeprecationWarning: 

  `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
  of the deprecation of `distutils` itself. It will be removed for
  Python >= 3.12. For older Python versions it will remain present.
  It is recommended to use `setuptools < 60.0` for those Python versions.
  For more details, see:
    https://numpy.org/devdocs/reference/distutils_status_migration.html 

worked

Which is what I expected. I specifically made sure numpy was in the environment in both cases. Even if I run the python3 -m pip install -vv --upgrade --force-reinstall pybigwig command with the additional --no-deps option (and numpy already installed) to ensure nothing gets re-installed, it still fails to build with numpy features enabled.

dpryan79 commented 2 years ago

What happens if you run pip cache remove pyBigWig before installing from pypi? I got it installed using numpy (numpy 1.23.3) in either case, but I wonder if it's just cached a build without numpy in your case.

EricR86 commented 2 years ago

You're correct. --force-reinstall apparently still uses the cached pypi version. I had installed with pyBigWig as a dependency and it did not detect numpy which is its own issue. Force reinstalling apparently used the cached version built locally.

dpryan79 commented 2 years ago

Caching is the cause of and solution to all of life's problems :P