conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.13k stars 968 forks source link

[bug] Failing to build on Conan 1.x #15917

Open w3sip opened 5 months ago

w3sip commented 5 months ago

Describe the bug

We have an existing package that previously built successfully, and needs to be rebuilt - without changes to the recipe. That package is now failing to build due to the dependency on strawberryperl:

self.build_requires("strawberryperl/5.28.1.1")

While the package is found and is downloaded, it is no longer compatible with our environment:

strawberryperl/5.28.1.1: Downloaded recipe revision 0
ERROR: strawberryperl/5.28.1.1: Cannot load recipe.
Error loading conanfile at 'C:\Users\runner2\.conan\data\strawberryperl\5.28.1.1\_\_\export\conanfile.py': Unable to load conanfile in C:\Users\runner2\.conan\data\strawberryperl\5.28.1.1\_\_\export\conanfile.py
  File "c:\Python38\lib\imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\runner2\.conan\data\strawberryperl\5.28.1.1\_\_\export\conanfile.py", line 1, in <module>
    from conan import ConanFile, conan_version
ImportError: cannot import name 'ConanFile' from 'conan' (c:\Python38\lib\site-packages\conan\__init__.py)

Is there a way to reference old, previously used and deployed package, compatible with Conan 1.x?

How to reproduce it

No response

jcar87 commented 5 months ago

Hi @w3sip - what version of Conan are you using? All recipes in Conan Center are still compatible with Conan 1.x - that recipe in particular requires Conan >=1.52

w3sip commented 5 months ago

We use 1.41.

memsharded commented 5 months ago

Hi @w3sip

Then, this is totally expected.

ConanCenter moves and is constantly updating their recipes. As @jcar87 commented above, that specific recipe needs at least Conan 1.52.

Please also read the stability commitment in https://docs.conan.io/1/introduction.html#stable

This means that public repositories, like ConanCenter, assume the use of the latest version of the Conan client, and using an older version may result in failure of packages and recipes created with a newer version of the client.

For using ConanCenter packages with other stability and other constraints, we have already explicitly documented good practices in https://docs.conan.io/2/devops/using_conancenter.html:

So please, update to latest Conan 1.X to be able to keep using ConanCenter packages. Also, I'd take the opportunity to strongly recommend upgrading to Conan 2. This major version was released more than 1 year ago, and is now the stable, maintained and recommended one.

I think we can close this ticket as responded, not a bug. Thanks for your feedback!