conan icon indicating copy to clipboard operation
conan copied to clipboard

Can not use conan to get boost library because of the conanfile.py of boost.

Open fancygit opened this issue 3 years ago • 2 comments

(dev) PS C:\Users\harry> conan inspect boost/1.79.0 ERROR: Error loading conanfile at 'C:\Users\harry.conan\data\boost\1.79.0__\export\conanfile.py': Unable to load conanfile in C:\Users\harry.conan\data\boost\1.79.0__\export\conanfile.py File "C:\Users\harry\Anaconda3\envs\dev\lib\imp.py", line 172, in load_source module = _load(spec) File "", line 719, in _load File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in call_with_frames_removed File "C:\Users\harry.conan\data\boost\1.79.0__\export\conanfile.py", line 2, in from conan.tools.files import rename, rmdir, get ImportError: cannot import name 'rmdir' from 'conan.tools.files' (C:\Users\harry\Anaconda3\envs\dev\lib\site-packages\conan\tools\files_init.py)

OS: Windows Conan: x86_64.exe
Conan Version: 1.48

fancygit avatar Aug 08 '22 03:08 fancygit

Hi @fancygit - Presumably it's this following line in the Boost conanfile.py: https://github.com/conan-io/conan-center-index/blob/master/recipes/boost/all/conanfile.py#L2

I have tried to reproduce this on Conan 1.48.0, but I get no issues running:

from conan.tools.files import rename, rmdir, get

The error is coming from a version of Conan installed within a Conda environment: Is it at all possible that the version of Conan that is installed inside the Conda environment is different than 1.48 You can run conda list within the activated environment to get the list and versions of packaged installed, or conda list -n dev (assuming your environment is called dev).

jcar87 avatar Aug 08 '22 10:08 jcar87

Thx @jcar87 I've tried 2 ways to install conan.

  1. image 2.image

The version of Conan installed by Anaconda is image After update conan from 1.46.2 to 1.51.0, it works!

And The version of Conan installed by binary redistribution is 1.48.1. About 2 weeks ago, it works well. But yesterday when I cleared all the downloaded library of Conan and tried to re-download all the library that I needed. Most of them can be well handled except Boost.

The following is the output: Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S D:/Projects/QtCreator/TxToolBox -B D:/Projects/QtCreator/TxToolBox/build/Debug in D:\Projects\QtCreator\TxToolBox\build\Debug. -- Qt Creator: conan package manager auto-setup. Skip this step by setting QT_CREATOR_SKIP_CONAN_SETUP to ON. loading initial cache file D:/Projects/QtCreator/TxToolBox/build/Debug/qtcsettings.cmake -- Conan: Automatic detection of conan settings from cmake -- Conan: Detected VS runtime: MDd -- Conan: Settings= -s;arch=x86_64;-s;build_type=Debug;-s;compiler=Visual Studio;-s;compiler.version=16;-s;compiler.runtime=MDd -- Conan: checking conan executable -- Conan: Found program C:/Program Files/Conan/conan/conan.exe -- Conan: Version found Conan version 1.48.1

-- Conan executing: C:/Program Files/Conan/conan/conan.exe install D:/Projects/QtCreator/TxToolBox/conanfile.txt -s arch=x86_64 -s build_type=Debug -s compiler=Visual Studio -s compiler.version=16 -s compiler.runtime=MDd -e=CONAN_CMAKE_TOOLCHAIN_FILE="D:/Projects/QtCreator/TxToolBox/build/Debug/conan-dependencies/toolchain.cmake" -g=cmake_paths -g=json -g=cmake --build=missing -if=D:/Projects/QtCreator/TxToolBox/build/Debug/conan-dependencies Configuration: [settings] arch=x86_64 arch_build=x86_64 build_type=Debug compiler=Visual Studio compiler.runtime=MDd compiler.version=16 os=Windows os_build=Windows [options] [build_requires] [env] CONAN_CMAKE_TOOLCHAIN_FILE="D:/Projects/QtCreator/TxToolBox/build/Debug/conan-dependencies/toolchain.cmake" boost/1.79.0: Not found in local cache, looking in remotes... boost/1.79.0: Trying with 'conancenter'... Downloading conanmanifest.txt Downloading conanfile.py Downloading conan_export.tgz boost/1.79.0: Downloaded recipe revision 0 ERROR: boost/1.79.0: Cannot load recipe. Error loading conanfile at 'C:\Users\harry.conan\data\boost\1.79.0__\export\conanfile.py': Unable to load conanfile in C:\Users\harry.conan\data\boost\1.79.0__\export\conanfile.py File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Users\harry.conan\data\boost\1.79.0__\export\conanfile.py", line 5, in from conan.tools.scm import Version ModuleNotFoundError: No module named 'conan.tools.scm'

I hope that I've described my problem clearly.

fancygit avatar Aug 09 '22 01:08 fancygit

Hi @fancygit - thanks for confirming your version of Conan and updated to a more recent version.

Would you mind trying again? There was an issue with a recent update to the Boost recipe in Conan Center that we have fixed recently.

However, I can see in the logs you have posted that the version reported is 1.48.1 - which may not be recent enough for some of the latest changes in Conan Center. Any chance of locating where that one is coming from?

-- Conan: Version found Conan version 1.48.1

jcar87 avatar Aug 12 '22 15:08 jcar87

I guess this was solved by updating the Conan version and the package recipe from boost, so closing as solved. Please create new tickets if necessary, thanks!

memsharded avatar Mar 15 '24 23:03 memsharded