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

[question] How do I specify a particular package ID in the requirements section in my conanfile.(txt/py)? #17291

Open
1 task done
DillonNMorse opened this issue Nov 7, 2024 · 1 comment
Assignees

Comments

@DillonNMorse
Copy link

What is your question?

I am trying to build a project which requires opentelemetry-cpp, in particular I need a build with: with_otlp_grpc: True. From your opentelemetry-cpp recipes page I can see that what I want is package ID = fa03e336ba0faf7b6f1dd9079c5a49d19db04962 How can I specify this particular package ID in my conanfile (either txt or py)?

For example, in my conanfile.txt I have tried:
opentelemetry-cpp/1.14.2#6bafec80cf465b03b6e8521e9dcf395b:fa03e336ba0faf7b6f1dd9079c5a49d19db04962
hoping that the syntax was <package name>/<package version>#<Recipe Revision>:<package ID> but I receive the following error message when executing conan install ...:

ERROR: Package 'opentelemetry-cpp/1.14.2' not resolved: Unable to find 'opentelemetry-cpp/1.14.2#6bafec80cf465b03b6e8521e9dcf395b:fa03e336ba0faf7b6f1dd9079c5a49d19db04962' in remotes.

Among our team we are finding that anyone that has tried to re-install the conan libraries within the last week is running into an issue wherein we fail to find the appropriate otlp grpc libraries - presumably because we are now inadvertently pulling a package with with_otlp_grpc: False. Is it necessary to pin not only the package versions but also the package ID's in the requirements section of our conafile?

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Nov 7, 2024
@memsharded
Copy link
Member

Hi @DillonNMorse

Thanks for your question

How can I specify this particular package ID in my conanfile (either txt or py)?

It is not possible to specify the package_id from the consumers. The package_id is always computed as a function of multiple parameters, including profile settings, options, and also dependencies versions, see: https://docs.conan.io/2/reference/binary_model.html. Note from https://docs.conan.io/2/reference/binary_model/dependencies.html section, that dependencies can affect the package_id of the consumer, also if some of the dependencies options changes, for "embed" cases.

Among our team we are finding that anyone that has tried to re-install the conan libraries within the last week is running into an issue wherein we fail to find the appropriate otlp grpc libraries - presumably because we are now inadvertently pulling a package with with_otlp_grpc: False. Is it necessary to pin not only the package versions but also the package ID's in the requirements section of our conafile?

Yes, this might happen if some recipe has changed recently in ConanCenter, and changed any of their options or something like that. It is not frequent, but sometimes might happen.

It is not possible to pin package_id. The recommended ways to manage the continuously evolving ConanCenter recipes are:

  • Use lockfiles to garantee that the same versions and equally important, recipe-revisions are used, even if there are changes in ConanCenter.
  • Depending on the need, for many production environment it is recommended to not use ConanCenter directly, but build your own binaries from your own fork of conan-center-index Github repo.

Please see https://docs.conan.io/2/devops/using_conancenter.html for more details.

Let us know if this clarifies things, thanks for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants