ModuleNotFoundError: No module named 'omero_zarr._version'
I'm seeing an import Error using a conda environment on ome-zarr-dev1 machine (but I don't see any error on a local env): e.g.
(omero_zarr_export) [wmoore@ome-zarr-dev1 idr0001]$ omero login
Error loading: /lifesci/groups/jrs/wmoore/miniconda3/envs/omero_zarr_export/lib/python3.9/site-packages/omero/plugins/zarr.py
Traceback (most recent call last):
File "/lifesci/groups/jrs/wmoore/miniconda3/envs/omero_zarr_export/lib/python3.9/site-packages/omero/cli.py", line 1690, in loadpath
execfile(str(pathobj), loc)
File "/lifesci/groups/jrs/wmoore/miniconda3/envs/omero_zarr_export/lib/python3.9/site-packages/past/builtins/misc.py", line 87, in execfile
exec_(code, myglobals, mylocals)
File "/lifesci/groups/jrs/wmoore/miniconda3/envs/omero_zarr_export/lib/python3.9/site-packages/omero/plugins/zarr.py", line 1, in <module>
from omero_zarr.cli import HELP, ZarrControl
File "/lifesci/groups/jrs/wmoore/miniconda3/envs/omero_zarr_export/lib/python3.9/site-packages/omero_zarr/__init__.py", line 21, in <module>
from ._version import version as __version__
ModuleNotFoundError: No module named 'omero_zarr._version'
I tried a different pattern to import __version__ within __init__.py:
from . import _version
__version__ = _version.version
Again, this works on my local machine but not on the ome-zarr-dev1 server env:
(omero_zarr_export) [wmoore@ome-zarr-dev1 ~]$ python
Python 3.9.0 | packaged by conda-forge | (default, Nov 26 2020, 07:57:39)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from omero_zarr.cli import HELP, ZarrControl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lifesci/groups/jrs/wmoore/miniconda3/envs/omero_zarr_export/lib/python3.9/site-packages/omero_zarr/__init__.py", line 21, in <module>
from . import _version
ImportError: cannot import name '_version' from partially initialized module 'omero_zarr' (most likely due to a circular import) (/lifesci/groups/jrs/wmoore/miniconda3/envs/omero_zarr_export/lib/python3.9/site-packages/omero_zarr/__init__.py)
Seems this may only be an issue when installing this from github:
pip install git+https://github.com/ome/omero-cli-zarr.git@master
Installing directly from pypi fixes this issue.
Having released omero-cli-zarr v0.5.4 and upgraded to this on my remote ome-zarr-dev1 environment, I now see this import Error with that installed from pypi, but downgrading back to v0.5.3 fixes the issue (with no other dependency changes).
Comparing the releases, I don't see any code changes that would cause this issue: https://github.com/ome/omero-cli-zarr/compare/v0.5.3...v0.5.4
Returning to a conda env on pilot-zarr1-dev where I have previously been exporting NGFF for IDR conversions, with https://github.com/ome/omero-cli-zarr/pull/147/commits/ecf5a3ebf03f2c9e75ed97c518bbbc051c8e66a6, without changing the version installed, I now find that I get the ModuleNotFoundError above, when I haven't seen this before on this environment!?
cc @jburel @joshmoore - Any ideas what's going on here? Seems the 0.5.4 release is broken, so we need to fix or revert the release (if that's possible)?
pip install . in a fresh clone also shows this issue.
I'm inclined to move to verioneer as in https://github.com/German-BioImaging/omero-rdf/pull/4
the problem is coming from scm itself. Error in the action
Requirement already satisfied: wheel in /usr/lib/python3/dist-packages (0.37.1)
/usr/lib/python3/dist-packages/setuptools/installer.py:2[7](https://github.com/ome/omero-cli-zarr/actions/runs/7045520856/job/19175424186#step:5:8): SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
/home/runner/work/omero-cli-zarr/omero-cli-zarr/.eggs/setuptools_scm-[8](https://github.com/ome/omero-cli-zarr/actions/runs/7045520856/job/19175424186#step:5:9).0.4-py3.10.egg/setuptools_scm/_integration/setuptools.py:30: RuntimeWarning:
ERROR: setuptools==59.6.0 is used in combination with setuptools_scm>=8.x
Your build configuration is incomplete and previously worked by accident!
setuptools_scm requires setuptools>=61
Suggested workaround if applicable:
- migrating from the deprecated setup_requires mechanism to pep517/518
and using a pyproject.toml to declare build dependencies
which are reliably pre-installed before running the build tools
warnings.warn(
/home/runner/work/omero-cli-zarr/omero-cli-zarr/.eggs/setuptools_scm-8.0.4-py3.10.egg/setuptools_scm/_integration/setuptools.py:[9](https://github.com/ome/omero-cli-zarr/actions/runs/7045520856/job/19175424186#step:5:10)0: UserWarning: version of omero-cli-zarr already set
warnings.warn(f"version of {dist_name} already set")
Heh. Nice find. If you'd prefer the more immediate fix, no objection. I do have the feeling that we should be migrating setup.py to pyproject.toml everywhere when possible.
I have been thinking about that migration too. This is a new repo so it will make sense to start with that one
@jburel Where are you seeing that error? All the recent PRs have been 'green' when merged?
Ah - you're talking about Josh's PR, not the ModuleNotFoundError from this PR!