slimtoolkit / slimtoolkit/slim

Python console entrypoint not working with docker slim

Open
#143 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.4k
Forks
840
PR merge metrics
No merged PRs in 30d

Description

I have a python module that registers a console entrypoint (see https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html) via setuptools. The entrypoint of my container invokes this command (which in turns invokes itself several times). The resulting slim image contains the exeutable in my shell's path however it does not work. Attempting to run the command from the resulting slim images produces:

# notectl
Traceback (most recent call last):
  File "/usr/local/bin/notectl", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3254, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3237, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'noteworthy==0.0.1' distribution was not found and is required by the application

Looking in /usr/local/lib/python3.8/sites-packages/ I can see that the package referenced in the error above is included in the resulting slim image. I

I'm not sure how to troubleshoot this. Any advice is much appreciated!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Python console entrypoint in the Docker slim image and inspect /usr/local/lib/python3.8/site-packages/ alongside /usr/local/bin/notectl. Compare the installed package metadata with the entrypoint's pkg_resources lookup; done means the command runs successfully in the resulting slim image.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.