Description
Everything works fine when spinning up a fresh new workspace with gitpod. This is because the init part in .gitpod.yml is run.
However, on workspace restarts (such as closing the tab and then reopening that workspace after some time), poetry install would show ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv. for every single package.
Steps to Reproduce
- Click the
open in gitpod button in the README (or just spin up a new workspace using https://gitpod.io/#/github.com/python-discord/sir-lancebot)
- Optionally wait until the initialization jobs have completed
- Close the workspace
- Wait until the workspace times out. Can be 60 min to 180 min (see gitpod docs on that)
- Reopen workspace
- Wait for a few seconds and the terminal will show tracebacks for the aforementioned
poetry install error for every single package
Expected Behaviour
Ideally, when restarting a workspace poetry install (the whole command part of .gitpod.yml) should not throw any errors. If it did, new workspace installs should throw the same error, if any.
Actual Behaviour
Startup tasks for new workspaces run successfully.
When reopening a temporarily suspended workspace, a traceback with ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv. is shown when the .gitpod.yml commands are run (before and commands to be specific).
Known Impacted Platforms
N/A; gitpod is a webapp, AFAIK.
Possible Solutions
According to their documentation on start up tasks for .gitpod.yml
This is not ideal because the command that solves the error export PIP_USER=false is inside the init key, meaning that command isn't run before command key is run on workspace restarts.
The solution is to put that export command into the command key (of .gitpod.yml) so that that command is guaranteed to run regardless of whether it's a new workspace or an existing one:
tasks:
- name: "Python Environment"
before: "pyenv install 3.9.6 && pyenv global 3.9.6"
init: "pip install poetry"
command: "export PIP_USER=false && poetry install && poetry run pre-commit install"
Would you like to implement a fix?
Note: For high-priority or critical bugs, fixes may be implemented by staff.
I'd like to implement the bug fix
Description
Everything works fine when spinning up a fresh new workspace with gitpod. This is because the
initpart in.gitpod.ymlis run.However, on workspace restarts (such as closing the tab and then reopening that workspace after some time),
poetry installwould showERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.for every single package.Steps to Reproduce
open in gitpodbutton in the README (or just spin up a new workspace using https://gitpod.io/#/github.com/python-discord/sir-lancebot)poetry installerror for every single packageExpected Behaviour
Ideally, when restarting a workspace
poetry install(the wholecommandpart of.gitpod.yml) should not throw any errors. If it did, new workspace installs should throw the same error, if any.Actual Behaviour
Startup tasks for new workspaces run successfully.
When reopening a temporarily suspended workspace, a traceback with
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.is shown when the.gitpod.ymlcommands are run (beforeandcommandsto be specific).Known Impacted Platforms
N/A; gitpod is a webapp, AFAIK.
Possible Solutions
According to their documentation on start up tasks for
.gitpod.ymlbefore,init,commandare executedbeforeandcommandare executedThis is not ideal because the command that solves the error
export PIP_USER=falseis inside theinitkey, meaning that command isn't run beforecommandkey is run on workspace restarts.The solution is to put that
exportcommand into thecommandkey (of.gitpod.yml) so that that command is guaranteed to run regardless of whether it's a new workspace or an existing one:Would you like to implement a fix?
Note: For high-priority or critical bugs, fixes may be implemented by staff.
I'd like to implement the bug fix