{"action":"closed","issue":{"url":"https://api.github.com/repos/conan-io/conan/issues/4046","repository_url":"https://api.github.com/repos/conan-io/conan","labels_url":"https://api.github.com/repos/conan-io/conan/issues/4046/labels{/name}","comments_url":"https://api.github.com/repos/conan-io/conan/issues/4046/comments","events_url":"https://api.github.com/repos/conan-io/conan/issues/4046/events","html_url":"https://github.com/conan-io/conan/issues/4046","id":386900532,"node_id":"MDU6SXNzdWUzODY5MDA1MzI=","number":4046,"title":"Conan >=1.8 fails when called from SCons 2.4.1","user":{"login":"alacasta","id":1688725,"node_id":"MDQ6VXNlcjE2ODg3MjU=","avatar_url":"https://avatars0.githubusercontent.com/u/1688725?v=4","gravatar_id":"","url":"https://api.github.com/users/alacasta","html_url":"https://github.com/alacasta","followers_url":"https://api.github.com/users/alacasta/followers","following_url":"https://api.github.com/users/alacasta/following{/other_user}","gists_url":"https://api.github.com/users/alacasta/gists{/gist_id}","starred_url":"https://api.github.com/users/alacasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alacasta/subscriptions","organizations_url":"https://api.github.com/users/alacasta/orgs","repos_url":"https://api.github.com/users/alacasta/repos","events_url":"https://api.github.com/users/alacasta/events{/privacy}","received_events_url":"https://api.github.com/users/alacasta/received_events","type":"User","site_admin":false},"labels":[{"id":1120604848,"node_id":"MDU6TGFiZWwxMTIwNjA0ODQ4","url":"https://api.github.com/repos/conan-io/conan/labels/stage:%20triaging","name":"stage: triaging","color":"fff5aa","default":false}],"state":"closed","locked":false,"assignee":{"login":"memsharded","id":15367152,"node_id":"MDQ6VXNlcjE1MzY3MTUy","avatar_url":"https://avatars2.githubusercontent.com/u/15367152?v=4","gravatar_id":"","url":"https://api.github.com/users/memsharded","html_url":"https://github.com/memsharded","followers_url":"https://api.github.com/users/memsharded/followers","following_url":"https://api.github.com/users/memsharded/following{/other_user}","gists_url":"https://api.github.com/users/memsharded/gists{/gist_id}","starred_url":"https://api.github.com/users/memsharded/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/memsharded/subscriptions","organizations_url":"https://api.github.com/users/memsharded/orgs","repos_url":"https://api.github.com/users/memsharded/repos","events_url":"https://api.github.com/users/memsharded/events{/privacy}","received_events_url":"https://api.github.com/users/memsharded/received_events","type":"User","site_admin":false},"assignees":[{"login":"memsharded","id":15367152,"node_id":"MDQ6VXNlcjE1MzY3MTUy","avatar_url":"https://avatars2.githubusercontent.com/u/15367152?v=4","gravatar_id":"","url":"https://api.github.com/users/memsharded","html_url":"https://github.com/memsharded","followers_url":"https://api.github.com/users/memsharded/followers","following_url":"https://api.github.com/users/memsharded/following{/other_user}","gists_url":"https://api.github.com/users/memsharded/gists{/gist_id}","starred_url":"https://api.github.com/users/memsharded/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/memsharded/subscriptions","organizations_url":"https://api.github.com/users/memsharded/orgs","repos_url":"https://api.github.com/users/memsharded/repos","events_url":"https://api.github.com/users/memsharded/events{/privacy}","received_events_url":"https://api.github.com/users/memsharded/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2018-12-03T16:33:18Z","updated_at":"2018-12-03T23:37:19Z","closed_at":"2018-12-03T23:37:19Z","author_association":"NONE","body":"# Description\r\nIt is not possible to use Conan in combination with SCons 2.4.1 (based on python2) from version 1.8.\r\n\r\n## Possible cause\r\nThere is a known limitation on this and using the multiprocessing package (https://stackoverflow.com/questions/24453387/scons-attributeerror-builtin-function-or-method-object-has-no-attribute-disp) which is used by a new package (tqdm) needed by another feature introduced in such version.\r\n\r\n\r\n## Use case\r\nUsers typically run \r\n```bash\r\nconan install . \r\n```\r\nof their dependencies for gathering dependencies as well as required generators. However, Integrating Conan in SCons is possible and provides solution for deps resolution and build process via \r\n```bash\r\nscons\r\n```\r\n\r\nThe complete use case may be more complex but, for the sake of simplicity and considering that a program from `src/hello.c` wants to be created and may have dependencies which are detailed at `conanfile.txt` using Conan format, a SConstruct file like follows is needed\r\n\r\n```python\r\nimport os\r\n\r\n# Import Conans\r\nfrom conans.client.conan_api import ConanAPIV1 as conan_api\r\nfrom conans import __version__ as conan_version\r\n\r\nconan, _, _ = conan_api.factory()\r\n\r\nbuild_directory = os.path.join(os.getcwd(), \"build\")\r\nif not os.path.exists(build_directory):\r\n    os.makedirs(build_directory)\r\n\r\nsrc_directory = os.path.join(os.getcwd(), \"src\")\r\nbuild_hello_directory = os.path.join(src_directory, \"hello.c\")\r\n\r\nconanfile_path = os.path.join(os.getcwd(), \"conanfile.txt\")\r\n\r\nconan.install(conanfile_path,\\\r\n        generators=[\"scons\"],\\\r\n        install_folder=build_directory)\r\n\r\n\r\n# SConstruct\r\nenv = Environment()\r\n\r\nconan_flags = SConscript('{}/SConscript_conan'.format(build_directory))\r\nflags = conan_flags[\"conan\"]\r\nenv.MergeFlags(flags)\r\n\r\nVariantDir(build_directory, src_directory)\r\nhello = Program(build_hello_directory)\r\n```\r\n\r\n\r\n## Problem/Limitation\r\nSome minor versions ago (1.8), a new feature for displaying the progress of an unzip process was included (#3545). The mechanism proposed was based on `tqdm`which, internally uses `multiprocessing`. \r\n\r\nTherefore, if running the previously described SConscript with `system_config_1`, the results is\r\n```bash\r\nscons: Reading SConscript files ...\r\n/home/lacastaa/.local/lib/python2.7/site-package/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.\r\n  warnings.warn(warning, RequestsDependencyWarning)\r\nAttributeError: 'builtin_function_or_method' object has no attribute 'dispatch':\r\n  File \"/media/sf_E_DRIVE/dev/scons_conan/SConstruct\", line 4:\r\n    from conans.client.conan_api import ConanAPIV1 as conan_api\r\n  File \"/home/lacastaa/.local/lib/python2.7/site-packages/conans/client/conan_api.py\", line 21:\r\n    from conans.client.remote_manager import RemoteManager\r\n  File \"/home/lacastaa/.local/lib/python2.7/site-packages/conans/client/remote_manager.py\", line 32:\r\n    from conans.util import progress_bar\r\n  File \"/home/lacastaa/.local/lib/python2.7/site-packages/conans/util/progress_bar.py\", line 3:\r\n    from tqdm import tqdm\r\n  File \"/home/lacastaa/.local/lib/python2.7/site-packages/tqdm/__init__.py\", line 1:\r\n    from ._tqdm import tqdm\r\n  File \"/home/lacastaa/.local/lib/python2.7/site-packages/tqdm/_tqdm.py\", line 75:\r\n    mp_lock = mp.RLock()  # multiprocessing lock\r\n  File \"/usr/lib/python2.7/multiprocessing/__init__.py\", line 182:\r\n    from multiprocessing.synchronize import RLock\r\n  File \"/usr/lib/python2.7/multiprocessing/synchronize.py\", line 48:\r\n    from multiprocessing.forking import assert_spawning, Popen\r\n  File \"/usr/lib/python2.7/multiprocessing/forking.py\", line 60:\r\n    class ForkingPickler(Pickler):\r\n  File \"/usr/lib/python2.7/multiprocessing/forking.py\", line 61:\r\n    dispatch = Pickler.dispatch.copy()\r\n``` \r\n\r\nIn turn, when running with system_config_2, the output is as follows\r\n\r\n```bash\r\nscons: Reading SConscript files ...\r\nPROJECT: Installing /media/sf_E_DRIVE/dev/scons_conan/conanfile.txt\r\nRequirements\r\nPackages\r\n\r\nPROJECT: Generator scons created SConscript_conan\r\nPROJECT: Generator txt created conanbuildinfo.txt\r\nPROJECT: Generated conaninfo.txt\r\nscons: done reading SConscript files.\r\nscons: Building targets ...\r\ngcc -o src/hello.o -c src/hello.c\r\ngcc -o src/hello src/hello.o\r\nscons: done building targets.\r\n```\r\n\r\n## Useful Links\r\n- Complete example of the defined use case: https://github.com/alacasta/conan_scons\r\n- The next workaround has been proved useful when needing to import multiprocessing at SCons. However, this cannot be applied from the client side (SCons) since is called from Conan: https://stackoverflow.com/questions/24453387/scons-attributeerror-builtin-function-or-method-object-has-no-attribute-disp/25674103#25674103 \r\n\r\n## System information\r\n\r\n### system_config_1\r\n- OS: \"Ubuntu 16.04.5 LTS\"\r\n- Conan: 1.9.2\r\n- Python: Python 2.7.12\r\n- SCons 2.4.1\r\n\r\n### system_config_2\r\n- OS: \"Ubuntu 16.04.5 LTS\"\r\n- Conan: 1.7.4\r\n- Python: Python 2.7.12\r\n- SCons 2.4.1\r\n\r\n\r\n# Possible solution\r\nLimiting the use of this feature, perhaps enabling a mechanism to be possible to disable it at `RemoteManager` so that the import operation is performed only when the feature is really wanted. \r\n\r\n# Checlist\r\nTo help us debug your issue please explain:\r\n\r\n- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).\r\n- [x] I've specified the Conan version, operating system version and any tool that can be relevant.\r\n- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.\r\n\r\n"}}
{"actor":{"display_login":"memsharded"}}