Skip to content

Weird cyclic symlink "~/.pyenv/versions/venvname/venvname" on macos #483

@avoidik

Description

@avoidik

Too many issues will kill our team's development velocity, drastically.
Make sure you have checked all steps below.

Prerequisite

  • Make sure your problem is not listed in the common build problems.
  • Make sure no duplicated issue has already been reported in the pyenv-virtualenv issues. You should look in closed issues, too.
  • Make sure you are not asking us to help solving your specific issue.
    • GitHub issues is opened mainly for development purposes. If you want to ask someone to help solving your problem, go to some community site like Gitter, StackOverflow, etc.
  • Make sure your problem is not derived from packaging (e.g. Homebrew).
    • Please refer to the package documentation for the installation issues, etc.
  • Make sure your problem is not derived from other plugins.
    • This repository is maintaining the pyenv-virtualenv plugin only. Please refrain from reporting issues of other plugins here.

Description

  • Platform information (e.g. Ubuntu Linux 20.04): apple mac m1 pro
  • OS architecture (e.g. amd64): aarch64/arm64
  • pyenv version: 2.4.7
  • pyenv-virtualenv version: 1.2.3
  • Python version: v3.10.14
  • virtualenv version (if installed): 20.26.3
  • Please attach the debug log of a faulty Pyenv invocation as a gist
    • If the problem happens in a Pyenv invocation, you can turn on debug logging by setting PYENV_DEBUG=1, e.g. env PYENV_DEBUG=1 pyenv install -v 3.6.4
    • If the problem happens outside of a Pyenv invocation, get the debug log like this:
      # for Bash
      export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
      # for Zsh
      export PS4='+(%x:%I): %N(%i): '
      
      set -x
      <reproduce the problem>
      set +x
      

Problem description

This line here creates a weird cyclic symlink inside of a virtualenv directory.

For example, this line attempts to create the following symlink:

$ ln -fs /Users/user.name/.pyenv/versions/3.10.14/envs/venvname /Users/user.name/.pyenv/versions/venvname

However the target and the source directory is the same directory:

$ ls -la /Users/user.name/.pyenv/versions/venvname
lrwxr-xr-x  1 user.name  staff  59 Jul  9 17:37 /Users/user.name/.pyenv/versions/venvname -> /Users/user.name/.pyenv/versions/3.10.14/envs/venvname

As a result

$ ls -la /Users/user.name/.pyenv/versions/3.10.14/envs/venvname/
total 8
drwxr-xr-x   7 user.name  staff  224 Jul  9 18:21 .
drwxr-xr-x   4 user.name  staff  128 Jul  9 17:37 ..
drwxr-xr-x  16 user.name  staff  512 Jul  9 17:37 bin
lrwxr-xr-x   1 user.name  staff   59 Jul  9 18:21 venvname -> /Users/user.name/.pyenv/versions/3.10.14/envs/venvname
drwxr-xr-x   2 user.name  staff   64 Jul  9 17:37 include
drwxr-xr-x   3 user.name  staff   96 Jul  9 17:37 lib
-rw-r--r--   1 user.name  staff  117 Jul  9 18:21 pyvenv.cfg

If I'd prepend this line with echo, like this

echo ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"

There is no weird cyclic symlink getting created.

Is this something expected or a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions