BCDA-APS / bluesky_training

Bluesky training, including instrument package
https://bcda-aps.github.io/bluesky_training/
Other
11 stars 0 forks source link

update minimum Python version for new_bluesky_instrument #287

Closed prjemian closed 2 weeks ago

prjemian commented 3 months ago

Ran into an error while running the new bluesky instrument python program:

INFO:__main__:Requested installation to: '/home/beams/S1BMUSER/bluesky'
INFO:__main__:Downloading '
[https://github.com/BCDA-APS/bluesky_training/archive/refs/tags/v1.0.2.zip'](https://github.com/BCDA-APS/bluesky_training/archive/refs/tags/v1.0.2.zip%27)
INFO:__main__:Extracting content from '/tmp/bluesky_training-1.0.2.zip'
INFO:__main__:Installing to '/home/beams/S1BMUSER/bluesky'
Traceback (most recent call last):
  File "/APSshare/bin/new_bluesky_instrument.py", line 375, in <module>
    new_instrument_from_template(destination, make_git_repo=args.git_init)
  File "/APSshare/bin/new_bluesky_instrument.py", line 108, in new_instrument_from_template
    revise_content(destination)
  File "/APSshare/bin/new_bluesky_instrument.py", line 290, in revise_content
    for line in read(file):
  File "/APSshare/bin/new_bluesky_instrument.py", line 256, in read
    lines = f.read().splitlines()
  File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 141: ordinal not in range(128)
prjemian commented 3 months ago

The installation command came from the operating system Python, as revealed in this scrap from the error dump above: "/usr/lib64/python3.6. The python version is 3.6, within the stated range of support: https://github.com/BCDA-APS/bluesky_training/blob/a80625d87f1d6eb9b5f80ab25832cdfcca16b9cb/new_bluesky_instrument.py#L38

prjemian commented 3 months ago

Maybe it is time to:

prjemian commented 3 months ago

User was able to complete the installation with this command:

/APSshare/miniconda/x86_64/bin/python /APSshare/bin/new_bluesky_instrument.py ~/bluesky
prjemian commented 3 months ago

That uses Python 3.10 for the installation.

prjemian commented 3 months ago

Here's a test for minimum Python version (from the instrument package in this repo): https://github.com/BCDA-APS/bluesky_training/blob/a80625d87f1d6eb9b5f80ab25832cdfcca16b9cb/bluesky/instrument/framework/check_python.py#L16-L28

prjemian commented 3 months ago

note: Without the ~/bluesky argument, the script defaults to the current working directory. If the chosen installation directory is not blank, the script raises an exception, such as this one:

Traceback (most recent call last):
  File "/APSshare/bin/new_bluesky_instrument.py", line 375, in <module>
    new_instrument_from_template(destination, make_git_repo=args.git_init)
  File "/APSshare/bin/new_bluesky_instrument.py", line 95, in new_instrument_from_template
    raise RuntimeError("Directory is not empty: " + str(destination))
RuntimeError: Directory is not empty: /home/USERACCOUNT

and after a few min I realized of course the home directory is not empty and the original command I tried had the ~/bluesky at the end

prjemian commented 2 months ago

PR #289 rearranges pages and content quite a bit. Work on this issue should follow merge of #289.

prjemian commented 1 month ago

Minimum Python version should be whatever the RHEL9 OS provides. (Any beamlines that we need to support using older python?)

prjemian commented 2 weeks ago
(base) jemian@otz ~ $ /usr/bin/python3 --version
Python 3.9.18
prjemian commented 2 weeks ago

test with python 3.8

conda create -n test "python==3.8"
conda activate test
$ ./new_bluesky_instrument.py -h
Traceback (most recent call last):
  File "./new_bluesky_instrument.py", line 385, in <module>
    validate_python_version()
  File "./new_bluesky_instrument.py", line 378, in validate_python_version
    raise RuntimeError( 
RuntimeError: You have Python 3.8.0 (default, Nov  6 2019, 21:49:08) 
[GCC 7.3.0] from ${CONDA_PREFIX}/envs/test.
This installer requires minimum Python version 3.9.