Skip to content

PEP 668: Ability to have relative paths instead of absolute paths #130844

Closed as not planned
@RustoMCSpit

Description

@RustoMCSpit

Feature or enhancement

Proposal:

What's the problem this feature will solve?

So I just started using PIP and got an "externally managed enviornment" error, I suspected this was due to me changing the file location so I ran echo $PATH and found that it was looking for my file in its old location and then I did which pip and found it was resorting to my system wide pip in ./local

This is a problem for me, after doing some light searching online it appears pip uses exclusively hard coded absolute addresses and they can't be changed. That's possibly incorrect, but that's what I've read, hence the issue request.

Describe the solution you'd like

The ability to either change the PATH variables or set it to a relative one instead

Use Case

To explain my specific use case, I have files synced to a laptop and PC. The problem is VENV's break between the two because those devices obviously have to have different names, and thus they have different absolute paths.
e.g.
home/laptop/pythonProjects/venv/source/bin/activate and home/pc/pythonProjects/venv/source/bin/activate

Allowing users to make PATHs relative, so the VENV would check a user selected folder, e.g. pythonProjects, allowing for compatibility between the two as the VENV would check pythonProjects/venv/source/bin/activate on both systems would be great.

Still, the ability to be able to change PATH variables, which was extensively discussed here https://discuss.python.org/t/q-what-stops-a-venv-from-being-relocatable/57166, would be ideal if a suitable method could be found to implement this.

Better yet, have VENV be intelligent enough to determine its location has changed and attempt to update its PATH variables automatically to match its new location.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

pypa/virtualenv#2854
pypa/pip#13259

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedstdlibPython modules in the Lib dirtopic-venvRelated to the venv moduletype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions