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] Cannot use cpython as a downstream dependency #16927

Open
1 task done
Todiq opened this issue Sep 3, 2024 · 5 comments
Open
1 task done

[question] Cannot use cpython as a downstream dependency #16927

Todiq opened this issue Sep 3, 2024 · 5 comments
Assignees

Comments

@Todiq
Copy link

Todiq commented Sep 3, 2024

What is your question?

Hello,

I am not really sure in which repo to create this ticket, since I don't know if it comes from a recipe's misuse or a conan client misuse (or something else).

I have a library alpha and a library beta that depends on it. Both need to link with boost python. As boost python is not set to automatically gather cpython, I would like to get it through the conanfile, rather than using the system one.

Here is an example : https://github.com/Todiq/test_conan

You juste have to run python build.py. I only tested it on Windows.


While the build of alpha passes, it fails on beta:

CMake Warning (dev) at C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (Python3)
  does not match the name of the calling package (Python).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/FindPython/Support.cmake:3867 (find_package_handle_standard_args)
  C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/FindPython3.cmake:545 (include)
  D:/conan/p/cpythaac989ed1ef63/p/bin/libs/cmake/use_conan_python.cmake:14 (include)
  build/windows-msvc/generators/FindPython.cmake:38 (include)
  CMakeLists.txt:24 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Python3: D:/conan/p/cpythaac989ed1ef63/p/bin/libs/cmake/../../python.exe (found version "3.9.19") found components: Interpreter
-- Configuring done (1.4s)
CMake Error at betaimpl/CMakeLists.txt:10 (target_link_libraries):
  Target "betaimpl" links to:

    Python::Python

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

ERROR: conanfile.py (test_beta/1.0): Error in build() method, line 52
        cmake.configure()
        ConanException: Error 1 while executing




Replacing find_package(Python COMPONENTS Development QUIET) with find_package(Python3 COMPONENTS Development QUIET) in beta's cmake removes the initial warning, but does not fix the issue (no warning in alpha though).


In beta's recipe, I tried using self.requires("cpython/3.9.19", override=True) instead of the regular self.requires("cpython/3.9.19") as well, but that would not fix the issue either.


Am I missing something? Thanks in advance for your help!

Have you read the CONTRIBUTING guide?

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

Thanks for your report @Todiq

I am trying to reproduce with your repo code, but my build is failing at an earlier stage, while building "boost":

boost/1.85.0: RUN: "C:/Users/memsharded/Envs/conan2_310/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: WARN: Boost component 'numpy' is missing libraries. Try building boost with '-o boost:without_numpy'. (Option is not guaranteed to exist)
ERROR: boost/1.85.0: Error in package_info() method, line 1997
        raise ConanException(f"These libraries were expected to be built, but were not built: {non_built}")
        ConanException: These libraries were expected to be built, but were not built: {'boost_numpy310'}

No idea why this is happening, I'd need to investigate

@Todiq
Copy link
Author

Todiq commented Sep 4, 2024

@memsharded,

I am using python 3.9.13 on my side, but I don’t think that will differ much from your version

Boost (recipe?) expects to have numpy installed (of course, I know you’re not blind).

The only workaround I found so far for this is to install it in the (virtual) environment. But here’s the catch: I never made it work with a version > 1.26.4. Meaning that starting from numpy version 2.0.0 and upwards, I would get the same error as yours (if my memory is correct). Could you please try with 1.26.4?

@Todiq
Copy link
Author

Todiq commented Sep 6, 2024

You error looks like the one mentionned here: #11241

@Todiq
Copy link
Author

Todiq commented Sep 7, 2024

@memsharded @valgur

Do you think it might be related to #16952 ?

@Todiq
Copy link
Author

Todiq commented Sep 16, 2024

Hi @memsharded,

Would you mind having a look again when you have some time please? I know you must be very busy. Thanks in advance.

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

No branches or pull requests

2 participants