# py-problems



## talsamon (Apr 12, 2017)

Some ports show error-messages
e.g. security/py-cryptography:
===>  Configuring for security/py27-cryptography-1.7.2
ERROR:root:code for hash md5 was not found.

```
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 334, in <module>
    **keywords_with_side_effects(sys.argv)
  File "/usr/local/lib/python2.7/distutils/core.py", line 111, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 319, in __init__
    _Distribution.__init__(self, attrs)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 287, in __init__
    self.finalize_options()
  File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 386, in finalize_options
    ep.load()(self, ep.name, value)
  File "/usr/local/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 161, in cffi_modules
    add_cffi_module(dist, cffi_module)
  File "/usr/local/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 48, in add_cffi_module
    execfile(build_file_name, mod_vars)
  File "/usr/local/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 24, in execfile
    exec(code, glob, glob)
  File "src/_cffi_src/build_openssl.py", line 85, in <module>
    extra_link_args=extra_link_args(compiler_type()),
  File "src/_cffi_src/utils.py", line 61, in build_ffi_for_binding
    extra_link_args=extra_link_args,
  File "src/_cffi_src/utils.py", line 70, in build_ffi
    ffi.cdef(cdef_source)
  File "/usr/local/lib/python2.7/site-packages/cffi/api.py", line 105, in cdef
    self._cdef(csource, override=override, packed=packed)
  File "/usr/local/lib/python2.7/site-packages/cffi/api.py", line 119, in _cdef
    self._parser.parse(csource, override=override, **options)
  File "/usr/local/lib/python2.7/site-packages/cffi/cparser.py", line 299, in parse
    self._internal_parse(csource)
  File "/usr/local/lib/python2.7/site-packages/cffi/cparser.py", line 304, in _internal_parse
    ast, macros, csource = self._parse(csource)
  File "/usr/local/lib/python2.7/site-packages/cffi/cparser.py", line 260, in _parse
    ast = _get_parser().parse(csource)
  File "/usr/local/lib/python2.7/site-packages/cffi/cparser.py", line 40, in _get_parser
    _parser_cache = pycparser.CParser()
  File "/usr/local/lib/python2.7/site-packages/pycparser/c_parser.py", line 103, in __init__
    tabmodule=yacctab)
  File "/usr/local/lib/python2.7/site-packages/pycparser/ply/yacc.py", line 3065, in yacc
    signature = pinfo.signature()
  File "/usr/local/lib/python2.7/site-packages/pycparser/ply/yacc.py", line 2800, in signature
    from md5 import md5
  File "/usr/local/lib/python2.7/md5.py", line 10, in <module>
    from hashlib import md5
ImportError: cannot import name md5
*** Error code 1

Stop.
make: stopped in /usr/ports/security/py-cryptography
```
(also devel/git)

lang/python34, lang/python35, lang/python27 does not install

```
Running Q/A tests (stage-qa)
Error: '/usr/bin/env python' is an invalid shebang you need USES=shebangfix for 'lib/python3.4/lib2to3/tests/data/false_encoding.py'
Error: '/usr/bin/env python' is an invalid shebang you need USES=shebangfix for 'lib/python3.4/lib2to3/tests/data/different_encoding.py'
Error: '/usr/local/bin/python' is an invalid shebang you need USES=shebangfix for 'lib/python3.4/cgi.py'
Error: '/usr/bin/env python' is an invalid shebang you need USES=shebangfix for 'lib/python3.4/encodings/rot_13.py'
*** Error code 1
```

www/serf and devel/cppcheck stops also with shebang warnings.

What's happend with `python`? (or what causes it, if it is only on my system?)


----------



## talsamon (Apr 12, 2017)

Solved (?). All caused by `DEVELOPER=yes`.


----------



## tobik@ (Apr 12, 2017)

This is caused by https://svnweb.freebsd.org/ports?view=revision&revision=438176


----------



## talsamon (Apr 12, 2017)

Thanks! Should be noticed in /usr/ports/CHANGES.
But at least the py27-, py34-, py35... ports could be quick fixed with 
a `sed` command. It is not much more work than the entry in qa.sh.


----------



## talsamon (Apr 13, 2017)

I think, there something badly go wrong.
If e.g defined

```
DEFAULT_VERSIONS+=python=2.7 python2=2.7
```
it should not matter if in the port Makefile is
python python:2 or python:2.7.
Now I had a "new" issue:
lang/rust stops compile cause there is 
	
	



```
USES=python:2,build
```
.
If I changed it to 
	
	



```
USES=üython;2.7,build
```
 it works.
`DEVELOPER=yes` is now commented out in /etc/make.conf.

(I mailed it the maintainer, cause lang/rust also does not
compile with `CCACHE` and ignores `NO_CCACHE=yes`  in
/etc/make.conf).


----------



## MarcoB (Apr 13, 2017)

I had a problem installing LLVM 4.0 (Python shebang problem like mentioned above). Solved this by commenting out "DEVELOPER=yes" in /etc/make.conf.


----------



## talsamon (Apr 13, 2017)

The problem with lang/rust. Just for clear: `DEVELOPER=yes` was commented out before I tried to compile it.
The problem in the moment is, with some ports the problem is
solved with commenting out `DEVELOPER=yes` and other ports are needed to change `USES=python` to the python version (which ever it is).


----------



## talsamon (Apr 13, 2017)

Also not understandable:
amdmi3 states in the above link from @tobik::

```
ports always depend on specific
version of python (e.g. python2 or python3), and generic `python'
which is link to either of them may point to incorrect version or
be not available at all (since it's installed by separate optional
python metaport)
```

but commits updates only with `USES=python`.


----------



## Robbin Johnson (Nov 20, 2018)

(anyone still watching this thread? )

I am attempting to build Xorg for 12.0-RC1 on an iMac G5 powerpc64 system (there are no pre-built packages) and I am running into the same issue as the original posting. These "unsupported hash type" errors are cropping up while attempting to build py27-cython-0.28.2. I am a newbie here so the exact steps I need to take are unclear to me.
Anyone willing to provide a bit more basic description of what and where I need to tweak things to make the compile successful?


----------

