Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BUG: When poetry add failed, package is listed as added but is not installed. Also add proper handling for multiple packages install in "poetry add": when one package is already added, others are not getting added. #98

Closed
buriy opened this issue May 8, 2018 · 10 comments · Fixed by #2886
Labels
area/error-handling Bad error messages/insufficient error handling

Comments

@buriy
Copy link

buriy commented May 8, 2018

If "poetry add" fails with an error on a package installation,
then after fixing the error it says "already added".
I need to remember to use "poetry install" then instead.

The same happens if you want to add more than one entry, and the first entry was already installed: it writes that the entry was already added, not doing anything.

And the third issue is that if one issue breaks, "poetry add" doesn't add anything and tries to run an install first!

Fourth, after a "poetry add" fail, I have to add the entry manually and then run "poetry install" which writes that "you probably updated your file, run poetry update for that".
That means that while "poetry add" can check for the project file updates, "poetry install" can't. That behavior feels wrong.

Suggestions:

  1. remove error "Package A is already present", and when trying to add an existing package, instead, show what is the current version of that package in the project file, like "Package A of version 2.3.1 is selected". Or, maybe, even better it is to replace the already added version instead of displaying current version.
  2. on "poetry add", first add everything to the project file, only then run install
  3. probably, poetry install should be consistent with poetry add, or maybe "poetry add" without arguments should work like "poetry update".
@buriy buriy changed the title Inconsistent behaviour of poetry add, install and update Inconsistent behavior of poetry add, install and update May 8, 2018
@kasteph
Copy link
Member

kasteph commented Jun 3, 2019

@buriy Can you provide an example so that I can reproduce these issues on my machine?

@buriy
Copy link
Author

buriy commented Jun 3, 2019

@stephsamson
There are several different "WTF?"-raising ( see https://en.wikipedia.org/wiki/Principle_of_least_astonishment ) use-cases here. The easiest one is below:

poetry add jupyter
poetry add jupyter pydub 

->

Installing jupyter (1.0)

then

[ValueError]           
Package jupyter is already present  

I don't have a right example of a broken package for "poetry add" -- but once it happens it looks similar to the ValueError above.
Let's start with this one, leaving aside that "poetry install" has nothing to do with "installing jupyter (1.0)" here, but has a completely different meaning of "poetry install --locked".

@brycedrennan brycedrennan added the kind/feature Feature requests/implementations label Aug 21, 2019
@stale
Copy link

stale bot commented Nov 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 13, 2019
@buriy
Copy link
Author

buriy commented Nov 14, 2019

Here is the recent activity

@stale stale bot removed the stale label Nov 14, 2019
@finswimmer
Copy link
Member

I have to investigate it a little bit more. But I guess this it what happens:

When you add a package and something went wrong during installation and the exception isn't catched properly you and up having the package listed as an dependency in the pyproject.toml but it is not listed in the poetry.lock.

The simple workaround in this case is to remove the entry from pyproject.toml and use poetry add again.

@buriy
Copy link
Author

buriy commented Apr 20, 2020

@finswimmer
I heard poetry is a tool that helps users, rather than asking doing everything manually ;)
This needs to be fixed.

@buriy buriy changed the title Inconsistent behavior of poetry add, install and update BUG: When poetry add failed, package is listed as added but is not installed. Proper handling for multiple packages install in "poetry add". Apr 20, 2020
@buriy buriy changed the title BUG: When poetry add failed, package is listed as added but is not installed. Proper handling for multiple packages install in "poetry add". BUG: When poetry add failed, package is listed as added but is not installed. Also add proper handling for multiple packages install in "poetry add": when one package is already added, others are not getting added. Apr 20, 2020
@ggteixeira
Copy link

Same here. Visual Studio Code keeps asking me to install Pylama even if it's already added by Poetry.

@finswimmer finswimmer added area/error-handling Bad error messages/insufficient error handling and removed kind/feature Feature requests/implementations labels Jul 10, 2020
@jacebrowning
Copy link
Contributor

jacebrowning commented Aug 23, 2020

It's my understanding that the Package jupyter is already present error when attempting to poetry add jupyter a second time is the expected behavior.

Unless someone can share a way to reproduce poetry add <package> failing for a different reason, I don't think this issue is actionable. ✌️

@buriy
Copy link
Author

buriy commented Aug 24, 2020

@jacebrowning problem is not that
"poetry add jupyter" fails -- that's expected behaviour.

Problem is that attempt to add multiple packages:
"poetry add jupyter numpy" fails and installs nothing if jupyter is installed but numpy is not installed.
Rather it should say "jupyter is already installed" and install numpy.

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
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
area/error-handling Bad error messages/insufficient error handling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants