LiroyvH / signal-export

Export and backup your Signal chats to markdown files with attachments, in a format that can be exported to PDF.
Other
45 stars 6 forks source link

ModuleNotFoundError: No module named 'pysqlcipher3' #1

Closed veritas06 closed 1 year ago

veritas06 commented 1 year ago

I followed your guide on my M1 device, but am still having issues with the pysqlcipher3 package.

2:07 smc@M1-MBA /Users/smc/Development/signal-export
% pip3 install -r requirements.txt
Requirement already satisfied: beautifulsoup4 in /Users/smc/Library/Python/3.10/lib/python/site-packages (from -r requirements.txt (line 1)) (4.11.2)
Requirement already satisfied: Click>=7.0 in /Users/smc/Library/Python/3.10/lib/python/site-packages (from -r requirements.txt (line 2)) (8.1.3)
Requirement already satisfied: Markdown>=3.0 in /Users/smc/Library/Python/3.10/lib/python/site-packages (from -r requirements.txt (line 3)) (3.4.1)
Collecting pysqlcipher3>=1.0.3
  Using cached pysqlcipher3-1.2.0.tar.gz (102 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: soupsieve>1.2 in /Users/smc/Library/Python/3.10/lib/python/site-packages (from beautifulsoup4->-r requirements.txt (line 1)) (2.3.2.post1)
Building wheels for collected packages: pysqlcipher3
  Building wheel for pysqlcipher3 (setup.py) ... done
  WARNING: Legacy build of wheel for 'pysqlcipher3' created no files.
  Command arguments: /opt/homebrew/opt/python@3.10/bin/python3.10 -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/private/var/folders/d0/2m05jdy11x3cxfy4gwpmy4800000gn/T/pip-install-rip89c7e/pysqlcipher3_faa8aaab8f6d473d88a68657416e5cb7/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /private/var/folders/d0/2m05jdy11x3cxfy4gwpmy4800000gn/T/pip-wheel-nwic9yaw
  Command output: [use --verbose to show]
  Running setup.py clean for pysqlcipher3
Failed to build pysqlcipher3
Installing collected packages: pysqlcipher3
  Running setup.py install for pysqlcipher3 ... done
Successfully installed pysqlcipher3
2:07 smc@M1-MBA /Users/smc/Development/signal-export
% ls
LICENSE           MacEasyInstall.sh README.md         requirements.txt  sigexport.py      style.css
2:08 smc@M1-MBA /Users/smc/Development/signal-export
% ./sigexport.py 
Traceback (most recent call last):
  File "/Users/smc/Development/signal-export/./sigexport.py", line 12, in <module>
    from pysqlcipher3 import dbapi2 as sqlcipher
ModuleNotFoundError: No module named 'pysqlcipher3'
2:08 smc@M1-MBA /Users/smc/Development/signal-export
%
jonasjberg commented 1 year ago

@veritas06 I ran into the same issue, worked around it by following this: https://github.com/rigglemania/pysqlcipher3/issues/19#issuecomment-1079158635

I managed to install the package by doing exactly this:

SQLCIPHER_PATH="/opt/homebrew/Cellar/sqlcipher/4.5.3"
export LIBRARY_PATH="$SQLCIPHER_PATH/lib"
export C_INCLUDE_PATH="$SQLCIPHER_PATH/include"
pip3 install -r requirements.txt --user

You need to verify/tweak SQLCIPHER_PATH, refer to above linked instructions.

veritas06 commented 1 year ago

Thanks Jonas. I forget how I did end up getting a backup working, but I will make note & give this a try too.

Thank you!

LiroyvH commented 1 year ago

Sorry for the late response, glad to read you both managed to sort it out. This package randomly gives headaches, it's important to get the arch right. But for me it randomly completely broke in bash as well and then would suddenly work in zsh. It's temperamental. But oh well. :) I'll check if the solution provided by @jonasjberg can be implemented in the setup. Also will add a dirty-written bash script to generate new backups once the environment is settled in, will make things easier.