1

Please seeking help from expert: When I am using pysyft library in python I am getting this error ( AttributeError: module 'syft' has no attribute 'TorchHook')

Here is my code screenshot [1]: https://i.stack.imgur.com/rPxWw.png

my environment : Spyder (Python IDE) Ubuntu 20.04 python3

  • [It doesn't exist on the version you're working with](https://github.com/OpenMined/PySyft/issues/4820) – Hampus Larsson Mar 04 '21 at 21:57
  • Thanks for your response ..How can I update the suitable version and Which version? – Shahedul Islam Mar 04 '21 at 22:04
  • There is a FAQ linked in the link. It was supported on an older version, you should probably find another guide that is based on a newer version of the codebase. – Hampus Larsson Mar 04 '21 at 22:07
  • Please share the solution as your own answer to your question! Others might have the same problem, and they will then be able to use your found solution once they find this thread. – Hampus Larsson Mar 05 '21 at 22:18
  • 'syft' -- 'TorchHook' is available in version 0.2.x. I got this problem because I installed 0.3xx version. Solution: I installed both versions in my machine – Shahedul Islam Mar 06 '21 at 15:14

2 Answers2

5

The version of syft you are using is v0.3.0+. It does not contain syft.TorchHook as I believe I read that it is not needed there. Use pip install syft==0.2.9 to use syft.TorchHook(). Especially if you are following that Secure and Private Course from Andrew Trask, Openmined.

Note that if you are indeed following that course, a new updated course has been introduced by the Openmined team. See https://courses.openmined.org/courses/foundations-of-private-computation for more details. It is based on an updated version of syft.

Delton Myalil
  • 287
  • 1
  • 7
  • So is there a documentation for the latest syft ? I am interested in doing some FL experimentation and I am not able to find any new code for doing so. – Jaswin Apr 12 '21 at 12:44
  • refer [this link](https://github.com/OpenMined/PySyft/issues/5507), because as OpenMind Dev. stated the 0.3.0 version is deprecated at now . – nipun Dec 09 '21 at 17:36
1

I would like to add one additional issue: if you found the following problem when using PIP install syft==0.2.9

Could not find a version that satisfies the requirement torch~=1.4.0 (from syft) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)

You can refer to the following methods to solve:

pip install syft -f https://download.pytorch.org/whl/torch_stable.html

Reason:

  1. Not all PyTorch versions are available on Python's package registry PyPI.

  2. -f : adding the custom registry

    -f, --find-links <url>

    If a URL or path to an html file, then parse for links to archives such as sdist (.tar.gz) or wheel (.whl) files. If a local path or file:// URL that’s a directory, then look for archives in the directory listing. Links to VCS project URLs are not supported.

  3. refer to this link

Lee Daron
  • 11
  • 2