Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python error when installing pyxform medic on Linux #613

Open
kennsippell opened this issue Mar 7, 2024 · 1 comment
Open

Python error when installing pyxform medic on Linux #613

kennsippell opened this issue Mar 7, 2024 · 1 comment
Labels
Type: Bug Fix something that isn't working as intended

Comments

@kennsippell
Copy link
Member

kennsippell commented Mar 7, 2024

Describe the bug
Blocking error when using cht-conf for the first time to deploy a configuration

To Reproduce
Steps to reproduce the behavior:

  1. Run npx cht --url=http://medic:password@localhost:5988
  2. User gets this error (expected)
ERROR There was a problem executing xls2xform.  It may not be installed.
E To install the latest pyxform, try one of the following:
E
E Ubuntu
E       sudo python -m pip install git+https://github.com/medic/[email protected]#egg=pyxform-medic
E OSX
E       pip install git+https://github.com/medic/[email protected]#egg=pyxform-medic
E Windows (as Administrator)
E       python -m pip install git+https://github.com/medic/[email protected]#egg=pyxform-medic --upgrade 
  1. Run sudo python -m pip install git+https://github.com/medic/[email protected]#egg=pyxform-medic
  2. User gets an error

Expected behavior
Commands provided should not result in error

Logs

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • Client platform: Linux Manjero
  • Python: 3.11.7
  • cht-conf version: 3.21.4

Additional context
Run with --break-system-packages

@kennsippell kennsippell added the Type: Bug Fix something that isn't working as intended label Mar 7, 2024
@sugat009
Copy link
Member

This is not a cht-conf error per se, since python 3.11 the packages need to be installed within a virtual environment. However, the cht-conf installation document needs an update on this.
A workaround for this would be to create a virtual environment in the folder where you want to run the cht <command>. Another workaround is to create a single virtual environment anywhere in your system and export its path into the Linux PATH variable such that xls2xform-medic: (the binary that cht needs) is always available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Fix something that isn't working as intended
Projects
None yet
Development

No branches or pull requests

2 participants