I have a Python package that includes large PyTorch model checkpoints. I try including those in my setup.py
as
package_data = {'mypackage': ['model_weights/*', 'model_weights/sequential_models*']},
Now the problem is whenever I try to install from the source via pip install mypackage/ --no-cache-dir
I get a MemoryError
. I tried debugging with --verbose
and realized that this happens at
creating '/tmp/pip-wheel-bs29bp6a/tmpp0itbxn1/mypackage-1.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'mypackage/model_weights/distilled_model.pt'
adding 'mypackage-1.0.dist-info/RECORD'
Traceback (most recent call last):
...
File "/zhome/1d/8/153438/miniconda3/envs/testenv/lib/python3.9/zipfile.py", line 1127, in write
data = self._compressor.compress(data)
MemoryError
Building wheel for mypackage (PEP 517) ... error
ERROR: Failed building wheel for mypackage
I really only want the installation to copy over the files in model_weights/
to the installation directory. Including them in the wheel appears to be impossible.
Is there a way to suppress this step when running pip install
? The package will only be distributed as a source, never on PyPI, as the model_weights
files are far too large anyway.