0

I am trying to build a wheel file for my python application that runs on Debian 10, including all package dependencies from pypi.

Here is my setup.py file

from setuptools import setup, find_packages

setup(
    name="powerbox",
    version=1,
    packages=find_packages(),
    url="",
    license="",
    author="",
    author_email="",
    description="",
    package_data={'': ['config/api.json']},
    scripts=["scripts/pb_build", "scripts/pb_run"],
    install_requires=[
        "pydantic",
        "smbus",
        "numpy",
        "MCP342x",
        "setuptools",
        "pytest",
        "urllib3",
        "requests",
        "minimalmodbus",
        "adafruit_blinka",
        "Adafruit_BBIO",
        "adafruit-circuitpython-mcp230xx",
        "wheel",
        "tox"
    ],
)

I run python3 setup.py bdist_wheel to build the .whl file locally. I try to copy this file to another directory and pip3 install --target=/some/dir <wheel_file>.whl, but when pip starts installing everything, it's trying to download everything over the network from pypi. I want to avoid this at all costs. I really need to build a distribution (everything needed to run this application) into a file, so that pip does not have to go over a network to get these from pypi. This is for an IoT device that will essentially grab a .whl file from an API for updates, because the device uses cellular, so the objective is to keep network traffic to a minimum.

Here's the pip output when it installs the wheel file:

      Using cached https://files.pythonhosted.org/packages/a0/28/85c7aa31b80d150b772fbe4a229487bc6644da9ccb7e427dd8cc60cb8a62/pluggy-0.13.1-py2.py3-none-any.whl
Collecting chardet<5,>=3.0.2 (from requests->powerbox==1)
  Using cached https://files.pythonhosted.org/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl
Collecting idna<3,>=2.5 (from requests->powerbox==1)
  Using cached https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl
Collecting iniconfig (from pytest->powerbox==1)
  Using cached https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl
Collecting attrs>=19.2.0 (from pytest->powerbox==1)
  Using cached https://files.pythonhosted.org/packages/c3/aa/cb45262569fcc047bf070b5de61813724d6726db83259222cd7b4c79821a/attrs-20.3.0-py2.py3-none-any.whl
Collecting typing-extensions>=3.7.4.3 (from pydantic->powerbox==1)
  Using cached https://files.pythonhosted.org/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl
TimmyTooTough
  • 81
  • 1
  • 6
  • Esp. see this answer: https://stackoverflow.com/a/14447068/7976758 – phd Apr 22 '21 at 21:30
  • 1
    The command is `pip install --no-index --find-links /dir/with/wheels` – phd Apr 22 '21 at 21:31
  • hmm. I had tried --no-index earlier, with no luck, but using the --find-links seems to be the key. I will test and see if this truly the solution. Thanks! – TimmyTooTough Apr 22 '21 at 21:39

0 Answers0