-
Notifications
You must be signed in to change notification settings - Fork 68
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
Scripts and dependencies updates for Python 3.8 - 3.10 #2009
Conversation
Thanks for this—much appreciated. I was struggling with the various dependency issues between starfish, napari, xarray, numpy and scikit-image over the past few days, but this PR fixes it, and also fixes the various scikit-image deprecation bugs, as well as the changes in napari for spots (I had just been adding the coords for each spot manually to the viewer with I tried installing everything in a python 3.10 conda environment and it seemed like it was working for me. |
this is really great- thanks @shachafl for digging into this. Currently the mypy check is failing (to run)- can you check if
|
@berl I hit a "wall" when running further tests: Any assistance is welcome. |
Almost. reading sources... [100%] user_guide/working_with_starfish_outputs/index Warning, treated as error: I can circumvent the error on my local machine by running the command twice, and between the runs edit docs/source/conf.py to add 'xarray' to autodoc_mock_imports: This can be reproduced locally by forcing sphinx to run all the relevant scripts (adding the below to conf.py): In this case sphinx-gallery fails to run as it is doing a mock import of 'xarray' when running python plot scripts. |
Hey @berl, Many thanks in advance. |
@shachafl thanks for grinding through the dependencies on this! also,
|
@berl thanks for reviewing this. This was a much deeper "rabbit hole" than intended. Regarding your items:
|
selsm was replaced with footprint in scikit-image 0.20
…ate all req files updating requirements files to support sphinx's make html
… backward compatible.
added: from typing import Optional
…e but got ndarray instead: replaced np.arange with range
… field_of_view schema
…pe import with xarray
docs(packaging): minor syntax correction
…how to fix broken napari or jupyter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super excited about this. there are a few places we should note planned improvements:
xarray
pinning is (I think) due to some outdated syntax for initializing aDataArray
somewhere inImageStack
napari
issues date back to before the days ofnapari-plugin
so there may be a better way to includenapari
for visualization by going that route- on the topic of visualization, SpatialData uses an external commercial viewer (10x Xenium Explorer) by writing a compatible file bundle. There are some risks with this (there is still quite a bit of churn on the viewer and the file spec and I'm not aware of a validator other than trying to open a file) but it would bring
starfish
output into the modern world.
The motivation for this PR was significant algo improvements for blob detection in scikit-image 0.20 released on February 2023, together with some recommendations for the python scientific community about maintaining support for outdated packages and python interpreters (https://scientific-python.org/specs/spec-0000/).
Nevertheless, at this point I only recommend dropping support for python < 3.8, as it seems still very popular, but I don't feel strongly about it if the team prefer to drop support for python < 3.10.
To update dependencies and solve conflicts I used pip-tools (https://github.com/jazzband/pip-tools):
Make new virtual environment and upgrade/install packages
$ python3 -m venv venv
$ source venv/bin/activate
$ python3 -m pip install --upgrade pip setuptools wheel pip-tools
To update dependency list, I removed REQUIREMENTS.txt file, and run (this step is only needed when wishing to change dependency versions, see pip-tools docs):
$ rm REQUIREMENTS.txt
$ pip-compile requirements.in --output-file REQUIREMENTS.txt
Install/update python packages, equivalent to "python3 -m pip install -r REQUIREMENTS.txt"
$ pip-sync REQUIREMENTS.txt
Install starfish from local repository, in development mode:
$ pip3 install -e .
After further updating requirements/REQUIREMENTS-CI.txt.in and using pip-tools again, I was able to install starfish following the developer guide (https://spacetx-starfish.readthedocs.io/en/latest/developer_guide/) and run the tests listed in starfish-prod-ci.yml using the Makefile.
Starting to summarize the PR (by commits):
Changes due to scikit-image ver 0.19-0.21 (not backward compatible): 0f63cd0, 6c4c2df, e21a642, e4e6499 (Expose
GeometricTransform.residuals
in HTML doc scikit-image/scikit-image#6968), b21f2af.Upgrading to pandas 2.0 with backward compatibility:
3653ad7
Napari >= 0.4.18 (& Vispy >= 0.12): dropped support for anisotropic spot size (https://forum.image.sc/t/anisotropic-point-sizes/83388). Here I left most of the code as anisotropic spot size is suppose to return at a later Napari/Vispy version. I only used np.mean() to get a single spot size, but don't feel strongly about it if min(), max(), etc. is preferred. 19b4e00
Updating dependencies in REQUIREMENTS.txt: d5c1835, 68d338d
Deprecated numpy dtypes: 7b24d34
Lastly, this PR will require some minor updates to docs (using pip-tools in Makefile, removing python < 3.8, etc).