Results 1 to 7 of 7

Thread: Python 3: No module named sha256 error

  1. #1
    Join Date
    Jan 2012
    Beans
    23

    Python 3: No module named sha256 error

    Hi all, I am learning python and i have installed python 3 on my Ubuntu 11.10. Now i just tried writing a simple import random statement and i get
    Code:
    from hashlib import sha512
    Traceback (most recent call last):
      File &quot;<stdin>&quot;, line 1, in <module>
      File &quot;/usr/local/lib/python3.2/hashlib.py&quot;, line 138, in <module>
        globals()[__func_name] = __get_hash(__func_name)
      File &quot;/usr/local/lib/python3.2/hashlib.py&quot;, line 74, in __get_builtin_constructor
        import _sha256
    ImportError: No module named _sha256
    I have searched the net and i find no clues relating to Python 3 with this module. Can anybody help me out?? Python learning is turning out to be a tough battle with just clearing up all the module errors!!

  2. #2
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,260
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Python 3: No module named sha256 error

    This probably doesn't help you, but that import statement works with python 3.1.2 on Lucid (installed from the repository). The documentation for 3.2 suggests that it should work there too. This suggests to me that it's an issue with your python3 installation rather than with your code, but I could be wrong.

  3. #3
    Join Date
    Jan 2012
    Beans
    23

    Re: Python 3: No module named sha256 error

    @spjackson
    Hmmm it could be so if i want to re-install Python 3, how do i remove the existing copy of Python 3 and what would be the best way to install Python 3? I'd really like to get started with python

  4. #4
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,260
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Python 3: No module named sha256 error

    I don't know how you installed it in the first place, but since it is in /usr/local/lib/python3.2 it won't have been from the Ubuntu repositories. Python 3.2 is available in the repositories for 11.04, so I suggest that you install that via synaptic, apt-get or whatever your preference.

  5. #5
    Join Date
    Jan 2012
    Beans
    23

    Re: Python 3: No module named sha256 error

    @spjackson

    Yes i didn't install it from the repositories,so if want to install from the repositories how do i remove the existing version of python 3.2? Are there any commands to remove them or how do i do it?

  6. #6

    Re: Python 3: No module named sha256 error

    Depends on how you installed it in the first place. You can't use apt to uninstall something that it didn't put there to begin with -- it's not part of the package database.

    If you installed with "make install", "make uninstall" has been known to work with some packages. I don't know about Python.

  7. #7
    Join Date
    May 2007
    Beans
    3

    Re: Python 3: No module named sha256 error

    Try to add libsasl2-dev package then your python.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •