I followed the instructions to the Federated Learning exercise in the Foundations of Private Computation course. I tried setting up the conda environment to run the tutorial code, following issues such as #423. However, I am still unable to import the syft library.
How to Reproduce
Followed instructions according to this site. Installation using conda and the conda environment.yml file provided.
Run
import syft as sy
Error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import syft as sy
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/init.py:59
57 from syft.core.node.vm.vm import VirtualMachineClient # noqa: F401
58 from syft.core.plan.plan import Plan # noqa: F401
---> 59 from syft.core.plan.plan_builder import make_plan # noqa: F401
60 from syft.experimental_flags import flags # noqa: F401
61 from syft.grid.client.client import login # noqa: F401
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/core/node/common/client.py:124, in Client.install_supported_frameworks(self)
123 def install_supported_frameworks(self) -> None:
--> 124 self.lib_ast = create_lib_ast(client=self)
126 # first time we want to register for future updates
127 self.lib_ast.register_updates(self)
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/init.py:244, in create_lib_ast(client)
238 lib_ast.syft.core.add_attr(
239 "remote_dataloader", remote_dataloader_ast.syft.core.remote_dataloader
240 )
242 # let the misc creation be always the last, as it needs the full ast solved
243 # to properly generated unions
--> 244 union_misc_ast = getattr(getattr(create_union_ast(lib_ast, client), "syft"), "lib")
245 lib_ast.syft.lib.add_attr(attr_name="misc", attr=union_misc_ast.attrs["misc"])
247 return lib_ast
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/misc/init.py:92, in create_union_ast(lib_ast, client)
84 classes.append(
85 (
86 f"syft.lib.misc.union.{klass.name}",
(...)
89 )
90 )
91 union_types = lazy_pairing[klass]
---> 92 allowed_functions = get_allowed_functions(lib_ast, union_types)
93 for target_method, allowed in allowed_functions.items():
94 if not allowed:
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/misc/init.py:67, in get_allowed_functions(lib_ast, union_types)
65 for union_type in union_types:
66 real_type_function_set = solve_real_type_functions(union_type)
---> 67 ast_type_function_set = solve_ast_type_functions(union_type, lib_ast)
68 rejected_function_set = real_type_function_set - ast_type_function_set
69 for accepted_function in ast_type_function_set:
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/cachetools/init.py:737, in cached..decorator..wrapper(*args, *kwargs)
735 except KeyError:
736 pass # key not found
--> 737 v = func(args, **kwargs)
738 try:
739 cache[k] = v
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/misc/init.py:28, in solve_ast_type_functions(path, lib_ast)
26 root = lib_ast
27 for path_element in path.split("."):
---> 28 root = getattr(root, path_element)
29 return root.attrs.keys()
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/ast/module.py:256, in Module.getattribute(self, item)
247 def getattribute(self, item: str) -> Any:
248 """Get Attribute of a module.
249
250 Args:
(...)
254 The value of the attribute.
255 """
--> 256 target_object = super().getattribute(item)
257 if isinstance(target_object, ast.static_attr.StaticAttribute):
258 return target_object.get_remote_value()
AttributeError: 'Globals' object has no attribute 'pandas'
## Expected Behavior
`syft` library to be imported without errors
## Screenshots
If applicable, add screenshots to help explain your problem.
## System Information
- OS: WSL2
- OS Version: Ubuntu 20.04.6 LTS
- Language Version: Python 3.9.19
- Package Manager Version: conda 24.4.0
- Browser (if applicable): Google Chrome
- Browser Version (if applicable): 125.0.6422.114
## Additional Context
Add any other context about the problem here.
Description
I followed the instructions to the Federated Learning exercise in the Foundations of Private Computation course. I tried setting up the conda environment to run the tutorial code, following issues such as #423. However, I am still unable to import the
syft
library.How to Reproduce
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/init.py:59 57 from syft.core.node.vm.vm import VirtualMachineClient # noqa: F401 58 from syft.core.plan.plan import Plan # noqa: F401 ---> 59 from syft.core.plan.plan_builder import make_plan # noqa: F401 60 from syft.experimental_flags import flags # noqa: F401 61 from syft.grid.client.client import login # noqa: F401
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/core/plan/plan_builder.py:15 12 from .plan import Plan 14 PLAN_BUILDER_VM: PlanVirtualMachine = PlanVirtualMachine(name="plan_vm") ---> 15 ROOT_CLIENT: Client = PLAN_BUILDER_VM.get_root_client() 18 def build_plan_inputs(forward_func: Callable) -> Dict[str, Pointer]: 19 signature = inspect.signature(forward_func)
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/core/node/common/node.py:289, in Node.get_root_client(self, routes) 288 def get_root_client(self, routes: Optional[List[Route]] = None) -> ClientT: --> 289 client: ClientT = self.get_client(routes=routes) 290 self.root_verify_key = client.verify_key 291 return client
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/core/node/common/node.py:277, in Node.get_client(self, routes) 274 setattr(solo, "name", f"Route ({self.name} <-> {self.name} Client)") 275 routes = [solo] --> 277 return self.client_type( # type: ignore 278 name=self.name, 279 routes=routes, 280 network=self.network, 281 domain=self.domain, 282 device=self.device, 283 vm=self.vm, 284 signing_key=None, # DO NOT PASS IN A SIGNING KEY!!! The client generates one. 285 verify_key=None, # DO NOT PASS IN A VERIFY KEY!!! The client generates one. 286 )
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/core/node/vm/client.py:34, in VirtualMachineClient.init(self, name, routes, vm, network, domain, device, signing_key, verify_key) 23 def init( 24 self, 25 name: Optional[str], (...) 32 verify_key: Optional[VerifyKey] = None, 33 ): ---> 34 super().init( 35 name=name, 36 routes=routes, 37 network=network, 38 domain=domain, 39 device=device, 40 vm=vm, 41 signing_key=signing_key, 42 verify_key=verify_key, 43 ) 45 self.post_init()
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/core/node/common/client.py:91, in Client.init(self, name, routes, network, domain, device, vm, signing_key, verify_key) 88 else: 89 self.verify_key = verify_key ---> 91 self.install_supported_frameworks() 93 self.store = StoreClient(client=self)
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/core/node/common/client.py:124, in Client.install_supported_frameworks(self) 123 def install_supported_frameworks(self) -> None: --> 124 self.lib_ast = create_lib_ast(client=self) 126 # first time we want to register for future updates 127 self.lib_ast.register_updates(self)
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/init.py:244, in create_lib_ast(client) 238 lib_ast.syft.core.add_attr( 239 "remote_dataloader", remote_dataloader_ast.syft.core.remote_dataloader 240 ) 242 # let the misc creation be always the last, as it needs the full ast solved 243 # to properly generated unions --> 244 union_misc_ast = getattr(getattr(create_union_ast(lib_ast, client), "syft"), "lib") 245 lib_ast.syft.lib.add_attr(attr_name="misc", attr=union_misc_ast.attrs["misc"]) 247 return lib_ast
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/misc/init.py:92, in create_union_ast(lib_ast, client) 84 classes.append( 85 ( 86 f"syft.lib.misc.union.{klass.name}", (...) 89 ) 90 ) 91 union_types = lazy_pairing[klass] ---> 92 allowed_functions = get_allowed_functions(lib_ast, union_types) 93 for target_method, allowed in allowed_functions.items(): 94 if not allowed:
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/misc/init.py:67, in get_allowed_functions(lib_ast, union_types) 65 for union_type in union_types: 66 real_type_function_set = solve_real_type_functions(union_type) ---> 67 ast_type_function_set = solve_ast_type_functions(union_type, lib_ast) 68 rejected_function_set = real_type_function_set - ast_type_function_set 69 for accepted_function in ast_type_function_set:
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/cachetools/init.py:737, in cached..decorator..wrapper(*args, *kwargs)
735 except KeyError:
736 pass # key not found
--> 737 v = func(args, **kwargs)
738 try:
739 cache[k] = v
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/lib/misc/init.py:28, in solve_ast_type_functions(path, lib_ast) 26 root = lib_ast 27 for path_element in path.split("."): ---> 28 root = getattr(root, path_element) 29 return root.attrs.keys()
File ~/miniconda3/envs/openmined-courses/lib/python3.9/site-packages/syft/ast/module.py:256, in Module.getattribute(self, item) 247 def getattribute(self, item: str) -> Any: 248 """Get Attribute of a
module
. 249 250 Args: (...) 254 The value of the attribute. 255 """ --> 256 target_object = super().getattribute(item) 257 if isinstance(target_object, ast.static_attr.StaticAttribute): 258 return target_object.get_remote_value()AttributeError: 'Globals' object has no attribute 'pandas'