asdf-community / asdf-poetry

Poetry plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
74 stars 15 forks source link

Can't install any versions of poetry on Mac #43

Open bapti opened 7 months ago

bapti commented 7 months ago

Provide environment information

asdf info

OS:
Darwin PPL-4391 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020 arm64

SHELL:
zsh 5.9 (x86_64-apple-darwin23.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
v0.14.0

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/neil.crawford/.asdf
ASDF_DIR=/opt/homebrew/opt/asdf/libexec
ASDF_CONFIG_FILE=/Users/neil.crawford/.asdfrc

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master a4c42e1
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 127716e
golang                       https://github.com/kennyp/asdf-golang.git master 21d9c32
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 4f8aa3d
poetry                       https://github.com/asdf-community/asdf-poetry.git master e2a3c34
python                       https://github.com/danhper/asdf-python.git master 8505457

Python version

➜  ~ python --version
Python 3.12.1

To Reproduce

Run asdf install poetry 1.7.1

➜  ~ asdf install poetry 1.7.1 
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/Users/neil.crawford/.asdf/installs/poetry/1.7.1/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.7.1): Creating environment
Traceback (most recent call last):
  File "<stdin>", line 945, in <module>
  File "<stdin>", line 923, in main
  File "<stdin>", line 560, in run
  File "<stdin>", line 581, in install
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "<stdin>", line 653, in make_env
  File "<stdin>", line 639, in make_env
  File "<stdin>", line 317, in make
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/venv/__init__.py", line 66, in __init__
    self.symlinks = should_use_symlinks(symlinks)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/venv/__init__.py", line 31, in should_use_symlinks
    raise Exception("This build of python cannot create venvs without using symlinks")
Exception: This build of python cannot create venvs without using symlinks

Cleanup: Something went wrong!

20 /Users/neil.crawford/.asdf/plugins/poetry/bin/install: POETRY_HOME=$install_path python3 - --version "$version" $flags

Describe the Bug

Asdf won't install and outputs error Exception: This build of python cannot create venvs without using symlinks

I've tried a few different versions but none work.

Expected Behaviour

I'm able to install poetry

philsherry commented 4 months ago

This is a weird one, because I can install just fine on one Mac (personal), while I'm seeing this result on another Mac (work, managed). Both Macs are the same spec (M1 Max), with everything else installing just fine up until this.

philsherry commented 4 months ago

Just fixed mine. I did some digging, ended up finding some info about some very similar error output, and then I did the following:

brew reinstall certifi
malthejorgensen commented 3 months ago

brew reinstall certifi did not work for me.

What's happening seems to be that the python3 used on lines 48 and 50 in ~/.asdf/plugins/poetry/bin/install points to the macOS system install of python in /usr/bin/python3 (can be checked with which python) which is Python v3.9.6 (can be checked with python3 --version).

For me this was due to a very weird interaction between fish and tmux.

Quickfix was to just change line 48 and 50 from python3 to python 🤷‍♂️ I believe the issue is mostly unrelated to asdf-poetry. If my setup had set the right $PATH it wouldn't have happened.

jfly commented 3 months ago

@malthejorgensen, this exact issue is why I added the asdf direnv install command a little while ago.

Granted, that only helps you if you're using asdf-direnv. If you're not, there's some hope for this to get implemented in core asdf, see https://github.com/asdf-vm/asdf/pull/1723.