title: Creating password using Python passlib
body: <p>I'm trying to use the following that another user posted as an answer to a different question:</p>
  
  <pre><code>&gt;&gt;&gt; # import the hash algorithm
  &gt;&gt;&gt; from passlib.hash import sha256_crypt
  
  &gt;&gt;&gt; # generate new salt, and hash a password
  &gt;&gt;&gt; hash = sha256_crypt.encrypt("toomanysecrets")
  &gt;&gt;&gt; hash
  </code></pre>
  
  <p>But when I type <code>from passlib.hash import sha256_crypt</code> I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):   File "&lt;stdin&gt;", line 1, in
  &lt;module&gt; ImportError: No module named passlib.hash
  &gt;&gt;&gt;
  </code></pre>
  
  <p>I have already done <code>pip install passlib</code>. Any ideas?</p>
  
  <p>Result of running: <code>pip install passlib</code>:</p>
  
  <pre><code>Downloading/unpacking passlib   Downloading passlib-1.6.2.tar.gz (408kB): 408kB downloaded   Running setup.py egg_info for package passlib
  
  Installing collected packages: passlib   Running setup.py install for passlib
      error: could not create '/Library/Python/2.7/site-packages/passlib': Permission denied
      Complete output from command /usr/bin/python -c "import setuptools;__file__='/private/var/folders/2t/1yj5qss57xz8sb7p9wymtkdr0000gn/T/pip_build_&lt;user&gt;/passlib/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/2t/1yj5qss57xz8sb7p9wymtkdr0000gn/T/pip-epiHNK-record/install-record.txt
  --single-version-externally-managed:
      running install
  
  running build
  
  running build_py
  
  creating build
  
  creating build/lib
  
  creating build/lib/passlib
  
  copying passlib/__init__.py -&gt; build/lib/passlib
  
  copying passlib/apache.py -&gt; build/lib/passlib
  
  copying passlib/apps.py -&gt; build/lib/passlib
  
  copying passlib/context.py -&gt; build/lib/passlib
  
  copying passlib/exc.py -&gt; build/lib/passlib
  
  copying passlib/hash.py -&gt; build/lib/passlib
  
  copying passlib/hosts.py -&gt; build/lib/passlib
  
  copying passlib/ifc.py -&gt; build/lib/passlib
  
  copying passlib/registry.py -&gt; build/lib/passlib
  
  copying passlib/win32.py -&gt; build/lib/passlib
  
  creating build/lib/passlib/ext
  
  copying passlib/ext/__init__.py -&gt; build/lib/passlib/ext
  
  creating build/lib/passlib/ext/django
  
  copying passlib/ext/django/__init__.py -&gt; build/lib/passlib/ext/django
  
  copying passlib/ext/django/models.py -&gt; build/lib/passlib/ext/django
  
  copying passlib/ext/django/utils.py -&gt; build/lib/passlib/ext/django
  
  creating build/lib/passlib/handlers
  
  copying passlib/handlers/__init__.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/bcrypt.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/cisco.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/des_crypt.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/digests.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/django.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/fshp.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/ldap_digests.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/md5_crypt.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/misc.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/mssql.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/mysql.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/oracle.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/pbkdf2.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/phpass.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/postgres.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/roundup.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/scram.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/sha1_crypt.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/sha2_crypt.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/sun_md5_crypt.py -&gt; build/lib/passlib/handlers
  
  copying passlib/handlers/windows.py -&gt; build/lib/passlib/handlers
  
  creating build/lib/passlib/tests
  
  copying passlib/tests/__init__.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/__main__.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/_test_bad_register.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/backports.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_apache.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_apps.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_context.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_context_deprecated.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_ext_django.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_handlers.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_handlers_bcrypt.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_handlers_django.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_hosts.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_registry.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_utils.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_utils_crypto.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_utils_handlers.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/test_win32.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/tox_support.py -&gt; build/lib/passlib/tests
  
  copying passlib/tests/utils.py -&gt; build/lib/passlib/tests
  
  creating build/lib/passlib/utils
  
  copying passlib/utils/__init__.py -&gt; build/lib/passlib/utils
  
  copying passlib/utils/compat.py -&gt; build/lib/passlib/utils
  
  copying passlib/utils/des.py -&gt; build/lib/passlib/utils
  
  copying passlib/utils/handlers.py -&gt; build/lib/passlib/utils
  
  copying passlib/utils/md4.py -&gt; build/lib/passlib/utils
  
  copying passlib/utils/pbkdf2.py -&gt; build/lib/passlib/utils
  
  creating build/lib/passlib/utils/_blowfish
  
  copying passlib/utils/_blowfish/__init__.py -&gt; build/lib/passlib/utils/_blowfish
  
  copying passlib/utils/_blowfish/_gen_files.py -&gt; build/lib/passlib/utils/_blowfish
  
  copying passlib/utils/_blowfish/base.py -&gt; build/lib/passlib/utils/_blowfish
  
  copying passlib/utils/_blowfish/unrolled.py -&gt; build/lib/passlib/utils/_blowfish
  
  creating build/lib/passlib/_setup
  
  copying passlib/_setup/__init__.py -&gt; build/lib/passlib/_setup
  
  copying passlib/_setup/docdist.py -&gt; build/lib/passlib/_setup
  
  copying passlib/_setup/stamp.py -&gt; build/lib/passlib/_setup
  
  copying passlib/tests/sample1.cfg -&gt; build/lib/passlib/tests
  
  copying passlib/tests/sample1b.cfg -&gt; build/lib/passlib/tests
  
  copying passlib/tests/sample1c.cfg -&gt; build/lib/passlib/tests
  
  copying passlib/tests/sample_config_1s.cfg -&gt; build/lib/passlib/tests
  
  running install_lib
  
  creating /Library/Python/2.7/site-packages/passlib
  
  error: could not create '/Library/Python/2.7/site-packages/passlib': Permission denied
  
  ---------------------------------------- Cleaning up... Command /usr/bin/python -c "import setuptools;__file__='/private/var/folders/2t/1yj5qss57xz8sb7p9wymtkdr0000gn/T/pip_build_&lt;user&gt;/passlib/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/2t/1yj5qss57xz8sb7p9wymtkdr0000gn/T/pip-epiHNK-record/install-record.txt
  --single-version-externally-managed failed with error code 1 in /private/var/folders/2t/1yj5qss57xz8sb7p9wymtkdr0000gn/T/pip_build_&lt;user&gt;/passlib Storing complete log in /Users/&lt;user&gt;/Library/Logs/pip.log
  </code></pre>