Pyxform installation

Hey,

Is anyone able to use sudo python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic command indicated in the documentation site to install pyxform?

For me, on a clean install of Ubuntu 24.04, I don’t like to install things globally with sudo and python doesn’t have an alias and python3 now requires a virual env. So I use:

pipx install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic

However, most folks will have python aliased to python3 and are not running the very latest, where the command we specify in the docs should work.

Are you having an error when you try to run the command? Can you post the error? Can you specify the version of python you’re on via python --version (or if that doesn’t work python3 --version )

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/Users/em/.pyenv/versions/2.7.18/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Users/em/.pyenv/versions/2.7.18/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 "/Users/em/.pyenv/versions/2.7.18/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Users/em/.pyenv/versions/2.7.18/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 "/Users/em/.pyenv/versions/2.7.18/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/Users/em/.pyenv/versions/2.7.18/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224

Hey @mrjones I am getting the errors above. I also have both python 2 and python3 installed: Python 2.7.18 and Python 3.12.6

Thanks for posting the error code @Esther_Moturi !

I see the error shows it’s using python2 which is deprecated. Can you try and explicitly using python3

 sudo python3 -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic

When I test this works for me:

➜  mkdir deleteme && cd deleteme
➜   python3 -m venv .venv
➜   . .venv/bin/activate
(.venv) ➜  deleteme python3 -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic        
Collecting pyxform-medic
  Cloning https://github.com/medic/pyxform.git (to revision medic-conf-1.17) to /tmp/pip-install-9_scod2r/pyxform-medic_aad765e436a44bd3b2d41ad51cba332a
  Running command git clone --filter=blob:none --quiet https://github.com/medic/pyxform.git /tmp/pip-install-9_scod2r/pyxform-medic_aad765e436a44bd3b2d41ad51cba332a
  Running command git checkout -b medic-conf-1.17 --track origin/medic-conf-1.17
  Switched to a new branch 'medic-conf-1.17'
  branch 'medic-conf-1.17' set up to track 'origin/medic-conf-1.17'.
  Resolved https://github.com/medic/pyxform.git to commit 6f7909d564e104640562241da4cf8393036243ad
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting xlrd==1.0.0 (from pyxform-medic)
  Using cached xlrd-1.0.0-py3-none-any.whl.metadata (984 bytes)
Collecting unicodecsv==0.14.1 (from pyxform-medic)
  Using cached unicodecsv-0.14.1-py3-none-any.whl
Collecting formencode (from pyxform-medic)
  Using cached FormEncode-2.1.0-py3-none-any.whl.metadata (2.6 kB)
Collecting unittest2 (from pyxform-medic)
  Using cached unittest2-1.1.0-py2.py3-none-any.whl.metadata (15 kB)
Collecting argparse (from unittest2->pyxform-medic)
  Using cached argparse-1.4.0-py2.py3-none-any.whl.metadata (2.8 kB)
Collecting six>=1.4 (from unittest2->pyxform-medic)
  Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting traceback2 (from unittest2->pyxform-medic)
  Using cached traceback2-1.4.0-py2.py3-none-any.whl.metadata (1.5 kB)
Collecting linecache2 (from traceback2->unittest2->pyxform-medic)
  Using cached linecache2-1.0.0-py2.py3-none-any.whl.metadata (1000 bytes)
Using cached xlrd-1.0.0-py3-none-any.whl (143 kB)
Using cached FormEncode-2.1.0-py3-none-any.whl (179 kB)
Using cached unittest2-1.1.0-py2.py3-none-any.whl (96 kB)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Using cached argparse-1.4.0-py2.py3-none-any.whl (23 kB)
Using cached traceback2-1.4.0-py2.py3-none-any.whl (16 kB)
Using cached linecache2-1.0.0-py2.py3-none-any.whl (12 kB)
Building wheels for collected packages: pyxform-medic
  Building wheel for pyxform-medic (pyproject.toml) ... done
  Created wheel for pyxform-medic: filename=pyxform_medic-0.9.24-py3-none-any.whl size=1581479 sha256=2f2030c86c4e089d0db2614cbafa6c6714342a031f907b494efd622014733243
  Stored in directory: /tmp/pip-ephem-wheel-cache-xaxfqv4u/wheels/8d/e6/84/5a2f89495a5ea69e90227095688c94f9087d51475433524adf
Successfully built pyxform-medic
Installing collected packages: xlrd, unicodecsv, linecache2, argparse, traceback2, six, formencode, unittest2, pyxform-medic
Successfully installed argparse-1.4.0 formencode-2.1.0 linecache2-1.0.0 pyxform-medic-0.9.24 six-1.16.0 traceback2-1.4.0 unicodecsv-0.14.1 unittest2-1.1.0 xlrd-1.0.0

Note that I created a Virtual Environment which likely isn’t required for you.

If the above python3 call works, you may want to map python to go to python3 instead of python2. This is likely done via symlink. If you run which python and then run file ... on the path you get back from the which command, you can figure out where the binaries live and which to symlink to.

let us know if you get stuck with any of this!

1 Like

Hey @mrjones , the solution worked. I have opened this CHT docs issue to update the documentation.

Awesome! I’m glad that worked.