Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error]: No module named charm #295

Open
redshark314 opened this issue May 22, 2023 · 3 comments
Open

[Error]: No module named charm #295

redshark314 opened this issue May 22, 2023 · 3 comments

Comments

@redshark314
Copy link

I installed charm by following this link
https://zhuanlan.zhihu.com/p/447934026

The installation works and the charm package is installed in /usr/local/src/charm-dev
When I use python3 -> import charm in that path, it works.

But when I use it anywhere else, it gives the error. No module named 'charm'

My question is, why is it so? Also, how can I make it work from anywhere in the system?

@suiahae
Copy link

suiahae commented Jun 6, 2023

Since there is no more information, I can only guess that the python you are using and the one you have installed are not the same.

@Beerander
Copy link

In fact, you can install charm in your project directly

@Sumasrikanth
Copy link

After following these steps i installed charm
As far as I know, Charm does not work with Python 3.8+ versions: the default branch is a dev branch, and the latest stable release dates back to 2011!

The first thing to do is to set-up a Python 3.7.1 environment. We start by downloading Python 3.7 binaries.

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7 python3.7-dev

Then we can install virtualenv to manage the virtual environment; we name this environment py37 and, finally, we activate it.

sudo apt install virtualenv
virtualenv -p /usr/bin/python3.7 py37
source py37/bin/activate

Dependencies

Charm relies on some libraries. So we can install them by running

sudo apt-get install -y libgmp10 libgmp-dev
sudo apt-get install -y openssl

At this point, we can clone the Charm GitHub repository and install all the other dependencies

git clone https://github.com/JHUISI/charm
cd charm
pip install -r requirements.txt

Build

We try to build Charm running the following commands

./configure.sh
cd ./deps/pbc && make && sudo ldconfig && cd -
make
make install && sudo ldconfig

Test

To assess that the installation is successful, we can run the test suite

make test

Have fun with Charm!

Once the installation finishes and the test suite passes (despite some warnings), we are ready to prototype cryptographic systems from scratch or on top of already-implemented schemes: take a look at the official documentation.

after installing:

pip show charm-crypto
Name: Charm-Crypto
Version: 0.50
Summary: Charm is a framework for rapid prototyping of cryptosystems
Home-page: http://charm-crypto.io/
Author: J. Ayo Akinyele
Author-email: [email protected]
License: LGPL
Location: /usr/local/lib/python3.8/dist-packages/Charm_Crypto-0.50-py3.8-linux-x86_64.egg
Requires: hypothesis, pyparsing, setuptools
Required-by:
when iam running this sample program
from charm.toolbox.pairinggroup import PairingGroup, ZR, G1
group = PairingGroup('MNT159')
g = group.random(G1)
h = group.random(G1)
private_key = group.random(ZR)
public_key = g ** private_key
e_gg = group.pair_prod(g, g)
e_hh = group.pair_prod(h, h)
shared_key_1 = e_gg ** private_key
shared_key_2 = e_hh ** private_key
print(shared_key_1)
print(shared_key_2)

When it is executed show this error...
Traceback (most recent call last):
File "sairam.py", line 1, in
from charm.toolbox.pairinggroup import PairingGroup, ZR, G1
File "", line 259, in load_module
File "/usr/local/lib/python3.8/dist-packages/UNKNOWN-0.0.0-py3.8.egg/charm/init.py", line 5, in
ModuleNotFoundError: No module named 'charm.core.benchmark'
please help me out.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants