Can I get Poetry to reinstall ipykernel after installing ipywidgets?

Question:

I’m developing a Python package. I used Poetry to set up my development environment; I intend to distribute my code through PyPI. One of my dependencies requires ipywidgets<7.7.2, as documented here. Due to a bug (mentioned here), ipykernel must be reinstalled after ipywidgets is installed.

This SO answer says that developers can’t specify the order that Poetry installs packages. Is this still true? If so, what is the simplest way to get users to re-install ipykernel after installing ipywidgets?

I could add something to my documentation telling users to run pip uninstall ipykernel then pip install ipykernel. But this seems like it would trip up unwary users?

Asked By: Danny

||

Answers:

  • Assuming you have activated Poetry virtual environment with poetry shell command

  • When you run pip install after poetry install, it unconditionally overwrites any packages installed the virtual environment

Answered By: Mikko Ohtamaa