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

Poetry Install Issues with mise (Related to symlink and python3.*dylib missing) #9

Closed
ethunk opened this issue Feb 2, 2024 · 9 comments · Fixed by #14
Closed

Poetry Install Issues with mise (Related to symlink and python3.*dylib missing) #9

ethunk opened this issue Feb 2, 2024 · 9 comments · Fixed by #14

Comments

@ethunk
Copy link

ethunk commented Feb 2, 2024

I kept running into issues for installing Poetry using mise.

Local Setup To Reproduce

System: Mac OS (M1)

.tool-versions file:

poetry 1.6.1

Command to install and output:

mise install poetry 1.6.1 --verbose
[DEBUG] ARGS: /Users/<>/.local/bin/mise install poetry 1.6.1 --verbose
[DEBUG] Config {
    Config Files: [
        "~/.config/mise/config.toml",
        "~/.tool-versions",
    ],
}
[DEBUG] Toolset: go@1.21.5, python@3.11.6, rust@1.74.1
installing
~/.local/share/mise/plugins/poetry/bin/install
[DEBUG] $ ~/.local/share/mise/plugins/poetry/bin/install
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/<>/.local/share/mise/installs/poetry/1.6.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.6.1)
Installing Poetry (1.6.1): Creating environment
Installing Poetry (1.6.1): An error occurred. Removing partial environment.
Poetry installation failed.
See /Users/<>/MI/poetry-installer-error-9usoojv5.log for error logs.
Cleanup: Something went wrong!
47 /Users/<>/.local/share/mise/plugins/poetry/bin/install: POETRY_HOME=$install_path python3 - --version "$version" $flags
[ERROR] ~/.local/share/mise/plugins/poetry/bin/install failed
Error:
   0: ~/.local/share/mise/plugins/poetry/bin/install exited with non-zero status: exit code 250

Location:
   /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/convert/mod.rs:757

Version:
   2024.2.2 macos-arm64 (1f11a1d 2024-02-02)

Suggestion: Run with --verbose or MISE_VERBOSE=1 for more information.

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Looking at the log file produced by poetry:

cat /Users/<>/MI/poetry-installer-error-9usoojv5.log
dyld[32665]: Library not loaded: @executable_path/../lib/libpython3.11.dylib
  Referenced from: <EC57C3BD-D6B2-3EC2-8C9E-F9D225344939> /Users/ehunkler/.local/share/mise/installs/poetry/1.6.1/venv/bin/python3
  Reason: tried: '/Users/ehunkler/.local/share/mise/installs/poetry/1.6.1/venv/lib/libpython3.11.dylib' (no such file)

Traceback:

  File "<stdin>", line 923, in main
  File "<stdin>", line 562, in run

I googled a bunch and found this helpful thread: python-poetry/install.python-poetry.org#24

The solution I found to fix this issue is I manually updated on my local machine the install script for poetry located here:

~/.local/share/mise/plugins/poetry/bin/install

and changed the install script to have the sed 's/symlinks=False/symlinks=True/' command.

  if [ "$install_type" = "version" ]; then
    curl -sSL "$install_url" | sed 's/symlinks=False/symlinks=True/' | POETRY_HOME=$install_path python3 - --version "$version" $flags
  elif [ "$install_type" = "ref" ]; then
    curl -sSL "$install_url" | sed 's/symlinks=False/symlinks=True/' | POETRY_HOME=$install_path python3 - --git https://github.com/python-poetry/poetry.git@"$version" $flags
  else
    fail "unknown install type"
  fi

After these changes, the command worked for me and I was able to install poetry again with mise.

@ethunk ethunk changed the title Poetry Install Issues (Related to symlink) Poetry Install Issues with mise (Related to symlink and python3.*dylib missing) Feb 3, 2024
@jdx
Copy link
Member

jdx commented Feb 20, 2024

I wonder if this is related to #6 and if this fixes that issue with precompiled binaries. If so, we might want to think about how to incorporate this patch into the plugin

@jylenhofdecat
Copy link

The provided fix indicated here helped me to correctly install poetry via mise for me too. Perhaps time to push a fix in the plugin ?

@gzurowski
Copy link

I also ran into the exact same issue and the workaround described by @ethunk fixed it for me. It would be great to incorporate this upstream.

@cobyism
Copy link

cobyism commented Mar 11, 2024

+1 also ran into this exact issue. Fix described by @ethunk allowed install to work. Thanks! 💟

  • System: Mac OS (M2)
  • Poetry v1.8.2

@sjpalf
Copy link

sjpalf commented Apr 13, 2024

In case this helps anyone, based on the fix above I added the following to my Dockerfile to get mise install poetry working (on debian:bookworm-slim)

RUN sed -i 's@curl -sSL "$install_url" |@curl -sSL "$install_url" | sed '\''s/symlinks=False/symlinks=True/'\'' |@g' ~/.local/share/mise/plugins/poetry/bin/install

@ducdetronquito
Copy link

ducdetronquito commented Apr 28, 2024

Thanks for the fix @ethunk : works like a charm now !

EDIT: Hard to sell to my coworkers, but enough to let me play with mise :)

(Ubuntu 22.04, Python 3.11.8, poetry 1.7.1)

@jdx
Copy link
Member

jdx commented Apr 28, 2024

This is biting a lot of people and it's a bad issue. If we're not able to get a fix in, it would be really good for us to have some sort of warning or something, unfortunately it's not easy to detect and there really isn't anything I think we could do when poetry is actually executed. It's probably equally problematic even if users. I have tried to see if I can fix this so poetry just works but I really have no idea what needs to change in order to fix it unfortunately.

Maybe in the short term to stop the bleeding, would someone mind modifying this warning to specifically call out poetry? Maybe be super loud if we notice the user is also using the poetry plugin? https://github.com/jdx/mise/blob/main/src/plugins/core/python.rs#L139

TibiIius added a commit to TibiIius/dotfiles that referenced this issue May 13, 2024
* Use pre-compiled bins for Python (see
  mise-plugins/mise-poetry#9
  aswell)
* Don't use Poetry globally
* Remove yarn (we use corepack instead)
@andersfylling
Copy link

What are the blockers for introducing the fix by @ethunk?

I had to do the same for my linux system.

@jdx
Copy link
Member

jdx commented May 17, 2024

oh right, I forgot about that, I suppose we can try it

jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
jdx added a commit that referenced this issue May 17, 2024
@jdx jdx linked a pull request May 17, 2024 that will close this issue
@jdx jdx closed this as completed in #14 May 17, 2024
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

Successfully merging a pull request may close this issue.

8 participants