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

Fails to install azure-cli (which is installed just fine with pip) #9510

Closed
facundobatista opened this issue Nov 28, 2024 · 6 comments
Closed
Labels
question Asking for clarification or support

Comments

@facundobatista
Copy link

Working with uv 0.5.5 under Ubuntu 24.04.1 LTS.

I tried the following uv --verbose tool run --from azure-cli az --version, which end up failing with

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 112, in _get_module_details
  File "/home/facundo/.cache/uv/archive-v0/It-BMRRUxK61HFCnOgJeg/lib/python3.12/site-packages/azure/__init__.py", line 1, in <module>
    __import__('pkg_resources').declare_namespace(__name__)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'pkg_resources'

(full verbose run in this gist way too long to include it here)

Note that azure-cli is installable just fine with pip (see this other gist for the logs).

Strangely, in the pip installation there is no lib/python3.12/site-packages/azure/__init__.py file... but hey, it works:

(testaz) 14:37:08|facundo@trifon:~/temp$ which az
/home/facundo/temp/testaz/bin/az
(testaz) 14:37:24|facundo@trifon:~/temp$ az --version
azure-cli                         2.67.0
...
(testaz) 14:37:31|facundo@trifon:~/temp$ ll /home/facundo/temp/testaz/lib/python3.12/site-packages/azure/
total 60
drwxrwxr-x  5 facundo facundo 4096 nov 28 14:36 appconfiguration
drwxrwxr-x  6 facundo facundo 4096 nov 28 14:36 batch
drwxrwxr-x  6 facundo facundo 4096 nov 28 14:36 cli
drwxrwxr-x  3 facundo facundo 4096 nov 28 14:36 common
drwxrwxr-x  8 facundo facundo 4096 nov 28 14:36 core
drwxrwxr-x  5 facundo facundo 4096 nov 28 14:36 cosmos
drwxrwxr-x  3 facundo facundo 4096 nov 28 14:36 data
drwxrwxr-x  4 facundo facundo 4096 nov 28 14:36 datalake
drwxrwxr-x  6 facundo facundo 4096 nov 28 14:36 keyvault
drwxrwxr-x 66 facundo facundo 4096 nov 28 14:36 mgmt
drwxrwxr-x  3 facundo facundo 4096 nov 28 14:36 monitor
drwxrwxr-x  6 facundo facundo 4096 nov 28 14:36 multiapi
drwxrwxr-x  3 facundo facundo 4096 nov 28 14:36 profiles
drwxrwxr-x  3 facundo facundo 4096 nov 28 14:36 storage
drwxrwxr-x  6 facundo facundo 4096 nov 28 14:36 synapse
(testaz) 14:37:55|facundo@trifon:~/temp$ 

@charliermarsh
Copy link
Member

I think you might need --with setuptools? Though I'm not sure why. Does that fix it for you? azure-cli might be assuming something non-standard about the virtual environment.

@charliermarsh charliermarsh added the question Asking for clarification or support label Nov 29, 2024
@dimbleby
Copy link

there are lots of duplicates, uv failure to install azure-cli is always about pre-releases

@facundobatista
Copy link
Author

facundobatista commented Nov 29, 2024

@charliermarsh But setuptools is a dependency of azure-cli (declared in its setup.py), so why would one need to indicate that separately?

@facundobatista
Copy link
Author

@dimbleby duplicated issues, you mean? not following, about pre-releases of what?

@facundobatista
Copy link
Author

I've been able to go deep on this. It results it's not a "bug" in uv, but more than "a behaviour difference" with pip.

While pip prefers stable versions (and not pre-releases) but still selects a pre-release if no other option available (*1), uv just refuses to use it unless a flag is specified (*2).

So, I'll go forward and close this (just re-open if you think this is something that actually should be fixed).

(*1) From the pip gitst linked above:

Collecting azure-cli
  Using cached azure_cli-2.67.0-py3-none-any.whl.metadata (8.4 kB)
...
Collecting azure-keyvault-administration==4.4.0b2 (from azure-cli)
  Using cached azure_keyvault_administration-4.4.0b2-py3-none-any.whl.metadata (30 kB)
...
Successfully installed ... azure-keyvault-administration-4.4.0b2 ...
...
(testaz) 14:37:24|facundo@trifon:~/temp$ az --version
azure-cli                         2.67.0

(*2) It happened uv was installing a broken old version (2.0.67 which is easily visually confused with 2.67.0)... if forced to last version, the detail of why it was not chosing the last version was more evident:

31:44|facundo@trifon:~$ uv --verbose tool run --from "azure-cli==2.67" az --version
DEBUG uv 0.5.5
...
  × No solution found when resolving tool dependencies:
  ╰─▶ Because there is no version of azure-keyvault-administration==4.4.0b2 and azure-cli==2.67.0 depends on azure-keyvault-administration==4.4.0b2, we can conclude that azure-cli==2.67.0 cannot be used.
      And because you require azure-cli==2.67, we can conclude that your requirements are unsatisfiable.

@zanieb
Copy link
Member

zanieb commented Dec 3, 2024

Details on our pre-release behavior in https://docs.astral.sh/uv/pip/compatibility/#pre-release-compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

4 participants