question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`poetry update` with git-based dependencies updates `poetry.lock` but not the virtual environment

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

Issue

I have a git dependency that is defined with a branch instead of a specific commit or revision. As a result, the commit that the reference points to can change.

poetry update successfully updates the poetry.lock file with the correct latest commit, but the library in the virtual environment remains checked-out at the commit that was latest when poetry install was last run.

Replication

  • Add a git-based dependency to a poetry project.
  • poetry install
  • Note the commit hash that was installed (e.g. inside poetry shell, cd $VIRTUAL_ENV/src/<git dependency name> && git log | head -1)
  • Note the commit hash that was set in poetry.lock (cat poetry.lock | grep -i <git dependency name> -B 2 | grep -i reference worked for me, but obviously YMMV; you’re looking for the reference field in the package.source block with the url equal to the git repository you installed from)
  • Push another commit to the git-based dependency.
  • poetry update <git dependency name>
  • Note that the reference in poetry.lock has changed
  • Note that the checked-out commit in src has not changed

I expected that since poetry.lock was updated that my virtualenv was updated as well.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:56
  • Comments:36 (6 by maintainers)

github_iconTop GitHub Comments

18reactions
thehappydinoacommented, Jul 8, 2021

Hi, I am still dealing with the same issue. Is there anything we can do to have this escalated/reopened? Maybe @sdispater or @abn ?

18reactions
revoltercommented, Dec 13, 2020

The workaround that I used was to comment out the package line in the pyproject.toml file, run poetry install, then uncomment it back and run poetry install again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic usage | Documentation | Poetry - Python dependency ...
When Poetry has finished installing, it writes all the packages and their exact versions that it downloaded to the poetry.lock file, locking the...
Read more >
Dependency Management With Python Poetry
Work With Python Poetry. Use Poetry's Virtual Environment; Declare Your Dependencies; Install a Package With Poetry. Handle poetry.lock.
Read more >
Python Virtual Environments tutorial using Virtualenv and Poetry
This blog post is mostly aimed at people who didn't work with it. Here you will find that this is not a complete...
Read more >
Poetry pyproject.toml not updating after running 'poetry add ...
I solved this by deleting all the poetry envs in my .cache/virtualenvs folder, and then running poetry install from within my project again, ......
Read more >
Configure a Poetry environment | PyCharm Documentation
Poetry is a tool that facilitates creating a Python virtual environment based on the project dependencies. You can declare the libraries your project ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found