slimtoolkit / slimtoolkit/slim

slimmed version of python3.10 version seems to loose package(s)

Open
#317 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

docker run of my image runs perfectly my python code using various packages (important here: juniper pyez and cryptography)


Actual Behavior

docker run of the slim version crashes
output here :

Error processing line 1 of /usr/local/lib/python3.10/site-packages/junos_eznc-2.6.3-py3.7-nspkg.pth:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.10/site.py", line 186, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 568, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Traceback (most recent call last):
  File "/usr/src/app/./enrichment/ios_xr_interfaces.py", line 70, in <module>
    user, p = userManager(getpass.getuser(), "")
  File "/usr/local/lib/python3.10/site-packages/Routers/genericConnect.py", line 85, in userManager
    from cryptography.fernet import Fernet
ModuleNotFoundError: No module named 'cryptography.fernet'

Dockerfile:

FROM python:3

WORKDIR /usr/src/app
RUN mkdir /usr/src/app/conf
RUN mkdir /usr/src/app/Routers
RUN mkdir /usr/src/app/enrichement

COPY ./enrichment /usr/src/app/enrichment
COPY ./Routers /usr/src/app/Routers
WORKDIR /usr/src/app/Routers
RUN pip install --no-cache-dir -r requirements.txt
RUN python3 setup.py sdist bdist_wheel
RUN pip3 install ./
WORKDIR /usr/src/app/

CMD ["python", "./enrichment/ios_xr_interfaces.py"]

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 with the Dockerfile, requirements.txt, and setup.py, then compare the regular and slim Python images described in the report. Reproduce the ModuleNotFoundError for cryptography.fernet and the junos_eznc warning, and identify whether slimming removed packages needed by the installed application; done means the slim image runs the provided command successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.