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

consider pipx as installation method #677

Closed
1 task done
cs01 opened this issue Nov 27, 2018 · 13 comments
Closed
1 task done

consider pipx as installation method #677

cs01 opened this issue Nov 27, 2018 · 13 comments

Comments

@cs01
Copy link

cs01 commented Nov 27, 2018

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

Issue

pipx is a new project I started that replaces pipsi. pipsi is great but development and support has stopped, so I started pipx with the goal of using modern Python (venv's only, Python 3.6+), improving the UX, adding new commands, and adding an option to run applications in one-time environments that are deleted after exit.

pipx installs poetry nicely and might be a good alternate way to recommend poetry be installed.

Attached is a short video demonstrating its installation.
pipx_poetry_demo

https://github.com/cs01/pipx

@gonvaled
Copy link

This seems to be working for me. The official install method fails in Linux Mint 19 Tara

@batisteo
Copy link
Contributor

Is your proposition is to replace

curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

by

curl https://raw.githubusercontent.com/cs01/pipx/master/get-pipx.py | python3
pipx install poetry

@cs01
Copy link
Author

cs01 commented Nov 30, 2018

IMO it makes sense to let poetry stop worrying about maintaining custom installers and let pipx focus on that. So long term I think replacing is the right choice.

This means

poetry self:update

will turn into

pipx upgrade poetry

and to install a specific version,

pipx upgrade poetry --spec poetry==0.12.5

The poetry self:update --preview option would need to be replaced with something like

pipx upgrade poetry --spec git+https://github.com/sdispater/poetry.git@develop

The preview option will only work once pip has support for PEP 517 added (it currently fails with this command because it is hardcoded to install by cloning the git repo, then running setup.py rather than being flexible enough to be told to clone and run poetry install).

Unless @sdispater or others feel it is generally more reliable than the recommended installation method (as @gonvaled indicated), I am currently suggesting that it is added alongside the pipsi instructions.

@sdispater
Copy link
Member

@cs01 I'd gladly review and merge a PR that adds (or replace pipsi) pipx to the documentation. However it's unlikely that it will replace the recommended installer. Here are a few reasons:

  • The installer installs Poetry in such a way that it is completely isolated from the rest of the system (vendored dependencies). That way its dependencies are fixed and there is no risk of dependencies being removed or updated by the installation of another tool. I know pipx installs in a virtualenv but this is not the same thing as having a fixed set of dependencies.
  • If you install it via pipx (like with pip), Poetry will only be aware of the Python executable it has been installed for and as such will not be able to pick up the proper python version set by a tool like pyenv. Let's say I execute pipx install poetry for pipx installed for Python 3.7.1, the poetry command will be linked with Python 3.7.1. So if I later do pyenv shell 3.6, poetry will still see Python 3.7.1.

@bersace
Copy link

bersace commented Dec 14, 2018

Note that poetry is incompatible with docker-compose. They conflict on jsonschema version. That's a good reason to have poetry in it's own venv. I just wished .poetry was in .local or .cache because i don't like to clutter my home.

@batisteo
Copy link
Contributor

Now I really have the feeling that a Python packaging/dependency manager shouldn’t be written in Python… 😞

@funkyfuture
Copy link
Contributor

Note that poetry is incompatible with docker-compose. They conflict on jsonschema version. That's a good reason to have poetry in it's own venv. I just wished .poetry was in .local or .cache because i don't like to clutter my home.

well, you'd have to install Docker-Compose w/ pipx.

@RoelantStegmann
Copy link

If you install it via pipx (like with pip), Poetry will only be aware of the Python executable it has been installed for and as such will not be able to pick up the proper python version set by a tool like pyenv. Let's say I execute pipx install poetry for pipx installed for Python 3.7.1, the poetry command will be linked with Python 3.7.1. So if I later do pyenv shell 3.6, poetry will still see Python 3.7.1.

Yes, I had this issue. It is sad, because installing poetry in each conda env feels like overdoing it.

@fgervais
Copy link

fgervais commented Jun 25, 2021

@sdispater does the pipx installation still have the above-mentioned shortcomings compared to the new install-poetry.py script?

Since install-poetry.py uses virtualenv and pip now I guess poetry has a way to mitigate previous concerns related to pipx and the isolation?

@shelper
Copy link

shelper commented Jul 7, 2021

@cs01 I'd gladly review and merge a PR that adds (or replace pipsi) pipx to the documentation. However it's unlikely that it will replace the recommended installer. Here are a few reasons:

  • The installer installs Poetry in such a way that it is completely isolated from the rest of the system (vendored dependencies). That way its dependencies are fixed and there is no risk of dependencies being removed or updated by the installation of another tool. I know pipx installs in a virtualenv but this is not the same thing as having a fixed set of dependencies.
  • If you install it via pipx (like with pip), Poetry will only be aware of the Python executable it has been installed for and as such will not be able to pick up the proper python version set by a tool like pyenv. Let's say I execute pipx install poetry for pipx installed for Python 3.7.1, the poetry command will be linked with Python 3.7.1. So if I later do pyenv shell 3.6, poetry will still see Python 3.7.1.

well then if i use the https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py to install poetry, then my poetry is linked to whatever the python version that runs this script. so poetry is linked to this python version anyway, i dont see how this is different from using pipx...
anyway just a comment, maybe i missed something, but either way, poetry should be installed by the new installation script

br3ndonland added a commit to br3ndonland/dotfiles that referenced this issue Oct 19, 2021
1d8eee0
884d475

Poetry has a new install script, install-poetry.py, which alters the
requirements for adding Poetry to `$PATH`. `$HOME/.local/bin` was
already on `$PATH` for pipx, so it seemed like a good option. Commits
1d8eee0 and 884d475 updated `.zshrc` and `script/strap-after-setup` for
install-poetry.py and `POETRY_HOME=$HOME/.local`.

This made sense initially, because Poetry installs its binaries into
`$POETRY_HOME/bin`, and because Poetry doesn't have a `$POETRY_BIN_DIR`
configuration variable like pipx does (`$PIPX_BIN_DIR`). Unfortunately,
`POETRY_HOME=$HOME/.local` ended up being problematic, because Poetry
takes over `$POETRY_HOME`, and doesn't consider other applications
installed there. For example, if the get-poetry.py or install-poetry.py
scripts were used to install Poetry, they can also be used to uninstall
Poetry. Uninstalling with `python install-poetry.py --uninstall` or
`python get-poetry.py --uninstall` deletes the entire `$POETRY_HOME`
directory, which means it deletes `$HOME/.local`, causing problems for
other applications that use `$HOME/.local` (python-poetry/poetry#4625).

There have been many other issues with the Poetry custom install scripts
get-poetry.py and install-poetry.py (br3ndonland/inboard#36), so other
installation methods are be welcome.

Poetry is now available through Homebrew, but Homebrew installation is
not supported by the Poetry maintainers. Homebrew installation also
requires its own custom install script, which creates its own issues.
python-poetry/poetry#941
python-poetry/poetry#1765
Homebrew/homebrew-core#48883
Homebrew/homebrew-core#86776

pipx (https://pypa.github.io/pipx/) can also be used to install Poetry.
The pipx installation method is suggested in the Poetry docs and GitHub,
and pipx is already in use in this repo.
python-poetry/poetry#677
python-poetry/poetry#3360

This commit will remove `export POETRY_HOME=$HOME/.local` from `.zshrc`,
and will install Poetry with pipx.
@wtfzambo
Copy link

@cs01 I'd gladly review and merge a PR that adds (or replace pipsi) pipx to the documentation. However it's unlikely that it will replace the recommended installer. Here are a few reasons:

  • The installer installs Poetry in such a way that it is completely isolated from the rest of the system (vendored dependencies). That way its dependencies are fixed and there is no risk of dependencies being removed or updated by the installation of another tool. I know pipx installs in a virtualenv but this is not the same thing as having a fixed set of dependencies.
  • If you install it via pipx (like with pip), Poetry will only be aware of the Python executable it has been installed for and as such will not be able to pick up the proper python version set by a tool like pyenv. Let's say I execute pipx install poetry for pipx installed for Python 3.7.1, the poetry command will be linked with Python 3.7.1. So if I later do pyenv shell 3.6, poetry will still see Python 3.7.1.

well then if i use the https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py to install poetry, then my poetry is linked to whatever the python version that runs this script. so poetry is linked to this python version anyway, i dont see how this is different from using pipx... anyway just a comment, maybe i missed something, but either way, poetry should be installed by the new installation script

For me is exactly the same. Tested both in windows and linux, poetry is tied to the python version it's been used to install it.

The only way I found to specify a different one when creating a virtual environment is to run poetry env use your_python_version_here. Activating it (with pyenv or scoop) when running poetry new or poetry init doesn't seem to do anything.

@namanrawal47
Copy link

The best way to install poetry using pipx today is:
pipx install poetry==1.2.2

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests