Cannot install Python secrets package

Question:

I have few dependencies in a project listed in the requirements.txt file,

requests==2.18.4
secrets==1.0.2
PyYAML==3.12

I wanted to installed them and called the command inside the virtualenv,

$ pip install -r bin/requirements.txt

I get the message provided below,

Collecting requests==2.18.4 (from -r bin/requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting secrets==1.0.2 (from -r bin/requirements.txt (line 2))
  Could not find a version that satisfies the requirement secrets==1.0.2 (from -r bin/requirements.txt (line 2)) (from versions: )
No matching distribution found for secrets==1.0.2 (from -r bin/requirements.txt (line 2))

Inside the virtualenv, I can have the versions provided,

$ python -V
Python 3.7.2


$ pip -V

pip 19.0.3 from /Users/chaklader/PycharmProjects/Welance-Craft/env/lib/python3.7/site-packages/pip (python 3.7)

Whats the issue here?

Update

I had to delete the secrets and update the other dependencies:

requests==2.21.0
PyYAML==3.13
Asked By: Arefe

||

Answers:

When trying to install the package myself, I get the same error.

However, when searching this package on pypi.org, it seems that the last released version was in 2012 and the link there to the project’s homepage leads to an almost completely empty webpage. I would thus assume that this package doesn’t exist anymore.

Answered By: Bob

While there is a secrets package, it’s very old (2012), has only one release, a broken website, and no info. It doesn’t appear to install on Python 2.7 or 3.7.

You may instead be trying to use the secrets standard library that’s built-in to Python 3.6+. It’s not a package, so you don’t need to install it or add it to your requirements.txt, simply import secrets. If you need it for an earlier version, there does appear to be an unofficial backport.

Answered By: Andrew Marshall

Now there is a backport of the secrets module for Python 2.7, 3.4 and 3.5 by the name of python2-secrets. (the name is a bit confusing in my opinion)

Installation:

pip install --user python2-secrets
Answered By: Vicente

I got the same issue recently(2022) and solved this with

pip install python-secrets

see documentation in https://pypi.org/project/python-secrets/

Answered By: Ana Moraes
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.