Installing A Pip Package With Cupy As A Requirement Puts Install In Never Ending Loop
I am trying to make a pip package with cupy as one of the requirements, but I include cupy in the requirement, the pip install ends up in a never ending loop. I am trying to instal
Solution 1:
CuPy currently provides source package named cupy
and binary distribution packages named cupy-cudaXX
(where XX is a CUDA version).
Currently Google Colab is shipped with cupy-cuda100
because it is using CUDA 10.0.
If you specify cupy
as an requirement of your package, cupy
source package will be downloaded and installed (requires build which takes several minutes), even though CuPy is already available through cupy-cuda100
.
Unfortunately, Python package distribution tools (such as setuptools
, pip
, etc.) do not provide a way to well-handle this kind of complex package composition.
Workaround 1
In setup.py
(or in your package's __init__.py
)
try:
import cupy
except Exception:
raise RuntimeError('CuPy is not available. Please install it manually: https://docs-cupy.chainer.org/en/stable/install.html#install-cupy')
# You can also use `cupy.__version__` and `numpy.lib.NumpyVersion` to test CuPy version requirement here.
Workaround 2
Manually check requirements using pkg_resources
(part of setuptools
) as done in Chainer.
Post a Comment for "Installing A Pip Package With Cupy As A Requirement Puts Install In Never Ending Loop"