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

python/metapackages/setup.py: improve package conflict detection #2399

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mitchdz
Copy link
Collaborator

@mitchdz mitchdz commented Nov 20, 2024

Description

  • improve installed package detection during pip install
  • re-enable conflicting package detection text

This code specifically checks the following packages: cuda-quantum, cuda-quantum-cu11, cuda-quantum-cu12 during the package installation phase of pip install.

For example, with cuda-quantum-cu11 installed and cuda12 libraries installed, attempting to pip install cudaq will give:

Exception: You have a conflicting CUDA-Q version installed.Please remove the following package(s): cuda-quantum-cu11

Copy link

copy-pr-bot bot commented Nov 20, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment on lines +134 to +135
search_pattern = os.path.join(directory, f"{package_name}-*.dist-info")
matches = glob.glob(search_pattern)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wondering if we can just search a file in a directory. Or am I misunderstanding something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't find a great file to specifically look for that all installed packages would have. The consistent one was ${package_name}-${version}.dist-info which contains the metadata for the package.

@bettinaheim
Copy link
Collaborator

bettinaheim commented Nov 21, 2024

/ok to test

Command Bot: Processing...

@bettinaheim
Copy link
Collaborator

bettinaheim commented Nov 21, 2024

/ok to test

Command Bot: Processing...

@mitchdz
Copy link
Collaborator Author

mitchdz commented Nov 21, 2024

FYI - I added a short one line commit to fix the cuda-quantum package README.

@sacpis
Copy link
Collaborator

sacpis commented Nov 21, 2024

/ok to test

Command Bot: Processing...

@mitchdz
Copy link
Collaborator Author

mitchdz commented Nov 22, 2024

/ok to test

Command Bot: Processing...

@mitchdz
Copy link
Collaborator Author

mitchdz commented Nov 22, 2024

/ok to test

Command Bot: Processing...

1 similar comment
@mitchdz
Copy link
Collaborator Author

mitchdz commented Nov 22, 2024

/ok to test

Command Bot: Processing...

.github/workflows/python_metapackages.yml: enable previous disabled
test

Signed-off-by: mitchdz <[email protected]>
Because the test runners do not have a GPU, the default bdist choice
of cuda-quantum-cu12 is always chosen, which breaks some of the tests.

Credit: Bettina Heim

Signed-off-by: mitchdz <[email protected]>
The README had an echo with grave symbols which spawned a subshell to
execute the command which returned nothing - thus creating an empty
string.

This resulted in the README saying:
"...new versions are published under the name instead..."

Now it will say:
"...new versions are published under the name `cudaq` instead..."

Signed-off-by: mitchdz <[email protected]>
At the end of the test, install_default is compared to test_conflicting, but
installed_default is not printed anywhere in the logs.

Signed-off-by: mitchdz <[email protected]>
Modify the logic to only take the first occurence of the Identified best
package. This is because setup.py prints out the package multiple times
like so:

  [cudaq] Identified cuda-quantum-cu12 as the best package.
  [cudaq] Identified cuda-quantum-cu12 as the best package.
  [cudaq] Identified cuda-quantum-cu12 as the best package.

Which will make installed_default="cuda-quantum-cu12
cuda-quantum-cu12
cuda-quantum-cu12"

which fails the logic test for the CI. This Identified package should be
the same for all prints, so the first occurence is taken.

Signed-off-by: mitchdz <[email protected]>
@mitchdz
Copy link
Collaborator Author

mitchdz commented Nov 22, 2024

/ok to test

Command Bot: Processing...

@bettinaheim
Copy link
Collaborator

bettinaheim commented Nov 23, 2024

/ok to test

Command Bot: Processing...

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