Skip to content

Commit 01cc19d

Browse files
committed
update zarr message & remove too-new package
1 parent 9bc9ea8 commit 01cc19d

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

GSASII/GSASIIpath.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,8 +2205,9 @@ def findConda():
22052205
return None
22062206

22072207
def condaTest(requireAPI=False):
2208-
'''Returns True if it appears that Python is being run under Anaconda
2209-
Python with conda present. Tests for conda environment vars and that
2208+
'''Returns True if it appears that Python is being run under
2209+
Anaconda/conda-forge Python with conda present.
2210+
Tests for conda environment vars and that
22102211
the conda package is installed in the current environment.
22112212
22122213
:returns: True, if running under Conda

GSASII/imports/G2pwd_MIDAS.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,21 @@ def ContentsValidator(self, filename):
6666
self.errors = f'Exception from zarr module (version={zarr.__version__}):'
6767
self.errors += '\n\t' + str(msg)
6868
if os.path.exists(filename) and zarr.__version__.startswith('3.0'):
69-
self.errors +='\n\n*** this is likely due to a buggy version of the zarr module'
70-
self.errors +='\n*** please use "conda install zarr=2.18" to fix this'
69+
self.errors +='\n\n*** This is likely due to incompatibility between MIDAS and zarr v3.x'
70+
if GSASIIpath.condaTest():
71+
self.errors +='\n*** please use "conda install zarr=2.18" to fix this'
72+
print('preparing to remove incompatible zarr package...')
73+
try:
74+
import conda.cli.python_api
75+
(out, err, rc) = conda.cli.python_api.run_command(
76+
conda.cli.python_api.Commands.REMOVE,'zarr')
77+
self.errors +='\n*** zarr has been removed. Restarting GSAS-II and reinstalling'
78+
self.errors +='\n*** zarr (using the Imports/Show Importer Errors) should fix this.'
79+
except Exception as msg:
80+
print('remove failed\n',msg)
81+
print('...done')
82+
else:
83+
self.errors +='\n*** please use command pip install "zarr=2.18.*" to fix this'
7184
except Exception as msg:
7285
self.errors = f'Exception from zarr module (version={zarr.__version__}):'
7386
self.errors += '\n\t' + str(msg)

0 commit comments

Comments
 (0)