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 @@ -1429,8 +1429,9 @@ def findConda():
14291429 return None
14301430
14311431def condaTest (requireAPI = False ):
1432- '''Returns True if it appears that Python is being run under Anaconda
1433- Python with conda present. Tests for conda environment vars and that
1432+ '''Returns True if it appears that Python is being run under
1433+ Anaconda/conda-forge Python with conda present.
1434+ Tests for conda environment vars and that
14341435 the conda package is installed in the current environment.
14351436
14361437 :returns: True, if running under Conda
Original file line number Diff line number Diff line change @@ -64,8 +64,21 @@ def ContentsValidator(self, filename):
6464 self .errors = f'Exception from zarr module (version={ zarr .__version__ } ):'
6565 self .errors += '\n \t ' + str (msg )
6666 if os .path .exists (filename ) and zarr .__version__ .startswith ('3.0' ):
67- self .errors += '\n \n *** this is likely due to a buggy version of the zarr module'
68- self .errors += '\n *** please use "conda install zarr=2.18" to fix this'
67+ self .errors += '\n \n *** This is likely due to incompatibility between MIDAS and zarr v3.x'
68+ if GSASIIpath .condaTest ():
69+ self .errors += '\n *** please use "conda install zarr=2.18" to fix this'
70+ print ('preparing to remove incompatible zarr package...' )
71+ try :
72+ import conda .cli .python_api
73+ (out , err , rc ) = conda .cli .python_api .run_command (
74+ conda .cli .python_api .Commands .REMOVE ,'zarr' )
75+ self .errors += '\n *** zarr has been removed. Restarting GSAS-II and reinstalling'
76+ self .errors += '\n *** zarr (using the Imports/Show Importer Errors) should fix this.'
77+ except Exception as msg :
78+ print ('remove failed\n ' ,msg )
79+ print ('...done' )
80+ else :
81+ self .errors += '\n *** please use command pip install "zarr=2.18.*" to fix this'
6982 except Exception as msg :
7083 self .errors = f'Exception from zarr module (version={ zarr .__version__ } ):'
7184 self .errors += '\n \t ' + str (msg )
You can’t perform that action at this time.
0 commit comments