Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] An error occurred. Pip failed with status code 1 for package keyring~=17.1.1. Use --debug for more information. #1099

Closed
anjanmadaram opened this issue Feb 9, 2021 · 10 comments
Assignees
Labels
Area: ProToCol The bugs under ProToCol Team bug

Comments

@anjanmadaram
Copy link

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.

@anjanmadaram anjanmadaram added Area: ProToCol The bugs under ProToCol Team bug labels Feb 9, 2021
@brianttu1
Copy link

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 [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f759b8958c8>]
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

@anjanmadaram
Copy link
Author

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

@finlaysawyer
Copy link

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 Azure/azure-cli#16858

@dareyes90
Copy link

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!

@adityasonittyl
Copy link

@dareyes90 Thanks for solution its solving the issue

@iainelder
Copy link

@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.

@roshan-sy
Copy link
Contributor

Looks like this issue is resolved with Azure/azure-cli#16858

@anjanmadaram can you please confirm?

@brianttu1
Copy link

brianttu1 commented Jan 3, 2022 via email

@roshan-sy
Copy link
Contributor

Sorry, I’m no longer with the company that had that issue. Thanks, Brian

On Jan 3, 2022, at 1:12 AM, Roshan Soni @.***> wrote:  Looks like this issue is resolved with Azure/azure-cli#16858 @anjanmadaram can you please confirm? — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.

@brianttu1 please let me know who can confirm this.
Closing this Issue for now

@oskaremil
Copy link

On Fedora 37, my problem was that I didn't have pip3 installed.

I got the same error as OP when trying to install Azure IoT extension for Azure CLI

az extension add --upgrade --name azure-iot

I tried the suggestion from @iainelder , pip3 freeze --path /opt/az/lib/python3.6/site-packages/ | grep '^keyring=='

System says pip3 is not installed.

I installed pip3, ran the original command az extension add --upgrade --name azure-iot and now it completed without error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ProToCol The bugs under ProToCol Team bug
Projects
None yet
Development

No branches or pull requests

8 participants