Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows drive mappings break virtual environment name #6109

Closed
3 tasks done
adamgreg opened this issue Aug 3, 2022 · 1 comment · Fixed by #6110
Closed
3 tasks done

Windows drive mappings break virtual environment name #6109

adamgreg opened this issue Aug 3, 2022 · 1 comment · Fixed by #6110
Labels
kind/bug Something isn't working as expected

Comments

@adamgreg
Copy link
Contributor

adamgreg commented Aug 3, 2022

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10 x64
  • Poetry version: Reproduced in 1.1.14 and 1.2.0b3

Issue

Windows drive mappings are not resolved when hashing the current working directory to generate a virtual environment name.

This means that a virtual environment that was created when working under a mapped drive is not re-used when working under the real un-mapped directory.

I'll explain the problem this has caused me. I work under a mapped drive and installed git pre-commit hooks that run commands such as pylint from the development environment using poetry run. When the hooks were automatically run by git, the current working directory was always the "real" directory. Poetry would automatically create and use a new empty environment that did not contain the necessary executables, leading to very confusing errors.

It can be fixed with a single call to os.path.realpath() in EnvManager.generate_env_name(). I will create a pull request.

I've checked in Linux, and could not reproduce the same problem using symbolic links.

Example:

cd c:\parent\my_project
poetry install
poetry env list  # Poetry-managed virtual environment listed
subst z: c:\parent
cd z:\my_project
poetry env list  # No environments listed. "poetry run" commands will fail. 
@adamgreg adamgreg added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 3, 2022
@adamgreg adamgreg changed the title Windows drive mappings affect virtual environment name Windows drive mappings break virtual environment name Aug 3, 2022
@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Aug 19, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants