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

azdev setup: show error if pip command fails #281

Merged
merged 2 commits into from
Jan 27, 2021
Merged

Conversation

jiasli
Copy link
Member

@jiasli jiasli commented Jan 25, 2021

The current azdev setup silences any error that happens. This leads to difficulties in troubleshooting installation dependencies (#274, Azure/azure-cli#16655, Azure/azure-cli#16611).

  • This PR lets pip_cmd raise CommandError by default if pip command fails. For other references of pip_cmds, they assume that pip_cmd succeeds. Now in case of failure, bare exception CommandError is raised.
  • az setup now supports --verbose to show the commands that are run, --debug to show the command output.
azdev setup -c --debug

=======================
| Azure CLI Dev Setup |
=======================

Azure CLI:
    D:\cli\azure-cli


 Installing packages
=====================

Upgrading pip...
INFO: Running: D:\cli\env39\Scripts\python -m pip install --upgrade pip
DEBUG: Requirement already satisfied: pip in d:\cli\env39\lib\site-packages (21.0)
Collecting pip
  Using cached pip-21.0-py3-none-any.whl (1.5 MB)
  Using cached pip-20.3.4-py2.py3-none-any.whl (1.5 MB)

Installing `requirements.txt`...
INFO: Running: D:\cli\env39\Scripts\python -m pip install -r D:\cli\azure-cli\requirements.txt
DEBUG: Requirement already satisfied: setuptools==52.0.0 in d:\cli\env39\lib\site-packages (from -r D:\cli\azure-cli\requirements.txt (line 2)) (52.0.0)
Requirement already satisfied: pip>=9.0.1 in d:\cli\env39\lib\site-packages (from -r D:\cli\azure-cli\requirements.txt (line 3)) (21.0)

...

Installing `requirements.py3.Windows.txt`...
INFO: Running: D:\cli\env39\Scripts\python -m pip install -r D:\cli\azure-cli\src\azure-cli\requirements.py3.Windows.txt
ERROR: Command `D:\cli\env39\Scripts\python -m pip install -r D:\cli\azure-cli\src\azure-cli\requirements.py3.Windows.txt` failed with exit code 1:
...
  _openssl.c
  build\temp.win-amd64-3.9\Release\_openssl.c(575): fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for cryptography
  ...


# install general requirements
pip_cmd(
"install -q -r {}/requirements.txt".format(cli_path),
"install -r {}".format(os.path.join(cli_path, "requirements.txt")),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the better function os.path.join in lieu of / join to avoid non-standard path separator on Windows:

D:\cli\azure-cli/requirements.txt -> D:\cli\azure-cli\requirements.txt
                ^                                    ^

@jiasli jiasli merged commit 711ca36 into Azure:master Jan 27, 2021
@jiasli jiasli deleted the setup-error branch January 27, 2021 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants