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

use python3 by default to install poetry #163

Closed
wants to merge 2 commits into from
Closed

use python3 by default to install poetry #163

wants to merge 2 commits into from

Conversation

jgirardet
Copy link
Contributor

Python3 should be default.

nobody on linux may execute this whithout sudo due to permission.

@digitalresistor
Copy link
Contributor

There is a PEP specific to this issue: https://www.python.org/dev/peps/pep-0394/ and it recommends that python continue to link to python2, whereas python3 should link to the latest version of Python 3 installed on a system.

This change will hurt users, whereas using python3 it will do the right thing most of the time.

@jgirardet
Copy link
Contributor Author

Hello,
maybe @bertjwregeer i'm not sure to all understand you said.
My mind is : everyone is leaving python2 so poetry should recommand python3. maybe my PR is not the good way to do it.
Maybe I'm wrong but I believe that on every system where python3 is system standard, there are both python and python3.

@digitalresistor
Copy link
Contributor

Ah, I misread the PR. Sorry!

@jgirardet jgirardet mentioned this pull request Jun 1, 2018
2 tasks
README.md Outdated
@@ -16,7 +16,7 @@ from the rest of your system by vendorizing its dependencies. This is the
recommended way of installing `poetry`.

```bash
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | sudo -H python3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces two changes: python -> python3; and the introduction of sudo -H.

On my machine (macOS with homebrew-installed python@2 and python3), using this with just the python3 change had the desired affect: it created a python3 virtual environment such that both
poetry run which python and poetry run which python3 refer to a Python in the appropriatevirtualenv, and both poetry run python --version and poetry run python3 --version display Python 3.6.5.

So yay for that! (I'd been trying to figure out how to use Poetry for Python 3 development, and was surprised that putting python = ">=3.0" in pyproject.toml didn't work. This PR saved me.)

I suspect, based on prior experience with sudo and homebrew, that if I'd run it with the sudo, I would have mixed up some ownerships in /usr/local/ in a way that could cause trouble downstream.

Maybe the sudo -H part of this change can either simply be removed, or moved to a different PR since if it's necessary at all, its has different compatibility issues and may be solving a different issue.

@osteele
Copy link

osteele commented Jun 12, 2018

The change from python -> python3 works for me. I'm skeptical of adding sudo -H, and didn't need it. I left a longer comment on the line change. (Also, thanks for doing this. Finding this PR got me unblocked on trying out Poetry.)

@sdispater
Copy link
Member

While the change for python3 seems good to me, I am not comfortable recommending sudo. Generally, I don't think it's a good idea to install tools like poetry for the root user.

@jgirardet
Copy link
Contributor Author

ok but there still is a problem with the recommanded way to install poetry :
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3
will alway fail on a standard linux distro due to permission :

jimmy@jimmyMint ~ $ curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3
Retrieving metadata

Installing version: 0.10.3
  - Getting dependencies
  - Vendorizing dependencies
  - Installing poetry
An error has occured: Command '('/usr/bin/python3', '-m', 'pip', 'install', '--upgrade', '--no-deps', '/tmp/poetry-installer-rr8vh6e7/poetry-0.10.3-py2.py3-none-any.whl')' returned non-zero exit status 1
Processing /tmp/poetry-installer-rr8vh6e7/poetry-0.10.3-py2.py3-none-any.whl
Installing collected packages: poetry
Could not install packages due to an EnvironmentError: [Errno 13] Permission non accordée: '/usr/local/lib/python3.5/dist-packages/__pycache__/toml.cpython-35.pyc'
Consider using the `--user` option or check the permissions.

@cauebs
Copy link
Contributor

cauebs commented Jun 15, 2018

I agree with @sdispater and personally prefer the solution proposed by #146

@jgirardet jgirardet changed the title python 3 sudo use python3 by default to install poetry Jun 18, 2018
@cauebs
Copy link
Contributor

cauebs commented Jun 18, 2018

Is there a strong enough reason to recommend Python 3 explicitly? Don't get me wrong, I'm 100% pro-Python3, but Poetry supports 2.7 just as well.

@jgirardet
Copy link
Contributor Author

actually I don't know if this PR is a good thing. it stays complicated to install even with the --user of #146

@sdispater why not just use pipsi. it works very good with poetry and install is only pipsi install poetry and thats it.

@cauebs
Copy link
Contributor

cauebs commented Jun 18, 2018

What is the problem in installing with --user?

For me, if poetry is installed through pipsi, it doesn't work properly. Also, I personally think poetry should provide pipsi's functionality, as suggested in #149.

@jgirardet
Copy link
Contributor Author

I just think that installing an app via a script is something painfull.
What doesn't work by you with pipsi ?

@cauebs
Copy link
Contributor

cauebs commented Jun 18, 2018

Let's assume that I installed poetry through pipsi. If I create a new project and let poetry create the virtualenv, pip is not linked in .venv/bin and every install will fail with "permission denied" because system-wide pip will be used.

(this was reported in #169, but back then I was really confused, hahah)

@jgirardet
Copy link
Contributor Author

you are right. I did not see it because I only use poetry with pyenv.
But not sure is it pipsi's fault. maybe poetry which should use the pip of the created virtualenv.

@cauebs
Copy link
Contributor

cauebs commented Jun 18, 2018

That's the thing: the created virtualenv has no pip.

@sdispater
Copy link
Member

Closing since the new installer is now more flexible.

@sdispater sdispater closed this Oct 25, 2018
Copy link

github-actions bot commented Mar 1, 2024

This pull request 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 Mar 1, 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

Successfully merging this pull request may close these issues.

6 participants