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.

ImportError: cannot import name 'SecretsCollection' from 'detect_secrets'

See original GitHub issue

Describe the issue When I install checkov using python3 -m pip install checkov and then try to execute checkov I get:

Traceback (most recent call last):
  File "/usr/local/bin/checkov", line 2, in <module>
    from checkov.main import run
  File "/usr/local/lib/python3.9/site-packages/checkov/main.py", line 33, in <module>
    from checkov.common.util.docs_generator import print_checks
  File "/usr/local/lib/python3.9/site-packages/checkov/common/util/docs_generator.py", line 16, in <module>
    from checkov.secrets.runner import CHECK_ID_TO_SECRET_TYPE
  File "/usr/local/lib/python3.9/site-packages/checkov/secrets/runner.py", line 7, in <module>
    from detect_secrets import SecretsCollection
ImportError: cannot import name 'SecretsCollection' from 'detect_secrets' (/usr/local/lib/python3.9/site-packages/detect_secrets/__init__.py)

However, if I install with Brew I do not face this issue.

Desktop (please complete the following information):

  • OS: Mac 12.1
  • Checkov Version: 2.0.817

Additional context I have tried a few different versions, but always reproduce. I even face the same issue using Debian GNU/Linux 11 (bullseye). Am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
gruebelcommented, Feb 18, 2022

currently you can only move to either run checkov via our Docker image or use pipx to install it in a dedicated virtual env.

0reactions
gruebelcommented, Feb 18, 2022

yeah, pre-commit hook also works, because it creates a dedicated virtual env and installs all the dependencies there, also the latest version of detect-secrets. Same goes for brew installation it creates a virtual env with all needed dependencies, which are not shared with your global python env.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name SensitivityValues · Issue #4
When installing latest version of detect-secrets-server using: git clone ... ImportError: cannot import name SensitivityValues #4.
Read more >
python - "ImportError: cannot import name 'key' from 'secrets'"
secrets is a module added python stdlib in v3.6. Your code is trying to import key from there, which doesn't exists.
Read more >
azure-keyvault-secrets - PyPI
Asynchronously list secrets. Set a secret. set_secret creates new secrets and changes the values of existing secrets. If no secret with the given...
Read more >
Using Secret Manager with Python - Google Codelabs
Secret Manager allows you to store, manage, and access secrets as binary blobs or text strings. With the appropriate permissions, you can view ......
Read more >
Resolve Secrets Manager secret access errors after ... - AWS
Re-encrypt the secret with the new AWS KMS key. · 1. Open the Secrets Manager console. · 2. In Secret name, choose your...
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