Skip to content

Relativ paths does not work for Windows #47

@dmatuschek

Description

@dmatuschek

We use this package for a project and we discovered a bug for Windows users. If you want to install dependencies on windows you will receive an OSError - File not found.

We looked a bit deeper into this bug and found out that the path to the python binary (on windows \.venv\Scripts\python.exe) is passed as a relative path. The problem is that Popen on windows does not execute this path from the current working directory (see: https://stackoverflow.com/a/21412727).

Therefore the argument for the Popen call needs to have an absolute path. This could be fixed with (if path contains the absolute path)

@property
def _python_rpath(self):
    """The relative path (from environment root) to python."""
    # Windows virtualenv installation installs pip to the [Ss]cripts
    # folder. Here's a simple check to support:
    if sys.platform == 'win32':
        return os.path.join(self.path, 'Scripts', 'python.exe')
    return os.path.join('bin', 'python')

Alternatively, it could be solved with a os.path.abspath for Windows.

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