Cannot install dependencies: 'ModuleNotFoundError: No module named 'setuptools.command.build''

Both setuptools and wheels evolution continue, and since some days ago we found another incompatibility when trying to upgrade these packages using the default-installed versions in Focal.

We already knew that we had to upgrade setuptools if we want to properly handle the installation of Jinja2. But now a new problem appears: the setuptools upgrade will try to install a wheels version that old setuptools cannot handle:

Collecting setuptools>=40.8.0
  Downloading setuptools-65.5.1.tar.gz (2.6 MB)
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /root/parts/charm/build/staging-venv/bin/python3 /root/parts/charm/build/staging-venv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-29b38ltx/normal --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- wheel
       cwd: None
  Complete output (60 lines):
  Collecting wheel
    Downloading wheel-0.38.2.tar.gz (66 kB)
      ERROR: Command errored out with exit status 1:
       command: /root/parts/charm/build/staging-venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v89hlh_n/wheel/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v89hlh_n/wheel/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-v89hlh_n/wheel/pip-egg-info
           cwd: /tmp/pip-install-v89hlh_n/wheel/
      Complete output (52 lines):
      WARNING: The wheel package is not available.
      running egg_info
      creating /tmp/pip-install-v89hlh_n/wheel/pip-egg-info/wheel.egg-info

          module = __import__(self.module_name, fromlist=['__name__'], level=0)
      ModuleNotFoundError: No module named 'setuptools.command.build'

We’re still investigating this, but one way out of this loop is to pre-upgrade setuptools and wheels to the versions before this problem arose:

parts:
  charm:
    charm-python-packages: 
      - wheel==0.37.1
      - setuptools==45.2.0
1 Like

Related issue: https://github.com/pypa/wheel/issues/487

I believe this has been fixed now? I’ve just been able to build a charm on focal without problems (and without this workaround).

1 Like