File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -2205,8 +2205,9 @@ def findConda():
22052205 return None
22062206
22072207def 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
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments