aps-8id-dys / bluesky

XPCS bluesky instrument configuration
Other
2 stars 0 forks source link

There are problems with version info of some of the packages: #6

Closed prjemian closed 1 year ago

prjemian commented 1 year ago

There are problems with version info of some of the packages:

In [1]: RE.md["versions"]
Out[1]: 
{'apstools': '0.1.dev8+g0c0ec98.d20221216',
 'bluesky': '1.10.0',
 'databroker': '1.2.5',
 'epics': '3.5.0',
 'h5py': '3.7.0',
 'intake': '0.6.4',
 'matplotlib': '3.6.2',
 'numpy': '1.23.5',
 'ophyd': '1.7.0',
 'pyRestTable': '0.1.dev8+g0c0ec98.d20221216',
 'spec2nexus': '0.1.dev8+g0c0ec98.d20221216'}

This is related to use of setuptools-scm.get_version() in packages apstools, pyRestTable, and spec2nexus. Requires a fix (probably the same fix) in each of those.

Originally posted by @prjemian in https://github.com/aps-8id-dys/bluesky/issues/1#issuecomment-1355610394

prjemian commented 1 year ago

Have not been able yet to reproduce this problem in https://github.com/prjemian/spec2nexus/issues/298#issuecomment-1361431834. Wondering if this problem is local to the beam line's environment.

Will investigate further with a similar test environment local to the beam line.

prjemian commented 1 year ago

In a test environment with pysumreg installed via micromamba:

prjemian commented 1 year ago

path: ..../pysumreg/__init__.py:

"""Configuration of pysumreg package."""

from .sum_registers import SummationRegisters

try:
    from setuptools_scm import get_version

    __version__ = get_version()
    del get_version
except (LookupError, ModuleNotFoundError, Exception):
    from importlib.metadata import version

    __version__ = version("pysumreg")
prjemian commented 1 year ago

Noticed that version is reported differently with respect to the ~/bluesky/ directory:

(bluesky_2023_1) [8idiuser@bcda-rhel8:bluesky]$ python -c "import pysumreg; print(f'{pysumreg.__version__=}')"
pysumreg.__version__='0.1.dev13+g1178b8a.d20221221'
(bluesky_2023_1) [8idiuser@bcda-rhel8:bluesky]$ cd .environments/
(bluesky_2023_1) [8idiuser@bcda-rhel8:.environments]$ python -c "import pysumreg; print(f'{pysumreg.__version__=}')"
pysumreg.__version__='1.0.3'
(bluesky_2023_1) [8idiuser@bcda-rhel8:.environments]$ cd ~
(bluesky_2023_1) [8idiuser@bcda-rhel8:~]$ python -c "import pysumreg; print(f'{pysumreg.__version__=}')"
pysumreg.__version__='1.0.3'
(bluesky_2023_1) [8idiuser@bcda-rhel8:~]$ cd bluesky
(bluesky_2023_1) [8idiuser@bcda-rhel8:bluesky]$ python -c "import pysumreg; print(f'{pysumreg.__version__=}')"
pysumreg.__version__='0.1.dev13+g1178b8a.d20221221'
prjemian commented 1 year ago

That's because ~/bluesky is the root of a git repository. A special case.

prjemian commented 1 year ago

setuptools_scm suggests this test: python -m setuptools_scm

(bluesky_2023_1) [8idiuser@bcda-rhel8:bluesky]$ python -m setuptools_scm
Warning: could not use pyproject.toml, using default configuration.
 Reason: [Errno 2] No such file or directory: '/home/beams10/8IDIUSER/bluesky/pyproject.toml'.
/home/beams10/8IDIUSER/micromamba/envs/bluesky_2023_1/lib/python3.10/site-packages/setuptools_scm/config.py:61: UserWarning: relative_to is expected to be a file, its the directory '.'
assuming the parent directory was passed
  warnings.warn(
0.1.dev13+g1178b8a.d20221221
prjemian commented 1 year ago

Found a way to fix the affected packages (in place in the current environment).

prjemian commented 1 year ago

All affected packages have been revised. Still waiting on the next release of apstools, due by 2023-01-06. Once that is installed at the beam line, this issue may be closed with success.

prjemian commented 1 year ago

Not a problem in today's Queueserver demo:

RunEngine metadata:
================== ===============================
key                value                          
================== ===============================
beamline_id        8idi_XPCS                      
databroker_catalog 8idi_xpcs                      
instrument_name    8-ID-I XPCS                    
login_id           8idiuser@lapis.xray.aps.anl.gov
pid                2297299                        
proposal_id        XPCS Development               
versions           =================== ========   
                   key                 value      
                   =================== ========   
                   apstools            1.6.13     
                   bluesky             1.10.0     
                   bluesky_queueserver 0.0.18     
                   databroker          1.2.5      
                   epics               3.5.0      
                   h5py                3.7.0      
                   matplotlib          3.6.2      
                   numpy               1.23.5     
                   ophyd               1.7.0      
                   pyRestTable         2020.0.6   
                   spec2nexus          2021.2.4   
                   =================== ========   

================== ===============================

[I 2023-03-07 11:51:24,823 bluesky_queueserver.manager.worker] Startup code loading was completed
[I 2023-03-07 11:51:24,823 bluesky_queueserver.manager.worker] Generating lists of allowed plans and devices
[I 2023-03-07 11:51:24,830 bluesky_queueserver.manager.worker] List of allowed plans and devices was successfully generated
[I 2023-03-07 11:51:24,939 bluesky_queueserver.manager.worker] Instantiating and configuring Run Engine ...
[I 2023-03-07 11:51:24,939 bluesky_queueserver.manager.worker] RE Environment is ready