0

I ran pip3 install detect-secrets; but running detect-secrets then gives "Command not found".

I also tried variations, for example the switch --user; sudo; and even pip rather than pip3. Also with underscore in the name.

I further added all directories shown in python3.6 -m site to my PATH (Ubuntu 18.04).

Retrying the installation command shows that the package was successfully installed.

find . -name detect-secrets (also detect_secrets) shows these in ./.local/bin/detect-secrets and ./home/user/.local/lib/python3.6/site-packages/detect_secrets)

None of these gave access to the executable. How do I do that?

2 Answers 2

1

After pip3 install detect_secrets, with the underline, do this from the root /:

sudo find . -name detect-secrets 2>/dev/null.

You may find a result in it in /.local/bin/ or in /home/user/.local/bin/detect-secrets (strangely, that's even if you do not use the --user switch on pip3 install).

Add this directory to the path with PATH=$PATH:/home/user/.local/bin/.

Now detect-secrets, with the dash, works.

2
  • Loos good, but does not show the actual path. When run from root dir, it gives Location: /home/user /.local/lib/python3.6/site-packages. But Setting PATH to that does not work. It seems that /home/user/.local/bin/ receives an executable file which is actually a Python script that references the Python files in /home/user /.local/lib/python3.6/site-packages
    – Joshua Fox
    May 15, 2019 at 13:47
  • How can I set it for windows?
    – ketan
    Dec 7, 2021 at 17:40
0

Try executing:

which pip3

To know exactly which pip are you executing. You can do the same for python3 although it should also point you to the same python. This might help you detect what is the issue

5
  • $ which pip3 gives /usr/bin/pip3
    – Joshua Fox
    May 15, 2019 at 9:11
  • Also, pip3 list does include detect_secrets. So the question is -- why does the command detect_secrets not work? some sort of PATH issue?
    – Joshua Fox
    May 15, 2019 at 9:12
  • i believe the package is installed you are just not executing it properly. I faced the same issue as you but try executing: detect-secrets audit --help to know the options of the command
    – goosfraba
    May 15, 2019 at 9:17
  • I would say that the package installed but not being found at all when I invoke it. The command detect-secrets audit --help gives detect-secrets: command not found
    – Joshua Fox
    May 15, 2019 at 9:19
  • Are you running: detect_secrets or detect-secrets? The first one is the library name and the second one the command name.
    – goosfraba
    May 15, 2019 at 9:20

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.