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 creates wrong venv and fails if python version if specified #523

Closed
jgirardet opened this issue Oct 18, 2018 · 4 comments
Closed

Comments

@jgirardet
Copy link
Contributor

jgirardet commented Oct 18, 2018

  • [ x] I am on the latest Poetry version.
  • [ x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x ] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

poetry is installed via the new installer.

with the folowing pyproject :

[tool.poetry]
name = "trypoe"
version = "0.3.0"

[tool.poetry.dependencies]
python = "^3.5"
jimmy@x-or:~/trash/faux$ poetry install
Creating virtualenv trypoe-py2.7 in /home/jimmy/trash/faux/.venv
Installing dependencies from lock file

Nothing to install or update

Installing trypoe (0.3.0)
                                                                              
[EnvCommandError]                                              
Command ['/home/jimmy/trash/faux/.venv/bin/pip', 'install', '-e', '/home/jim      
my/trash/faux', '--no-deps'] errored with the following output:             
Obtaining file:///home/jimmy/trash/faux                                     
  Installing build dependencies: started                                    
  Installing build dependencies: finished with status 'done'                
trypoe requires Python '>=3.5,<4.0' but the running Python is 2.7.15        
You are using pip version 10.0.1, however version 18.1 is available.        
You should consider upgrading via the 'pip install --upgrade pip' command.  
                                                                              
install [--no-dev] [--dry-run] [-E|--extras EXTRAS] [--develop DEVELOP]

It seems that poetry first create a venv and then checks while install if python version is good. It's not and then it fails.
The failing is the intended behavior.
I understand I should create the venv to make it work.
I understand that on linux this is solved py adding a .python-version in the directory.

but:
I think it is bug because since venv creation and install is the same command, users don't expect it could fail. On brand new project, you does "poetry install" and it fails depending the way you installed poetry (depending the python version). This make poetry harder to share.

My suggestion :

  • we keep the current behavior for already created/activated venv.
  • when poetry run without venv already created : it checks the pyproject for a python constraint. If one exists it searches for the latest compatible python version in path and install venv with it (for example if python^3.5 in pyproject and 3.6 and 3.7are availaible it will install venv via 3.7). if no compatible python version is available, it fails before creating the venv.
  • if no python constraint, it runs as usual.

This proposal doesn't cost much in running time. keep the current poetry behavior. let poetry away from managing python version and give to poetry install more consistency and a non failing default behavior for the case I 've shown.

Of course I'd be happy to do the thing if you are ok with it @sdispater , and thank you for this brand new release

@epage
Copy link
Contributor

epage commented Oct 18, 2018

Related: #522

@jgirardet
Copy link
Contributor Author

I see 4984624
and I hesitate to close this issue.
Now poetry will fail with a clear error message but at the end it's still a failure, and I'm definitely sure we could improve this user experience adding a default way to make it not fail.

@sdispater
Copy link
Member

@jgirardet

it's still a failure

Yes, but this makes it clear that the issue is on the user's end and not due to Poetry.

Copy link

github-actions bot commented Mar 3, 2024

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 Mar 3, 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

3 participants