conan
conan copied to clipboard
[bug] Cannot install boost in Windows 10. ImportError: cannot import name 'is_apple_os' from 'conan.tools.apple'
Environment Details (include every applicable attribute)
- Windows 10+21H2:
- MSVC+16.0:
- Conan: 1.51.3
- Python version: 3.10.7
Steps to reproduce (Include if Applicable)
Try to install boost
Logs (Executed commands with output) (Include/Attach if Applicable)
ERROR: boost/1.71.0: Cannot load recipe.
Error loading conanfile at 'C:\Users\MRV.conan\data\boost\1.71.0__\export\conanfile.py': Unable to load conanfile in C:\Users\MRV.conan\data\boost\1.71.0__\export\conanfile.py
File "C:\Users\MRV\AppData\Local\Programs\Python\Python310\lib\imp.py", line 172, in load_source
module = _load(spec)
File "
Just tried here, in Windows:
$ conan --version
1.52.0
$ conan install boost/1.71.0@
.... all ok
Works fine.
Your conan installation might not have upgraded correctly or something like that, please try re-installing it, and make sure it is 1.52.
@memsharded, Thank you for you answer. I met with a strange problem. I removed the conan package via pip and installed via pip install conan==1.52.0, after that I deduced the package version and I get 1.51.0 and the problem remained. Also python texted me " Successfully installed conan-1.52.0"
It might be possible that you have another Conan installation elsewhere in the system? are you using virtualenvs? Maybe which/where conan
can help?
Starting with conan 1.52.0 the issue it is solved.
But not everybody can update the conan because the newer one require Jinja 3.x.y and might cause conflict with other python pachages that are requiring Jinja 2.x.y
So what about this poor peoples which are usualy working in big projects from enterprise companies? lol
BTW: Is afected Linux also not only Windows
Hi @SirCosty
This recent blog post has some hints: https://blog.conan.io/2022/09/20/consuming-recipes-during-migration-conancenter.html
Poor people working in enterprise companies (most of Conan users :) ) should definitely use their own repo, with their own copy of packages, and not pull directly from ConanCenter. Not only for C++/Conan, but any other package manager for any other language.
i always just run conan from its own conan-venv. easier than dealing with compat with other build tools
I'm getting the same error on (Fedora) Linux:
$ conan --version
Conan version 1.50.0
$ conan info conanfile.txt
libcurl/7.85.0: Not found in local cache, looking in remotes...
libcurl/7.85.0: Trying with 'conancenter'...
Downloading conanmanifest.txt completed [0.17k]
Downloading conanfile.py completed [29.66k]
Downloading conan_export.tgz completed [0.23k]
Decompressing conan_export.tgz completed [0.00k]
libcurl/7.85.0: Downloaded recipe revision 0
ERROR: libcurl/7.85.0: Cannot load recipe.
Error loading conanfile at '/home/sebastian/.conan/data/libcurl/7.85.0/_/_/export/conanfile.py': Unable to load conanfile in /home/sebastian/.conan/data/libcurl/7.85.0/_/_/export/conanfile.py
File "/usr/lib64/python3.10/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 719, in _load
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/sebastian/.conan/data/libcurl/7.85.0/_/_/export/conanfile.py", line 3, in <module>
from conan.tools.apple import is_apple_os, fix_apple_shared_install_name
ImportError: cannot import name 'is_apple_os' from 'conan.tools.apple' (/home/sebastian/.local/lib/python3.10/site-packages/conan/tools/apple/__init__.py)
To reproduce, run conan info conanfile.txt
on https://github.com/oss-review-toolkit/ort/blob/aa942fa62dd7f055e2f27f51831dc66cf77e55c8/analyzer/src/funTest/assets/projects/synthetic/conan-txt/conanfile.txt
Conan version 1.50.0
Upgrading to Conan 1.52.0 fixed the issue for me.