Skip to content

Python pip doesn't work properly in zsh #984

Open
@xzmeng

Description

@xzmeng

Bug description

Packages installed with pip under bash cannot be found under zsh.

Steps to reproduce

  1. Open an empty workspace.
  2. $ pip install flask (under bash)
  3. Create a new zsh terminal. (directly from the VSCode, not from an existing bash)
  4. $ python -c "import flask" (under zsh)

Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'flask'

Expected behavior

Packages should be available regardless of shell type.

Example repository

https://github.com/xzmeng/xzmeng

Anything else?

export PYTHONUSERBASE="$GP_PYENV_MIRROR/user/current"

COPY --chown=gitpod:gitpod python_hook.bash $HOME/.bashrc.d/60-python

I guess the PYTHONUSERBASE environment variable is to allow the packages installed by pip to remain after the workspace is restarted, but if it is only set in bash, other kinds of shells will have inconsistencies.

Is it feasible to put this process in pyenv shims , so that any we don't care about shell types ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions