[go: up one dir, main page]

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

pyenv-virtualenv is very slow on macOS Sequoia #490

Open
11 tasks done
kozlek opened this issue Sep 20, 2024 · 4 comments
Open
11 tasks done

pyenv-virtualenv is very slow on macOS Sequoia #490

kozlek opened this issue Sep 20, 2024 · 4 comments

Comments

@kozlek
Copy link
kozlek commented Sep 20, 2024

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): macOS 15.0 Sequoia
  • OS architecture (e.g. amd64): amd64 (MacbookPro 14,3)
  • pyenv version: v2.4.13
  • pyenv-virtualenv version: v1.2.4
  • Python version: 3.12.6
  • virtualenv version (if installed): none

I was using pyenv & pyenv-virtualenv on macOS 12.x Monterey for 2 years with great success.
Yesterday, I updated to macOS 15.0 Sequoia (clean install).
The shell was very slow with pyenv-virtualenv autoloading enabled.
It takes around 1.2 seconds when hitting a blank line in the shell.

I downgraded to macOS 13.x Ventura (clean install again) and the shell was instant again.

I don't expect you to fix macOS, but I wanted to report my experience with Sequoia to see if others users have the same problem. Apart from pyenv-virtualenv, pyenv + jenv + rbenv were also a bit slower. The rest of the apps were working well. I suspect Apple to have changed something with the terminal / shell...

I'll stick to Ventura for sometimes, and I'll give a try to Sonoma to see.

@kozlek
Copy link
Author
kozlek commented Sep 21, 2024

I did a macOS 14.7 Sonoma clean install on an external SSD and pyenv-virtualenv is behaving normally, without any delays.

At least on my platform, macOS Sequoia has a huge issue with some shell programs.

I recommend to postpone the Sequoia upgrade until this is fixed on macOS side.

@aphedges
Copy link

I encountered this same problem yesterday on my Intel Mac running macOS 14.7 (Sonoma) when I updated from Xcode 15.3 to Xcode 16. I presume that your fresh install of macOS 15 (Sequoia) had Xcode 16, and I'd be curious to see whether downgrading only Xcode without downgrading the OS would solve the problem. I'm also curious about whether this is a problem only on Intel Macs or if it's a problem on Apple Silicon as well.

I noticed a variety of pyenv and pyenv-virtualenv commands being much slower, and I was able to figure out that the command pyenv sh-activate --quiet command run in the shell hook was taking most of the time when I hit "Enter" on a blank line. I ran the following command to help test out the problem:

time env -i bash -cx 'export PYENV_DEBUG=1; command pyenv sh-activate --quiet'

With Xcode 16, the command takes over 10 s to execute, while with Xcode 15.3, the command takes ~0.3 s to execute.

I can help with debugging the problem because I can't delay upgrading Xcode indefinitely. However, I have no clue how to profile shell scripts. If anyone has tooling recommendations, I can hopefully figure out exactly where the regression is happening.

@native-api
Copy link
Member
native-api commented Sep 26, 2024

However, I have no clue how to profile shell scripts.

#259 (comment):

Try localizing the issue by timing the code that runs at prompt with:

export PS4='+($(date "+%s.%N")) (${BASH_SOURCE:-}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -x
<reproduce the problem>
set +x

Also add the same date invocation to PS4 assignments throughout Pyenv and Pyenv-Virtualenv and set PYENV_DEBUG=1

@aphedges
Copy link

I forgot to mention this, but I switched to an Apple silicon laptop a week or two after encountering this issue, and I had no problems using Xcode 16 on it. I think this regression is purely for Intel Mac users.

Someone else is obviously free to debug this, but I'm not going to spend the time debugging it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants