Pysyft: module 'torch._C' has no attribute 'Function' - error when importing syft

Created on 30 Jan 2020  路  4Comments  路  Source: OpenMined/PySyft

Describe the bug
I'm having a lot of troubles installing pysyft on Ubuntu 18.04. I cloned the repo and tried to install it according to those instructions:
Install Python 3.6 or higher Install PyTorch 1.3 Clone PySyft (git clone https://github.com/OpenMined/PySyft.git) cd PySyft pip install -r pip-dep/requirements.txt pip install -r pip-dep/requirements_udacity.txt python setup.py install udacity python setup.py test
I managed to install all requirements but then got an error on the second to last step (python setup.py install udacity) saying error: invalid command 'udacity'

I then tried to install pysyft using pip install syft and it was successful but when I'm trying to import it I get the following error (AttributeError: module 'torch._C' has no attribute 'Function')

What should I do to be able to use pysyft?

````

AttributeError Traceback (most recent call last)
in
----> 1 import syft

~/.local/lib/python3.6/site-packages/syft/__init__.py in
41
42 # Import grids
---> 43 from syft.grid.private_grid import PrivateGridNetwork
44 from syft.grid.public_grid import PublicGridNetwork
45

~/.local/lib/python3.6/site-packages/syft/grid/private_grid.py in
9 # Syft imports
10 from syft.grid.abstract_grid import AbstractGrid
---> 11 from syft.workers.node_client import NodeClient
12 from syft.messaging.plan.plan import Plan
13 from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor

~/.local/lib/python3.6/site-packages/syft/workers/node_client.py in
5
6 # Syft imports
----> 7 from syft.serde import serialize
8 from syft.messaging.plan import Plan
9 from syft.codes import REQUEST_MSG, RESPONSE_MSG

~/.local/lib/python3.6/site-packages/syft/serde/__init__.py in
----> 1 from syft.serde.serde import *

~/.local/lib/python3.6/site-packages/syft/serde/serde.py in
10 from syft.workers.abstract import AbstractWorker
11
---> 12 from syft.serde import msgpack
13
14 ## SECTION: High Level Public Functions (these are the ones you use)

~/.local/lib/python3.6/site-packages/syft/serde/msgpack/__init__.py in
----> 1 from syft.serde.msgpack import serde
2 from syft.serde.msgpack import native_serde
3 from syft.serde.msgpack import torch_serde
4 from syft.serde.msgpack import proto
5

~/.local/lib/python3.6/site-packages/syft/serde/msgpack/serde.py in
79
80 if dependency_check.torch_available:
---> 81 from syft.serde.msgpack.torch_serde import MAP_TORCH_SIMPLIFIERS_AND_DETAILERS
82 else:
83 MAP_TORCH_SIMPLIFIERS_AND_DETAILERS = {}

~/.local/lib/python3.6/site-packages/syft/serde/msgpack/torch_serde.py in
295 torch.device: (_simplify_torch_device, _detail_torch_device),
296 torch.jit.ScriptModule: (_simplify_script_module, _detail_script_module),
--> 297 torch._C.Function: (_simplify_script_module, _detail_script_module),
298 torch.jit.TopLevelTracedModule: (_simplify_script_module, _detail_script_module),
299 torch.nn.Parameter: (_simplify_torch_parameter, _detail_torch_parameter),

AttributeError: module 'torch._C' has no attribute 'Function'
````

Most helpful comment

@s-marta Just published a new release that we think should address this issue. Could you give it a try and let us know if that resolves your issue?

All 4 comments

I think we need to spin a new pysyft version? @karlhigley

@s-marta Just published a new release that we think should address this issue. Could you give it a try and let us know if that resolves your issue?

@karlhigley I updated and it seems to be working! I managed to import it and basics from the first tutorial seem to be working as well. Many thanks for such quick help.

Thanks for letting us know!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmuraru picture gmuraru  路  4Comments

gmuraru picture gmuraru  路  4Comments

tblazina picture tblazina  路  3Comments

akirahirohito picture akirahirohito  路  3Comments

IonesioJunior picture IonesioJunior  路  3Comments