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] conan2 export-pkg fails for conanfile.py with python_requires dependency not in the local cache #13495

Closed
1 task done
bbandix opened this issue Mar 22, 2023 · 4 comments · Fixed by #13496
Closed
1 task done
Assignees
Labels
Milestone

Comments

@bbandix
Copy link

bbandix commented Mar 22, 2023

What is your question?

Hi,

We started an experimental migration of our packages to conan 2.x.
Our packages use python_requires to declare a base dependency for our conanfiles which works fine with conan 1.x but has changed behaviour with conan 2.x

In our consumer conanfiles we use the following:

class MyPackageConan(ConanFile):
    name = "mypackage"
    version = "0.0.1"
    python_requires = "conan_file_base/2023.01"
    python_requires_extend = "conan_file_base.MyConanFileBase"
    ...

We then package the packages with conan export-pkg:

conan export-pkg -r myremote mypackage/conanfile.py

In case conan_file_base is not yet in the local cache, but available on the remote repository myremote export-pkg with conan 2.x seems to fail even though the remote is defined on the command line with -r myremote:

...
conan_file_base/2023.01: Not found in local cache, looking in remotes...                                                                                                                                                           
ERROR: Error loading conanfile at '.../mypackage/conanfile.py': Cannot resolve python_requires 'conan_file_base/2023.01': No remote defined
...

Explicitly downloading the python_requires dependency before export-pkg solves the issue:
conan download conan_file_base/2023.01 -r myremote

Question

  • Is this an intended behavior change to enforce conan downloads for python_requires compared to conan 1.x?
    The errror message "No remote defined" even though a remote is defined on the command line seems to suggest that this is a bug.
conan --version
Conan version 2.0.2

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

Hi @bbandix

Thanks for reporting.
There was some recent fix in 2.0.2 to add the --remotes flag to export-pkg, but it could be that it is not correctly applying to python_requires. Let me have a look.

@memsharded
Copy link
Member

It was indeed a bug, thanks very much for raising the issue, there was a missing "remotes" in the call to the first export step.

I have submitted a fix in #13496 for next 2.0.3.

@bbandix
Copy link
Author

bbandix commented Mar 22, 2023

Hi @memsharded,
Thanks very much for the speedy fix!

AbrilRBS added a commit that referenced this issue Mar 22, 2023
Changelog: Bugfix: Fix ``python-requires`` in remotes when running
``conan export-pkg``.
Docs: Omit

Close #13495
@memsharded
Copy link
Member

#13496 merged for 2.0.3

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

Successfully merging a pull request may close this issue.

2 participants