title: How to compile torch 1.5.0 without GPU support?
body: <p>I want to install pytorch 1.5.0 on AWS lambda. Since the torch library is very large, I need to make it as small as possible to fit within the size limits. My script looks like this so far:</p>
  
  <pre class="lang-sh prettyprint-override"><code>    mkdir python
      docker run \
          --rm \
          -v $(pwd):/build \
          python:3.8 \
          sh -c "
              cd /build;
              pip3 install torch==1.5.0 -t python/torch --no-cache-dir;
              find . -type d -name '__pycache__' | xargs rm -rf;
              find . -type d -name 'tests' | xargs rm -rf;
              find . -type f -name '*.py[co]' | xargs rm -rf;
          ";
  
      zip -r9 torch.zip python;
  
  </code></pre>
  
  <p>But the resulting zip file is very large (500+ MB). However, one of the largest files in the installation package is <code>libtorch_cuda.so</code>. Removing that file makes the zip file less than half the size. I know that cuda is a library for GPUs, and since AWS lambda doesn't have a GPU, i don't need this support. But when I remove that file torch will not <code>import</code> correctly.</p>
  
  <p>torch 1.4.0, by comparison, is much smaller because it did not by default include the cuda libraries.</p>
  
  <p>I want torch 1.5.0 without the GPU support.</p>
  
  <p>Is there a way to pip install <code>torch==1.5.0</code> <em>without</em> gpu support? </p>