[bug] Conan workspace install failing when using imports
See original GitHub issueIf one of my “editables” in a workspace has an imports method, the workspace install seems to fail.
Environment Details (include every applicable attribute)
- Operating System+version: Windows 10 21H1
- Compiler+version: Visual Studio 2019 16.10.3
- Conan version: 1.38.0
- Python version: 3.9.6
Steps to reproduce (Include if Applicable)
I followed the example of conan workspaces and modified my existing packages to use a workspace.
However in the conanfile of one of my submodules I have:
def imports(self):
if self.settings.compiler.value == 'Visual Studio':
self.copy("*.dll", src="bin", dst=os.path.join("bin", str(self.settings.build_type)))
If I run
conan workspace install ..\conanws_vs.yml
This fails.
I added some logging information to client/importer.py:
def run_imports(conanfile):
if not hasattr(conanfile, "imports"):
return []
print("->->->", conanfile.__dict__)
mkdir(conanfile.imports_folder)
And I see that the conanfile has the imports attribute, but it doesnt have any value:
'imports': ''
It also looks like there is no imports_folder defined at all
If I comment out the import, the workspace install succeeds. I also tried just removing the “if visual studio” but that doesn’t make a difference.
Logs (Executed commands with output) (Include/Attach if Applicable)
Traceback (most recent call last):
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\command.py", line 2213, in run
method(args[0][1:])
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\command.py", line 1843, in workspace
self._conan.workspace_install(args.path,
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\conan_api.py", line 93, in wrapper
return f(api, *args, **kwargs)
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\conan_api.py", line 525, in workspace_install
installer.install(deps_graph, remotes, build, update, graph_info.profile_host,
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\installer.py", line 316, in install
self._build(nodes_by_level, keep_build, root_node, profile_host, profile_build,
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\installer.py", line 438, in _build
self._handle_node_editable(node, profile_host, profile_build, graph_lock)
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\installer.py", line 519, in _handle_node_editable
copied_files = run_imports(conanfile)
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\client\importer.py", line 77, in run_imports
mkdir(conanfile.imports_folder)
File "C:\Users\robin\AppData\Roaming\Python\Python39\site-packages\conans\util\files.py", line 287, in mkdir
if os.path.exists(path):
File "C:\Program Files\Python39\lib\genericpath.py", line 19, in exists
os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
Value of conanfile.__dict__ in def run_imports(conanfile): in client/importer.py:
{'output': <conans.client.output.ScopedOutput object at 0x000001E503B50F70>, 'display_name': 'libaeon/0.1@aeon/testing', '_conan_runner': <conans.client.runner.ConanRunner object at 0x000001E5029F6BB0>, '_conan_user': 'aeon', '_conan_channel': 'testing', 'compatible_packages': [], '_conan_using_build_profile': False, '_conan_requester': <conans.client.rest.conan_requester.ConanRequester object at 0x000001E5022DB0D0>, 'buildenv_info': OrderedDict(), 'runenv_info': OrderedDict(), 'conf_info': Conf: {}, '_conan_buildenv': OrderedDict(), '_conan_node': libaeon/0.1@aeon/testing, '_conan_new_cpp_info': None, '_conan_dependencies': <conans.model.dependencies.ConanFileDependencies object at 0x000001E503CE8AC0>, 'folders': {'_base_install': None, '_base_source': None, '_base_build': None, '_base_package': 'D:\\Development\\aeon_engine2\\dep\\libaeon', '_base_generators': None, '_base_imports': None, 'source': '', 'build': '', 'package': '', 'generators': '', 'imports': ''}, 'patterns': <conans.model.layout.Patterns object at 0x000001E503B8A8E0>, 'cpp': <conans.model.layout.Infos object at 0x000001E503B8A910>, 'name': 'libaeon', 'version': '0.1', 'options': <conans.model.options.Options object at 0x000001E503B5C520>, 'requires': gtest/1.11.0@aeon/stable
benchmark/1.5.5@aeon/stable
icu/69.1@aeon/stable
libclang/11.1.0@aeon/stable
zlib/1.2.11@aeon/stable
freetype/2.10.4@aeon/stable
opengl-registry/1.0@aeon/stable
libpng/1.6.37@aeon/stable
libjpeg-turbo/2.1.0@aeon/stable
rtmidi/4.0.0@aeon/stable
asio/1.18.2@aeon/stable
vulkan-memory-allocator/2.3.0.201@aeon/stable, 'settings': <conans.model.settings.Settings object at 0x000001E503B50FD0>, 'cpp_info': <conans.model.build_info.CppInfo object at 0x000001E503CA64F0>, '_conan_dep_cpp_info': <conans.model.build_info.DepCppInfo object at 0x000001E503CC0B80>, 'deps_cpp_info': <conans.model.build_info.DepsCppInfo object at 0x000001E503B63400>, 'env_info': <conans.model.env_info.EnvInfo object at 0x000001E503CC0970>, 'deps_env_info': <conans.model.env_info.DepsEnvInfo object at 0x000001E503B633A0>, 'user_info': {}, 'deps_user_info': DepsUserInfo(<class 'conans.model.user_info.UserInfo'>, {'gtest': {}, 'benchmark': {}, 'icu': {}, 'libclang': {}, 'freetype': {'LIBTOOL_VERSION': '23.0.17'}, 'opengl-registry': {}, 'libjpeg-turbo': {}, 'rtmidi': {}, 'asio': {}, 'vulkan-memory-allocator': {}, 'libpng': {}, 'vulkan-headers': {}, 'zlib': {}}), '_conan_env_values': {}, 'virtualenv': True, 'conf': Conf: {}, 'in_local_cache': False, 'develop': True, 'provides': ('libaeon',), '_conan_original_requires': , '_conan_evaluated_requires': gtest/1.11.0@aeon/stable
benchmark/1.5.5@aeon/stable
icu/69.1@aeon/stable
libclang/11.1.0@aeon/stable
zlib/1.2.11@aeon/stable
freetype/2.10.4@aeon/stable
opengl-registry/1.0@aeon/stable
libpng/1.6.37@aeon/stable
libjpeg-turbo/2.1.0@aeon/stable
rtmidi/4.0.0@aeon/stable
asio/1.18.2@aeon/stable
vulkan-memory-allocator/2.3.0.201@aeon/stable, 'build_requires_options': enable_benchmarks=True
enable_unittests=True
shared=False
with_ast=True
with_chrono=True
with_clang=True
with_common=True
with_compression=True
with_crypto=True
with_file_container=True
with_fonts=True
with_gl=True
with_gl_utils=True
with_imaging=True
with_logger=True
with_math=True
with_midi=True
with_mono=False
with_platform=True
with_plugins=True
with_ptree=True
with_rdp=True
with_reflection=True
with_serial=True
with_sockets=True
with_streams=True
with_testing=True
with_tracelog=True
with_unicode=True
with_variant=True
with_vulkan=True
with_web=True
benchmark:enable_exceptions=True
benchmark:enable_lto=False
benchmark:shared=False
freetype:shared=False
freetype:with_png=True
freetype:with_zlib=True
gtest:build_gmock=True
gtest:hide_symbols=False
gtest:no_main=True
gtest:shared=False
icu:shared=False
icu:silent=True
icu:with_dyload=True
icu:with_unit_tests=False
libclang:components=all
libclang:exceptions=True
libclang:expensive_checks=False
libclang:lto=Off
libclang:rtti=True
libclang:shared=False
libclang:static_stdlib=False
libclang:targets=all
libclang:threads=True
libclang:unwind_tables=True
libclang:use_perf=False
libclang:use_sanitizer=None
libclang:with_clang=True
libclang:with_ffi=False
libjpeg-turbo:SIMD=True
libjpeg-turbo:enable12bit=False
libjpeg-turbo:java=False
libjpeg-turbo:libjpeg7_compatibility=True
libjpeg-turbo:libjpeg8_compatibility=True
libjpeg-turbo:shared=False
libjpeg-turbo:turbojpeg=True
libpng:api_prefix=None
libpng:shared=False
zlib:shared=False, 'info': <conans.model.info.ConanInfo object at 0x000001E503C77AC0>, 'build_requires': _RecipeBuildRequires(), 'generators': ['cmake', 'cmake_multi']}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[bug] workspace install fails for editable package requirement
Dear conan dev-team, it seems that there is a problem with workspace install and editable package dependencies outside the workspace yml ...
Read more >Changelog — conan 1.17.2 documentation
#5194; Bugfix: Using scm declared in a superclass failed exporting the recipe with the error ERROR: The conanfile.py defines more than one class...
Read more >Troubleshooting Omnibus GitLab installation issues
This error is thrown when /etc/gitlab/gitlab.rb configuration file contains configuration that is invalid or unsupported. Double check that there are no typos ...
Read more >Recently Active 'conan' Questions - Stack Overflow
I've got some problem with conan package manager When I run this command on my command line conan install .. --build=missing but i...
Read more >Installation troubleshooting — ROS 2 Documentation: Humble ...
For example, such a mismatch can crop up after an update of the OS. Then, rebuilding the workspace may fix the issue. Linux...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks! For me updating to 1.39 when it comes out is fine. I’ll see if i can try it out from your branch somewhere next week.
I managed to reproduce this and I have submitted a fix for this in https://github.com/conan-io/conan/pull/9281, in case you would like to try it running from my source branch, to make sure it works in your project.
Thanks for the detailed report! This is targeted for 1.39, but could be considered a regression, please let us know if you can directly jump to 1.39 or need it in previous versions (it is some work to backport and do releases, but we will do it if necessary).