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

Install on MacOs fails with Exception: This build of python cannot create venvs without using symlinks #52

Closed
3 of 4 tasks
adamryczkowski opened this issue Sep 22, 2022 · 17 comments
Labels
duplicate This issue or pull request already exists

Comments

@adamryczkowski
Copy link

  • Python version: 3.9.6

  • OS version and name: macOS 12.6

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Poetry installation fails on MacOS 12.6.

$ curl -sSL https://install.python-poetry.org/ | python3 -
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/aryczkowski/.local/bin

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

Installing Poetry (1.2.1): Creating environment
Traceback (most recent call last):
  File "<stdin>", line 940, in <module>
  File "<stdin>", line 919, in main
  File "<stdin>", line 550, in run
  File "<stdin>", line 571, 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 643, in make_env
  File "<stdin>", line 629, in make_env
  File "<stdin>", line 309, 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
@dimbleby
Copy link
Contributor

dimbleby commented Sep 22, 2022

duplicate of #24

@neersighted neersighted transferred this issue from python-poetry/poetry Sep 22, 2022
@neersighted neersighted added the duplicate This issue or pull request already exists label Sep 22, 2022
@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2022
@EddyDavies
Copy link

I had to install pyenv, a version of python and then activate in ~/.zshrc (or ~/.bashrc)

brew install pyenv
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
pyenv install 3.10.5
curl -sSL https://install.python-poetry.org | python3 -
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zprofile

@QuentinAdt
Copy link

Not sure if it help, but it worked be specifying the version, here 3.9:

curl -sSL https://install.python-poetry.org | python3.9 -

@therealbct
Copy link

therealbct commented Feb 24, 2023

To add to Quentin, I installed 3.10.1: pyenv install 3.10.1
This didn't work: curl -sSL https://install.python-poetry.org | python3.10.1 - (symlink error message)
This worked: curl -sSL https://install.python-poetry.org | python3.10 - (successful install)

@yash2tailorbird
Copy link

yash2tailorbird commented Mar 21, 2023

To add to Quentin, I installed 3.10.1: pyenv install 3.10.1 This didn't work: curl -sSL https://install.python-poetry.org | python3.10.1 - (symlink error message) This worked: curl -sSL https://install.python-poetry.org | python3.10 - (successful install)

had to uninstall system one and this worked for me on macos ventura zsh

@mistermocha
Copy link

I'm on a brand new mac with py3.9 installed and this should work as documented, but I keep getting the symlinks issue explained here. Forgive me for bothering here, but I don't think it's a good user experience to suggest that the best user case is to not just install 3.10, but to uninstall the system 3.9 python, especially when the docs say it should work with 3.6.

Line 309 of the installer script, where the venv is actually created, has this line:

builder = venv.EnvBuilder(clear=True, with_pip=True, symlinks=False)

I pulled the script local, flipped it to True, and ran it. I'm going to test this out for a spell to see if I run into troubles, then come back with a PR. It might be worth it to have a flag to choose this for such installs specifically, or to enable it for OSX installs.

@ChooseL1fe
Copy link

You can try brew install poetry

@aschwtzr
Copy link

aschwtzr commented Jun 4, 2023

Alternatively, use pyenv to set the global python which is unaliased by default.

~ python --version 
pyenv: python: command not found

The `python' command exists in these Python versions:
  3.9.10

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.
~ python3 --version (note: this is the system python on a fresh mac)
Python 3.9.6
~ pyenv global 3.9.10
~ python --version
Python 3.9.10
~ curl -sSL https://install.python-poetry.org | python
...
~ poetry --version
Poetry (version 1.5.1)

@doctor-entropy
Copy link

doctor-entropy commented Jun 16, 2023

I had to install pyenv, a version of python and then activate in ~/.zshrc (or ~/.bashrc)

brew install pyenv
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
pyenv install 3.10.5
curl -sSL https://install.python-poetry.org | python3 -
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zprofile

If you want to run this on MacOS, there are a couple extra steps to follow - (I am running this in bash)

brew install pyenv
pyenv install 3.10.5
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
curl -sSL https://install.python-poetry.org | python3 -
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bash_profile

@warjiang
Copy link

I had to install pyenv, a version of python and then activate in ~/.zshrc (or ~/.bashrc)

brew install pyenv
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
pyenv install 3.10.5
curl -sSL https://install.python-poetry.org | python3 -
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zprofile

set global python version works, thanks ~

@sg-s
Copy link

sg-s commented Sep 6, 2023

kinda sad that poetry's install completely fails. the only thing that worked for me was brew install poetry

@ngillett1
Copy link

Could use pipx to install instead.

@hughperkins
Copy link

Just to reiterate:

  1. this is a duplicate of Installation fails on MacOS #24
  2. a solution taht works for many people is to run:
curl -sSL https://install.python-poetry.org | sed 's/symlinks=False/symlinks=True/' | python3 -

@wilsoniwano
Copy link

Just to reiterate:

  1. this is a duplicate of Installation fails on MacOS #24
  2. a solution taht works for many people is to run:
curl -sSL https://install.python-poetry.org | sed 's/symlinks=False/symlinks=True/' | python3 -

It worked! Thanks!

@balloch
Copy link

balloch commented Feb 19, 2024

Just to reiterate:

  1. this is a duplicate of Installation fails on MacOS #24
  2. a solution taht works for many people is to run:
curl -sSL https://install.python-poetry.org | sed 's/symlinks=False/symlinks=True/' | python3 -

the documentation should be updated to state this

@sayfaslan
Copy link

echo 'eval "$(pyenv init --path)"' >> ~/.zshrc

Interesting... in pyenv docs one line is slightly different from yours.

Your: echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
Pyenv doc: echo 'eval "$(pyenv init -)"' >> ~/.zshrc

Which line is correct?

@vishalkotak
Copy link

Works with Python 3.13 too:

curl -sSL https://install.python-poetry.org | python3.13 -
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zprofile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests