freedomofpress / securedrop-signal-poc

prototype e2e server and source + journalist clients for securedrop
GNU General Public License v3.0
5 stars 3 forks source link

cannot import name 'sealed_sender' from 'signal_protocol' #24

Closed eloquence closed 3 years ago

eloquence commented 3 years ago

In spite of installing the updated version in requirements.txt (per #1), I am getting

Traceback (most recent call last):
  File "journalist.py", line 9, in <module>
    from signal_protocol import address, curve, identity_key, storage, sealed_sender, session, session_cipher, state, protocol
ImportError: cannot import name 'sealed_sender' from 'signal_protocol' (/home/erik/.virtualenvs/e2e/lib/python3.7/site-packages/signal_protocol/__init__.py)

when attempting to run journalist.py per the README. I installed signal-protocol in a virtualenv via pip install -r requirements.txt:

$ pip install -r requirements.txt 
Requirement already satisfied: signal-protocol==0.2.2 in /home/erik/.virtualenvs/e2e/lib/python3.7/site-packages (from -r requirements.txt (line 1)) (0.2.2)
Requirement already satisfied: signal-groups==0.1.0 in /home/erik/.virtualenvs/e2e/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (0.1.0)
redshiftzero commented 3 years ago

this is definitely due to sealed_sender being added in 0.2.2 since the other submodules are getting imported. Can you try blowing away your virtualenv and recreating? (I'm currently not sure why that would be happening... 🤔 )

redshiftzero commented 3 years ago

Another idea if that doesn't work is to try installing with the option --no-cache-dir (such that pip's cache is not used)

eloquence commented 3 years ago

Still no dice, here's what I'm doing (this is a brand new venv):

erik@foundation ~/Code/securedrop-e2e (main) $ mkvirtualenv -v -p /usr/bin/python3.7 e2e3
find interpreter for spec PythonSpec(path=/usr/bin/python3.7)
proposed PythonInfo(spec=CPython3.7.10.final.0-64, exe=/usr/bin/python3.7, platform=linux, version='3.7.10 (default, May  3 2021, 02:44:43) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8)
create virtual environment via CPython3Posix(dest=/home/erik/.virtualenvs/e2e3, clear=False, global=False)
add seed packages via FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/erik/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
changing mode of /home/erik/.virtualenvs/e2e3/bin/wheel3 to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/wheel-3.7 to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/wheel to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/easy_install3 to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/easy_install-3.7 to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/easy_install to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/pip3 to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/pip to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/pip3.7 to 775
changing mode of /home/erik/.virtualenvs/e2e3/bin/pip-3.7 to 775
add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh
created virtual environment CPython3.7.10.final.0-64 in 148ms
  creator CPython3Posix(dest=/home/erik/.virtualenvs/e2e3, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/erik/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
virtualenvwrapper.user_scripts creating /home/erik/.virtualenvs/e2e3/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/erik/.virtualenvs/e2e3/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/erik/.virtualenvs/e2e3/bin/preactivate
virtualenvwrapper.user_scripts creating /home/erik/.virtualenvs/e2e3/bin/postactivate
virtualenvwrapper.user_scripts creating /home/erik/.virtualenvs/e2e3/bin/get_env_details
(e2e3) erik@foundation ~/Code/securedrop-e2e (main) $ pip install --no-cache-dir -r requirements.txt 
Collecting signal-protocol==0.2.2
  Downloading signal_protocol-0.2.2-cp37-cp37m-macosx_10_14_x86_64.manylinux2014_x86_64.whl (8.2 MB)
     |████████████████████████████████| 8.2 MB 5.0 MB/s 
Collecting signal-groups==0.1.0
  Downloading signal_groups-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl (13.7 MB)
     |████████████████████████████████| 13.7 MB 49.9 MB/s 
Installing collected packages: signal-protocol, signal-groups
Successfully installed signal-groups-0.1.0 signal-protocol-0.2.2
(e2e3) erik@foundation ~/Code/securedrop-e2e (main) $ python3 journalist.py 
Traceback (most recent call last):
  File "journalist.py", line 3, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
(e2e3) erik@foundation ~/Code/securedrop-e2e (main) $ pip install requests
Collecting requests
  Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.6-py2.py3-none-any.whl (138 kB)
Collecting chardet<5,>=3.0.2
  Using cached chardet-4.0.0-py2.py3-none-any.whl (178 kB)
Collecting idna<3,>=2.5
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Installing collected packages: certifi, urllib3, chardet, idna, requests
Successfully installed certifi-2021.5.30 chardet-4.0.0 idna-2.10 requests-2.25.1 urllib3-1.26.6
(e2e3) erik@foundation ~/Code/securedrop-e2e (main) $ python3 journalist.py 
Traceback (most recent call last):
  File "journalist.py", line 9, in <module>
    from signal_protocol import address, curve, identity_key, storage, sealed_sender, session, session_cipher, state, protocol
ImportError: cannot import name 'sealed_sender' from 'signal_protocol' (/home/erik/.virtualenvs/e2e3/lib/python3.7/site-packages/signal_protocol/__init__.py)
redshiftzero commented 3 years ago

I think there may be an issue with the wheel you are using on Linux only, try building on latest main: (f3cf8422563dc66b06c70d5f52a4145370c9756a) which should use the regular manylinux wheel

eloquence commented 3 years ago

That did indeed resolve, thanks! :)