question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No package metadata was found for pre-commit

See original GitHub issue

search you tried in the issue tracker

No package metadata was found for pre-commit

describe your issue

Unable to install pre-commit inside Docker container based on FROM python:3.9.15-alpine3.16

python --version
Python 3.9.15

⬢ [Docker] ✗  pip install pre-commit
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pre-commit in /home/terraform/.local/lib/python3.9/site-packages (2.20.0)
Requirement already satisfied: cfgv>=2.0.0 in /home/terraform/.local/lib/python3.9/site-packages (from pre-commit) (3.3.1)
Requirement already satisfied: pyyaml>=5.1 in /home/terraform/.local/lib/python3.9/site-packages (from pre-commit) (6.0)
Requirement already satisfied: nodeenv>=0.11.1 in /home/terraform/.local/lib/python3.9/site-packages (from pre-commit) (1.7.0)
Requirement already satisfied: identify>=1.0.0 in /home/terraform/.local/lib/python3.9/site-packages (from pre-commit) (2.5.9)
Requirement already satisfied: virtualenv>=20.0.8 in /home/terraform/.local/lib/python3.9/site-packages (from pre-commit) (20.16.7)
Requirement already satisfied: toml in /home/terraform/.local/lib/python3.9/site-packages (from pre-commit) (0.10.2)
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/site-packages (from nodeenv>=0.11.1->pre-commit) (58.1.0)
Requirement already satisfied: filelock<4,>=3.4.1 in /home/terraform/.local/lib/python3.9/site-packages (from virtualenv>=20.0.8->pre-commit) (3.8.0)
Requirement already satisfied: platformdirs<3,>=2.4 in /home/terraform/.local/lib/python3.9/site-packages (from virtualenv>=20.0.8->pre-commit) (2.5.4)
Requirement already satisfied: distlib<1,>=0.3.6 in /home/terraform/.local/lib/python3.9/site-packages (from virtualenv>=20.0.8->pre-commit) (0.3.6)

pre-commit install 

Traceback (most recent call last):
  File "/usr/bin/pre-commit", line 33, in <module>
    sys.exit(load_entry_point('pre-commit==2.20.0', 'console_scripts', 'pre-commit')())
  File "/usr/bin/pre-commit", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 957, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 548, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for pre-commit

pre-commit --version

2.20.0

.pre-commit-config.yaml

repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
  rev: v1.50.0
  hooks:
    - id: terraform_fmt
    - id: terraform_docs

- repo: git://github.com/pre-commit/pre-commit-hooks
  rev: v4.0.1
  hooks:
    # Git style
    - id: check-added-large-files
    - id: check-merge-conflict
    - id: check-vcs-permalinks
    - id: forbid-new-submodules
    - id: no-commit-to-branch
    - id: check-symlinks
    - id: mixed-line-ending
      args: [--fix=auto]

    # Common errors
    - id: check-yaml
      args: [--allow-multiple-documents]
    - id: end-of-file-fixer
    - id: trailing-whitespace
      args: [--markdown-linebreak-ext=md]

    # Cross platform
    - id: check-case-conflict

    # Security
    - id: detect-aws-credentials
      args: ['--allow-missing-credentials']
    - id: detect-private-key

~/.cache/pre-commit/pre-commit.log (if present)

No response

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bxscifcommented, Nov 28, 2022

@asottile I was able to reproduce…

$ docker run -it --rm python:3.9.15-alpine3.16 sh   
Resolved "python" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/python:3.9.15-alpine3.16...
Getting image source signatures
Copying blob sha256:19bb016e320862c026def9d5f76bff51c694d7f3207ef1f955a58bfca3d68215
Copying blob sha256:ca7dd9ec2225f2385955c43b2379305acd51543c28cf1d4e94522b3d94cce3ce
Copying blob sha256:9e124a36b9ab9caae9b9b43bffcb6f6d9f126ab89cf2a8b20b9a6f912df03d36
Copying blob sha256:5feffc3e09e9c5ed20517a9306255f9de37b0d1b50b4f77c2e4fd6cf14a8f704
Copying blob sha256:a832727e49c96e7139e6caeaa46953f8264534e83b5e519b0c6eb943fbd6a069
Copying config sha256:67c7dce0c37bf14488ecd9549327ee9e81ed3497f52c3325eabcf316e48ba9b6
Writing manifest to image destination
Storing signatures
/ # apk add pre-commit --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
(1/20) Installing libgcc (11.2.1_git20220219-r2)
(2/20) Installing libstdc++ (11.2.1_git20220219-r2)
(3/20) Installing mpdecimal (2.5.1-r1)
(4/20) Installing python3 (3.10.8-r0)
(5/20) Installing py3-cfgv (3.3.1-r2)
(6/20) Installing py3-cparser (2.20-r2)
(7/20) Installing py3-cffi (1.15.0-r0)
(8/20) Installing py3-ukkonen (1.0.1-r2)
(9/20) Installing py3-identify (2.5.9-r1)
(10/20) Installing bash (5.1.16-r2)
Executing bash-5.1.16-r2.post-install
(11/20) Installing py3-nodeenv (1.6.0-r2)
(12/20) Installing yaml (0.2.5-r0)
(13/20) Installing py3-yaml (6.0-r0)
(14/20) Installing py3-toml (0.10.2-r3)
(15/20) Installing py3-platformdirs (2.5.2-r0)
(16/20) Installing py3-distlib (0.3.4-r1)
(17/20) Installing py3-filelock (3.4.2-r0)
(18/20) Installing py3-six (1.16.0-r1)
(19/20) Installing py3-virtualenv (20.14.1-r0)
(20/20) Installing pre-commit (2.20.0-r1)
Executing busybox-1.35.0-r17.trigger
OK: 81 MiB in 56 packages
/ # pre-commit --version
Traceback (most recent call last):
  File "/usr/bin/pre-commit", line 33, in <module>
    sys.exit(load_entry_point('pre-commit==2.20.0', 'console_scripts', 'pre-commit')())
  File "/usr/bin/pre-commit", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 957, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 548, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for pre-commit
0reactions
dmitry-mightydevopscommented, Dec 2, 2022

@bxscif thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

"No package metadata was found for metaseq" when execute ...
What is your question? I try to run metaseq-api using Google Colab, but when I execute metaseq-api-local command after setup, ...
Read more >
Pre-commit not finding python packages - Stack Overflow
pre-commit installs isolated environments for each of the tools such that they don't interfere with local development.
Read more >
1694366 – (pre-commit) Review Request - Red Hat Bugzilla
JFYI I'm packaging importlib-metadata for new tox. Also, this should be called just pre-commit, not python-pre-commit and python3-pre-commit, thanks.
Read more >
pre-commit
We built pre-commit to solve our hook issues. It is a multi-language package manager for pre-commit hooks. You specify a list of hooks...
Read more >
pre-commit hooks | Documentation - Poetry
An option to explicit exclude repositories will not be implemented into pre-commit . Footer. Poetry. Python packaging and dependency management made easy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found