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

Notebook to agree with Poetry settings #22

Closed
rolyp opened this issue Sep 21, 2021 · 3 comments · Fixed by #23
Closed

Notebook to agree with Poetry settings #22

rolyp opened this issue Sep 21, 2021 · 3 comments · Fixed by #23
Assignees
Labels

Comments

@rolyp
Copy link
Collaborator

rolyp commented Sep 21, 2021

Running a notebook via poetry run jupyter notebook in the project folder (or starting poetry shell and then running jupyter notebook) should, I think:

  • ensure the Python version in the notebook (when saved) agrees with the version chosen by poetry
  • ensure all the Python dependencies specified in pyproject.toml are available

Unfortunately, neither of these things seems to be true: when @edwardchalstrey1 saves his notebook, it records the Python version as 3.7.4, and when I try import pytest, it fails with ModuleNotFoundError. The former in particular is annoying as we now get spurious differences when collaborating on the same notebook.

@rolyp rolyp added the CI/CD label Sep 21, 2021
@rolyp rolyp changed the title Python version in notebook should agree with Poetry settings Notebook to agree with Poetry settings Sep 21, 2021
@edwardchalstrey1
Copy link
Member

Fixed this by doing poetry add jupyter ipykernel - will PR

@rolyp
Copy link
Collaborator Author

rolyp commented Sep 27, 2021

@edwardchalstrey1 This all looks great. Annoyingly, I'm still getting a Python discrepancy (it seems I have 3.9.1 installed into my local environment, whereas the notebook is now saying 3.9.7, presumably the version you have installed?). I assumed that poetry.lock would somehow fix the Python version in a way that satisfies the python = "^3.9" constraint in pyproject.toml, but I can't see anywhere that the Python version is set in poetry.lock. (See this issue for discussion.)

I'm going to experiment with changing the Python version constraint in pyproject.toml from python = "^3.9" to python = "3.9.7".

@rolyp
Copy link
Collaborator Author

rolyp commented Sep 27, 2021

Another annoying Poetry feature seems to be that if you change the Python version (to one that isn't installed locally), then none of poetry update, poetry lock and poetry install will attempt to change the Python version (and thus discover that it isn't available). But if you then re-clone the repo and attempt a poetry install from scratch, it will fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants