user6374210
user6374210

Reputation:

Python 2.7 The 'packaging' package is required; normally this is bundled with this package

I expect this has to do with the cryptography module, but I'm not sure.

Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "c:\python27\lib\site-packages\PyInstaller-2.1-py2.7.egg\PyInstaller\load
er\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\Stuff\Encrypt\build\encrypt\out00-PYZ.pyz\pkg_resources", li
ne 68, in <module>
  File "C:\Python34\Stuff\Encrypt\build\encrypt\out00-PYZ.pyz\pkg_resources.exte
rn", line 60, in load_module
ImportError: The 'packaging' package is required; normally this is bundled with
this package so if you get this warning, consult the packager of your distributi
on.

And source:

import os, sys, getpass, time
from cryptography.fernet import Fernet
from tqdm import tqdm
from time import gmtime, strftime
import subprocess
name = getpass.getuser()
print strftime("%Y-%m-%d %I:%M:%S")
print "NOTE: Encrypting will delete all data in either .txt, so please save the data."
print "-------------------------------------------------------------------------------"
def copy2clip(txt):
   cmd='echo '+txt.strip()+'|clip'
   return subprocess.check_call(cmd, shell=True)
def delete():
    try:
        os.remove("key.txt")
        os.remove("Encryption.txt")
    except:
        print "Error, files not deleted."
def encrypt():
    input = raw_input("Please enter what you want to be encrypted: ")
    for i in tqdm(range(100)):
        time.sleep(0.01)
    key = Fernet.generate_key()
    cipher_suite = Fernet(key)
    cipher_text = cipher_suite.encrypt(input)
    plain_text = cipher_suite.decrypt(cipher_text)
    time.sleep(1)
    print "Encryption completed..."
    #save

    f = open("encryption.txt", "w")
    f.write(cipher_text)
    f.close()
    time.sleep(1)
    print "Encryption data saved to encryption.txt and copied to clipboard..."
    copy2clip(cipher_text)

    d = open("key.txt", "w")
    d.write(key + "\n\n")
    d.close()
    time.sleep(1)
    print "Key data saved to key.txt..."
    time.sleep(5)
while True:
    encrypt()
    os.system('cls')
    print strftime("%Y-%m-%d %I:%M:%S")
    print "NOTE: Encrypting will delete all data in either .txt, so please save the data."
    print "-------------------------------------------------------------------------------"

time.sleep(5)

I noticed a file named cryptography.hazmat.bindings._padding.pyd, and I saw somewhere people were having problems with it. Do I need to edit the hook or something?

Upvotes: 0

Views: 3434

Answers (2)

Xavi Mart&#237;nez
Xavi Mart&#237;nez

Reputation: 2161

Try this

pip uninstall setuptools
pip install setuptools==19.2

Upvotes: 3

user6374210
user6374210

Reputation:

Updated with the newest version of pyinstaller, it's now working.

Upvotes: -2

Related Questions