Azure-devops-cli-extension: [Bug] An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.

Created on 9 Feb 2021  路  6Comments  路  Source: Azure/azure-devops-cli-extension

Describe the bug
cli.azure.cli.core.azclierror: An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.

cli.azure.cli.core.extension.operations: Command '['/opt/az/bin/python3', '-m', 'pip', 'install', 'keyring~=17.1.1', '--target', '/root/.azure/cliextensions/azure-devops', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 1.
cli.azext_devops.dev.team.credentials: Unable to use secure credential store in this environment.
cli.azext_devops.dev.team.credentials: Please refer to alternate methods at https://aka.ms/azure-devops-cli-auth
cli.azext_devops.dev.team.credentials: using Environment variable
cli.azext_devops.dev.team.credentials: or use 'az login'
cli.azext_devops.dev.common.exception_handler: handling generic error
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/credential_store.py", line 23, in set_password
import keyring
ModuleNotFoundError: No module named 'keyring'

During handling of the above exception, another exception occurred:

To Reproduce
Azure Cli Version:
Use az --version
Look for something like-
azure-cli (2.0.70)

Azure-Devops extension version:
azure-cli 2.19.0
core 2.19.0
telemetry 1.0.6
Extensions:
azure-devops 0.18.0

Steps to reproduce the behavior:

  1. echo -n {token} | az devops login
  2. setup defaults..
  3. Run command....
  4. See error

Expected behavior
az devops login to be success

Screenshots
If applicable, add screenshots to help explain your problem.

Debug logs

Additional context
Add any other context about the problem here.

bug ProToCol

Most helpful comment

@dareyes90, I don't understand how upgrading pip would fix this. For me it didn't help.

Nonetheless, your message pointed me in the right direction to fix it here.

Run a command like this to check whether the az command's Python installation has the keyring package:

pip3 freeze --path /opt/az/lib/python3.6/site-packages/ | grep '^keyring=='

If it returns nothing, then the keyring package is missing.

You can fix that with this command.

pip3 install --target /opt/az/lib/python3.6/site-packages/ keyring~=17.1.1

It installs the same version required by az devops.

All 6 comments

I also am fighting this issue...

azure-cli 2.16.0 *

core 2.16.0 *
telemetry 1.0.6

Extensions:
image-copy-extension 0.2.8
azure-devops 0.18.0

Python location '/usr/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files found matching 'vectors'
warning: no previously-included files matching '' found under directory 'vectors'
warning: no previously-included files matching '
' found under directory '.github'
warning: no previously-included files found matching 'release.py'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching 'codecov.yml'
warning: no previously-included files found matching '.readthedocs.yml'
warning: no previously-included files found matching 'dev-requirements.txt'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'mypy.ini'
warning: no previously-included files matching '' found under directory '.zuul.d'
warning: no previously-included files matching '
' found under directory '.zuul.playbooks'
writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
running build_ext
running build_rust

    =============================DEBUG ASSISTANCE=============================
    If you are seeing a compilation error please try the following steps to
    successfully install cryptography:
    1) Upgrade to the latest pip and try again. This will fix errors for most
       users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
    2) Read https://cryptography.io/en/latest/installation.html for specific
       instructions for your platform.
    3) Check our frequently asked questions for more information:
       https://cryptography.io/en/latest/faq.html
    4) Ensure you have a recent Rust toolchain installed:
       https://cryptography.io/en/latest/installation.html#rust
    5) If you are experiencing issues with Rust for *this release only* you may
       set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
    =============================DEBUG ASSISTANCE=============================

error: Can not find Rust compiler
Running setup.py install for cryptography: finished with status 'error'

Cleaning up...
Removing source in /tmp/pip-build-lan5mba_/cryptography
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lan5mba_/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-41ntnnim-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmpa09w6zy1" failed with error code 1 in /tmp/pip-build-lan5mba_/cryptography/
Exception information:
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib64/az/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib64/az/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install
**kwargs
File "/usr/lib64/az/lib/python3.6/site-packages/pip/req/req_install.py", line 882, in install
spinner=spinner,
File "/usr/lib64/az/lib/python3.6/site-packages/pip/utils/__init__.py", line 717, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lan5mba_/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-41ntnnim-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmpa09w6zy1" failed with error code 1 in /tmp/pip-build-lan5mba_/cryptography/

cli.azure.cli.core.extension.operations: Command '['/usr/bin/python3', '-m', 'pip', 'install', 'keyring~=17.1.1', '--target', '/root/.azure/cliextensions/azure-devops', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 1.
cli.azext_devops.dev.team.credentials: Unable to use secure credential store in this environment.
cli.azext_devops.dev.team.credentials: Please refer to alternate methods at https://aka.ms/azure-devops-cli-auth
cli.azext_devops.dev.team.credentials: using Environment variable
cli.azext_devops.dev.team.credentials: or use 'az login'
cli.azext_devops.dev.common.exception_handler: handling generic error
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/credential_store.py", line 23, in set_password
import keyring
ModuleNotFoundError: No module named 'keyring'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/team/credentials.py", line 31, in credential_set
set_credential(organization=organization, token=token)
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/_credentials.py", line 33, in set_credential
cred_store.set_password(key, token)
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/credential_store.py", line 25, in set_password
install_keyring()
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/pip_helper.py", line 16, in install_keyring
_install_package('keyring~=17.1.1')
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/pip_helper.py", line 26, in _install_package
'Use --debug for more information.'.format(pip_status_code, package_name))
knack.util.CLIError: An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
raise ex
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 727, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 719, in _run_job
return cmd_copy.exception_handler(ex)
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/exception_handler.py", line 31, in azure_devops_exception_handler
reraise(sys.exc_info())
File "/usr/lib64/az/lib/python3.6/site-packages/six.py", line 703, in reraise
raise value
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 698, in _run_job
result = cmd_copy(params)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 331, in __call__
return self.handler(
args, kwargs)
File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 816, in default_command_handler
return op(
command_args)
File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/team/credentials.py", line 37, in credential_set
raise CLIError(ex)
knack.util.CLIError: An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.

cli.azure.cli.core.azclierror: An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.
cli.azure.cli.core.azclierror: An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information.
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 7.005 seconds (init: 0.124, invoke: 6.881)
telemetry.save: Save telemetry record of length 3233 in cache
telemetry.check: Negative: The /root/.azure/telemetry.txt was modified at 2021-02-09 14:35:48.151079, which in less than 600.000000 s

for me this error coming since 05/02/2021, before that I don't see this error, not sure what was changed.

This was due to the cryptography package adding rust as a dependency, which breaks support for many systems and pip versions.

I opened a similar issue here https://github.com/Azure/azure-cli/issues/16858

Hi all, I found that the trouble is related with the version of python installed with azure devops cli.

What I do was just update pip to the target directory /opt/az/lib/python3.6/site-packages/ with this command:
pip install --upgrade pip --target /opt/az/lib/python3.6/site-packages/

Hope this work for all!

@dareyes90 Thanks for solution its solving the issue

@dareyes90, I don't understand how upgrading pip would fix this. For me it didn't help.

Nonetheless, your message pointed me in the right direction to fix it here.

Run a command like this to check whether the az command's Python installation has the keyring package:

pip3 freeze --path /opt/az/lib/python3.6/site-packages/ | grep '^keyring=='

If it returns nothing, then the keyring package is missing.

You can fix that with this command.

pip3 install --target /opt/az/lib/python3.6/site-packages/ keyring~=17.1.1

It installs the same version required by az devops.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fidou picture fidou  路  5Comments

bentterp picture bentterp  路  4Comments

ishitam8 picture ishitam8  路  6Comments

mydiemho picture mydiemho  路  3Comments

f00-beerd picture f00-beerd  路  3Comments