Chipwhisperer 5 - Unable to import chipwhisperer module

Hello. I am using the chipwhisperer lite board along with the CW305.

I have installed CW5 via the git repo and through the latest release, and am getting this error either way when trying to run the PA_HW_CW305_1-Attacking_AES_on_an_FPGA tutorial in jupyter notebook.


ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import chipwhisperer as cw
2
3 scope = cw.scope()
4 scope.gain.db = 25
5 scope.adc.samples = 129

ModuleNotFoundError: No module named ‘chipwhisperer’

I am using Ubuntu 18.04.2 LTS as my operating system. I have Python 2.7.15+ installed as alias python, Python 3.6.8 installed as alias python3. Both versions of python have jupyter notebooks installed. In jupyter notebooks, I am running the Python 3 kernel.

I have attached a picture as well to help show the error. Any ideas on what could possibly be causing this?

I should note that I do not have this problem on another computer that I use with the same operating system and settings. However, even though the tests on that computer run successfully, the results are erroneous compared to CW4. I posted this issue in a separate thread.

Hi, did you follow all the steps here? If your “python” == python2.7, then you’ll have to substitute “python3” wherever you see “python” in the installation instructions.
Jean-Pierre

It was not that I was using python 2.7, but instead it was because I was following the wrong instructions (https://wiki.newae.com/V5:Installing_ChipWhisperer). Thanks for linking the correct instructions!

Actually, just kidding. I am using several computers and got confused about which computer I was talking about. The computer that has the error upon “import chipwhisperer” still has this error despite me reinstalling chipwhisperer using the better instructions. Any ideas?

Sounds like a Python installation problem.
Look at the output of:

import sys
sys.path

If you installed CW in develop mode as per the instructions, then you should see the path to CW in there (e.g. for me: 'c:\\users\\jp\\github\\cw_develop\\software').
Figure out why it’s not there. Did something go wrong when you ran python -m pip install -e . --user?
I think there is a verbose switch that will tell you exactly what it’s doing.

Jean-Pierre

It seems that everything is correct in Python if I’m understanding your instructions properly. I have downloaded Chipwhisperer 5 into a folder named “chipwhisperer5”, I believe that I have the correct folder added to sys path, specifically, “/home/jackie/chipwhisperer5/software”

Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import sys
sys.path
[‘’, ‘/usr/lib/python36.zip’, ‘/usr/lib/python3.6’, ‘/usr/lib/python3.6/lib-dynload’, ‘/home/jackie/.local/lib/python3.6/site-packages’, ‘/home/jackie/chipwhisperer5/software’, ‘/usr/local/lib/python3.6/dist-packages’, ‘/usr/lib/python3/dist-packages’]

Everything also seems to have been set up properly from what I can tell based on the output for my install user command:

~/chipwhisperer5$ python3 -m pip install -e . --user
Obtaining file:///home/jackie/chipwhisperer5
Requirement already satisfied: configobj in /home/jackie/.local/lib/python3.6/site-packages (from chipwhisperer==5.1.1) (5.0.6)
Requirement already satisfied: pyserial in /home/jackie/.local/lib/python3.6/site-packages (from chipwhisperer==5.1.1) (3.4)
Requirement already satisfied: numpy in /home/jackie/.local/lib/python3.6/site-packages (from chipwhisperer==5.1.1) (1.17.4)
Requirement already satisfied: pyusb in /home/jackie/.local/lib/python3.6/site-packages (from chipwhisperer==5.1.1) (1.0.2)
Requirement already satisfied: scipy in /home/jackie/.local/lib/python3.6/site-packages (from chipwhisperer==5.1.1) (1.3.2)
Requirement already satisfied: six in /home/jackie/.local/lib/python3.6/site-packages (from configobj->chipwhisperer==5.1.1) (1.11.0)
Installing collected packages: chipwhisperer
Found existing installation: chipwhisperer 5.1.1
Uninstalling chipwhisperer-5.1.1:
Successfully uninstalled chipwhisperer-5.1.1
Running setup.py develop for chipwhisperer
Successfully installed chipwhisperer

I also am running my jupyter notebook script as Python 3 kernel.

After playing around a bit, I saw that it looked like chipwhisperer loads fine in a python3 terminal. So I figured the issue was with Jupyter Notebooks, which it was. Even though it already had a Python3 kernel, it was not actually properly installed. I fixed it with the following commands:

python2 -m pip install ipykernel
python2 -m ipykernel install --user

python3 -m pip install ipykernel
python3 -m ipykernel install --user

However, I now have another error which I will post in a separate forum to keep things a bit more clean. In short, it throws an error about not having a languid when I try to set up the scope. Thanks for your advice!

Hi Jackie,

There are surely many ways to successfully install, and so maybe your approach can work but it’s not what our documentation calls for.

Assuming you installed CW from Git, then this would install Jupyter for you:
pip install -r jupyter/requirements.txt --user

(from https://chipwhisperer.readthedocs.io/en/latest/installing.html#install-repo-releases)

1 Like

Hello,

I am also new to chipwhisperer (using CW1173 ChipWhisperer-Lite - NewAE Hardware Product Documentation) and I have followed the same instructions under Windows Manual install heading as per : Windows Installation — ChipWhisperer 5.7.0 documentation . However, I am facing the same issue, when I give the command
import chipwhisperer as cw in jupyter notebook,
ModuleNotFoundError: No module named ‘chipwhisperer’

it would be great if someone can help me out here !