18

I am trying to decrypt one database file using Python 3.7. To decrypt it, I have to use pysqlcipher3 version for python 3.7. To install it, I have tried by using both commands:

pip3 install pysqlcipher3

and

pip install pysqlcipher3

and both the commands have showed successful installation of the pysqlcipher package. However, when I try to import pysqlcipher3 in my Python project by using this line:

from pysqlcipher3 import dbapi2 as sqlite

it displays this error:

ModuleNotFoundError: No module named 'pysqlcipher3

I have checked various GitHub projects, but none of them provide a clear working solution. The Python packages website says to install libsqlcipher in your OS but this time the issue is same, no documentation and link regarding for the installation of libsqlcipher for Windows 10. Can anyone provide me with proper installation steps, or any document, or any video tutorial, regarding the same? Or is there some issue with the import statement?

8
  • 3
    It is likely that your environment has two Python installations and the version of pip.exe that you called is the one for the environment you don't expect. Navigate to the folder under Python37 where pip.exe is installed (in Windows it is in Scripts) and run it from there.
    – BoarGules
    Commented Jan 10, 2019 at 12:19
  • Make sure you used relevant pip (can run: which pip) with the python interpeter you are using
    – Aaron_ab
    Commented Jan 10, 2019 at 12:33
  • @Aaron_ab I have previously tried by installing many other packages using pip from cmd and they work fine.
    – sak
    Commented Jan 10, 2019 at 12:55
  • 1
    @TheOnionMaster Well i uninstalled everything and installed it by using pip3, it worked but still not able to decrypt the db.Its a very complicated process for windows and was not that worth to spend time upon plus there is not any single complete guide to do this so you need to collect data from various sources.
    – sak
    Commented Feb 22, 2019 at 10:32
  • What is the name of your python file?
    – Nick
    Commented Feb 7, 2020 at 14:38

7 Answers 7

1

You need to install de library libsqlcipher-dev from your repository manager, for example:

sudo apt install libsqlcipher-dev

1

This worked for me on Ubuntu:

$ git clone https://github.com/coleifer/sqlcipher3
$ cd sqlcipher3
$ python setup.py build  # Build against the system libsqlcipher
$ sudo python setup.py install
$ cd ..

Then enter a Python prompt and try:

from sqlcipher3 import dbapi2 as sqlcipher
0

Check if you have multiple pip installations by using
where pip

Also, check the interpreter being used in your project. Make sure it matches the python interpreter corresponding to the pip installation where the module was installed.

0

You might have to install libsqlcipher from source.

From https://github.com/sqlcipher/sqlcipher

Using MSVC

On Windows, all applicable build products can be compiled with MSVC. First open the command prompt window associated with the desired compiler version (e.g. "Developer Command Prompt for VS2013"). Next, use NMAKE with the provided "Makefile.msc" to build one of the supported targets.

For example:

mkdir bld
cd bld
nmake /f Makefile.msc TOP=..\sqlite
nmake /f Makefile.msc sqlite3.c TOP=..\sqlite
nmake /f Makefile.msc sqlite3.dll TOP=..\sqlite
nmake /f Makefile.msc sqlite3.exe TOP=..\sqlite
nmake /f Makefile.msc test TOP=..\sqlite

There are several build options that can be set via the NMAKE command line. For example, to build for WinRT, simply add "FOR_WINRT=1" argument to the "sqlite3.dll" command line above. When debugging into the SQLite code, adding the "DEBUG=1" argument to one of the above command lines is recommended.

SQLite does not require Tcl to run, but a Tcl installation is required by the makefiles (including those for MSVC). SQLite contains a lot of generated code and Tcl is used to do much of that code generation.

0

go checkout where your pip from by using pip -V, it outputs the pip path to you.

Check if this path is in the venv you want. If not, the package was installed in a wrong path.

-1

Check if you have multiple python versions installed on your Operating System. Also if you are using a virtual environment you should activate that before installing any packages.

1
-2

You'll need to install sqlcipher and the python library pysqlcipher3 with something like:

brew install sqlcipher
pip3 install pysqlcipher3 --user

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.