Skip to content

Virtual environment activation doesn't update prompt properly #74

Open

Description

@jgwinner

So far, virtualenv-clone seems to work for our purposes - we want to install some PyTest "smoke" tests, but not have the development libraries in production.

Environment:
ubuntu 20.04
Python 3.8.10
virtualenv-clone 0.5.7

However, activating the environment makes it seem like you're still in the original environment.

I checked the activate script and it look like the old hard coded environment name is still in there.

Seems like this could be an additional search and replace?

I checked under Powershell, and the prompt DOES update :)

== John ==

Activity

  1. yarchick-balaban commented on Aug 23, 2024

    @yarchick-balaban

    Similar problem:

    `
    sudo rm -fr /tmp/pypy_venv/
    /opt/python-venvs/pypy3.9/bin/virtualenv-clone /opt/python-venvs/pypy3.9 /tmp/pypy_venv
    /tmp/pypy_venv/bin/pip install -r /home/requirements-pypy3.9.txt

    Using pip 22.3.1 from /opt/python-venvs/pypy3.9/site-packages/pip (python 3.9)
    Requirement already satisfied: astroid==2.11.7 in /opt/python-venvs/pypy3.9/site-packages (from -r /home/requirements-pypy3.9.txt (line 1)) (2.11.7)
    Requirement already satisfied: black==24.4.2 in /opt/python-venvs/pypy3.9/site-packages (from -r /home/requirements-pypy3.9.txt (line 2)) (24.4.2)
    Requirement already satisfied: cassandra-driver==3.7.1 in opt/python-venvs/pypy3.9/lib64/pypy3.9/site-packages (from -r /home/requirements-pypy3.9.txt (line 3)) (3.7.1)
    Requirement already satisfied: cffi==1.15.1 in /usr/lib64/pypy3.9 (from -r /home/requirements-pypy3.9.txt (line 4)) (1.15.1)
    Requirement already satisfied: click==8.1.7 in /opt/python-venvs/pypy3.9/site-packages (from -r /home/requirements-pypy3.9.txt (line 5)) (8.1.7)
    Requirement already satisfied: colorama==0.4.6 in /opt/python-venvs/pypy3.9/site-packages (from -r /home/requirements-pypy3.9.txt (line 6)) (0.4.6)

    grep -r '/opt/python-venvs/pypy3.9' /tmp/pypy_venv
    /tmp/pypy_venv/bin/pip3:#!/opt/python-venvs/pypy3.9/bin/pypy3
    /tmp/pypy_venv/bin/wheel3.9:#!/opt/python-venvs/pypy3.9/bin/pypy3
    /tmp/pypy_venv/bin/wheel:#!/opt/python-venvs/pypy3.9/bin/pypy3
    /tmp/pypy_venv/bin/pip-3.9:#!/opt/python-venvs/pypy3.9/bin/pypy3
    /tmp/pypy_venv/bin/pip:#!/opt/python-venvs/pypy3.9/bin/pypy3
    /tmp/pypy_venv/bin/wheel3:#!/opt/python-venvs/pypy3.9/bin/pypy3
    /tmp/pypy_venv/bin/wheel-3.9:#!/opt/python-venvs/pypy3.9/bin/pypy3
    /tmp/pypy_venv/bin/pip3.9:#!/opt/python-venvs/pypy3.9/bin/pypy3
    `

    Some links remain unchanged. Manual replacement yields the expected result, and everything works correctly.
    find /tmp/pypy_venv/bin -type f -exec sed -i 's|/opt/python-venvs/pypy3.9|/tmp/pypy_venv|g' {} +

    The issue only affects the PyPy interpreter. Everything works correctly with CPython.

    Dear developers, please provide a response. This is critical for me, and the task has been open for a long time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions