Using poetry with GitPod

I am trying to setup my workspace (GitHub - kameshsampath/kameshsampath.demos: My Ansible Collections repository) and install python packages using poetry, but my setup is failing with the following error:

    gitpod /workspace/kameshsampath.demos $ poetry env use python
    Creating virtualenv kameshsampath.demos in /workspace/kameshsampath.demos/.venv
    Using virtualenv: /workspace/kameshsampath.demos/.venv
    gitpod /workspace/kameshsampath.demos $ poetry install 
    Installing dependencies from lock file

    Package operations: 73 installs, 0 updates, 0 removals

      • Installing pycparser (2.20): Failed

      EnvCommandError

      Command ['/workspace/kameshsampath.demos/.venv/bin/pip', 'install', '--no-deps', 'file:///home/gitpod/.cache/pypoetry/artifacts/f1/03/25/40eb46f7bede64f78ba073e2141b8216e611cbcde72e3117c326560101/pycparser-2.20-py2.py3-none-any.whl'] errored with the following return code 1, and output: 
      ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
      WARNING: You are using pip version 21.0.1; however, version 21.1 is available.
      You should consider upgrading via the '/workspace/kameshsampath.demos/.venv/bin/python -m pip install --upgrade pip' command.
      

      at ~/.poetry/lib/poetry/utils/env.py:1075 in _run
          1071│                 output = subprocess.check_output(
          1072│                     cmd, stderr=subprocess.STDOUT, **kwargs
          1073│                 )
          1074│         except CalledProcessError as e:
        → 1075│             raise EnvCommandError(e, input=input_)
          1076│ 
          1077│         return decode(output)
          1078│ 
          1079│     def execute(self, bin, *args, **kwargs):

    gitpod /workspace/kameshsampath.demos $ 

When I build the docker image locally and run the same commands as in my .gitpod.yml I see its working as expected.

Any thoughts ?

Hi @kameshsampath, welcome to the Gitpod community! :partying_face:

This --user error seems familiar… Could you please try the workaround suggested in this issue?