OpenMined / PySyft

Perform data science on data that remains in someone else's server
https://www.openmined.org/
Apache License 2.0
9.54k stars 1.99k forks source link

PySift import issue #243

Closed MarcoROG closed 7 years ago

MarcoROG commented 7 years ago

I have installed PySift following the installation guidelines. After downloading the repository I ran sudo pip3 install -r requirements.txt and sudo python3 setup.py install

Now, when I run the example (Paillier HE) I get this:

ImportError                               Traceback (most recent call last)
<ipython-input-5-a23a6dd7c309> in <module>()
----> 1 from syft.he.paillier import KeyPair, PaillierTensor
      2 from syft import TensorBase
      3 import numpy as np

ImportError: No module named syft

Whereas, if I run python3 from my terminal and execute from syft import TensorBase I get:

  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/usr/local/lib/python3.4/dist-packages/syft-0.1.0-py3.4.egg/syft/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/usr/local/lib/python3.4/dist-packages/syft-0.1.0-py3.4.egg/syft/he/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/usr/local/lib/python3.4/dist-packages/syft-0.1.0-py3.4.egg/syft/he/paillier/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/usr/local/lib/python3.4/dist-packages/syft-0.1.0-py3.4.egg/syft/he/paillier/basic.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2164, in _find_spec
  File "<frozen importlib._bootstrap>", line 1940, in find_spec
  File "<frozen importlib._bootstrap>", line 1916, in _get_spec
  File "<frozen importlib._bootstrap>", line 1897, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 863, in spec_from_loader
  File "<frozen importlib._bootstrap>", line 904, in spec_from_file_location
  File "/usr/local/lib/python3.4/dist-packages/syft-0.1.0-py3.4.egg/syft/tensor.py", line 1089
SyntaxError: can use starred expression only as assignment target
iamtrask commented 7 years ago

does it work if you don't use sudo?

MarcoROG commented 7 years ago

It won't let me run the python: running install error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/test-easy-install-11054.write-test'
MarcoROG commented 7 years ago

Running pip3 freeze I can see syft is installed

MarcoROG commented 7 years ago

Ok, setting PYTHONPATH environment variable tells jupyter to use python3 and fixes the first issue

MarcoROG commented 7 years ago

Solved by upgrading to Python 3.5

iamtrask commented 7 years ago

+1 On Thu, Sep 21, 2017 at 10:11 PM, Marco Bellan notifications@github.com wrote:

Solved by upgrading to Python 3.5

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenMined/PySyft/issues/243#issuecomment-331283062, or mute the thread https://github.com/notifications/unsubscribe-auth/AEIMkomTkARLbX7vRkCi7YwjyU0P-C3eks5sktDogaJpZM4PfP8p .