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
Lektor cached venv is broken on macOS with Python installed via Homebrew #1159
Comments
Thank you for the report! At this point, I only vaguely understand how symlinking vs copying might make a difference, but... It appears the venv CLI ( In contrast, So, I think an appropriate fix on our side would be just to duplicate the venv CLI's default logic to determine when to use symlinks. (I.e. pass If you're so inclined, feel free to make a PR to do that. Otherwise, I'll work one up in the next few days. |
(except on windows) See lektor#1159
@hatarist This should now be fixed in the master branch. If not, please re-open the issue. Thank you for the report and the analysis! |
I'm using the latest version (Lektor-3.4.0b9.dev7+gbfce91a.d20230827 as of now).
python3 is installed via homebrew (
python@3.11
) and is symlinked:/usr/local/bin/python3
->/usr/local/Cellar/python@3.11/3.11.5/bin/python3
-> ... ->/usr/local/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/bin/python3.11
I have created a venv using
python3 -m venv env
, everything worked fine in that venv until I installed a plugin (lektor plugins add lektor-index-pages
). After that, trying to run thelektor server
started raising an exception:When I tried to run python3 using that path, I saw this error:
So, looks like the homebrew version of Python was built with relative paths in mind and when EnvBuilder copies that binary to another path, things go south.
I have successfully fixed that for myself by editing the EnvBuilder options in lektor/packages.py:123, adding an
symlinks=True
option there:This has solved the issue for me - now, when Lektor creates a cached venv, it symlinks the used python binary in there and everything seems to work fine.
I've never heard of Lektor until today and I don't feel comfortable with making a pull request since my fix could break something else. Sorry!
The text was updated successfully, but these errors were encountered: