Changeset 5442


Ignore:
Timestamp:
Dec 20, 2022 3:17:16 PM (3 months ago)
Author:
toby
Message:

finish off Py3.10 updates

Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r5394 r5442  
    54585458        '''Check if the GSAS-II repository has an update for the current source files
    54595459        and perform that update if requested.
    5460         '''           
     5460        '''
    54615461        if not GSASIIpath.whichsvn():
    54625462            dlg = wx.MessageDialog(self.frame,
     
    54945494            dlg.Destroy()
    54955495            return
     5496        errmsg,warnmsg = G2gd.TestOldVersions()
     5497        if (errmsg or warnmsg):
     5498            msg = 'Based on the age of Python or an installed Python package (see below)'
     5499            msg += ' you are recommended to'
     5500            if GSASIIpath.condaTest():
     5501                msg += ' either use conda to update (see https://bit.ly/G2pkgs for version recommendations) and then update GSAS-II. Or'
     5502            msg += ' reinstall GSAS-II (see https://bit.ly/G2install), which will update both.\n\n'
     5503            if errmsg:
     5504                opt = wx.YES_NO|wx.ICON_QUESTION|wx.CANCEL|wx.NO_DEFAULT
     5505                msg += 'Error(s):\n\t'+errmsg
     5506            else:
     5507                opt = wx.YES_NO|wx.ICON_QUESTION|wx.CANCEL|wx.YES_DEFAULT
     5508            if warnmsg:
     5509                if errmsg: msg += '\n\nWarning(s):\n\t'
     5510                msg += warnmsg
     5511
     5512            msg += '\n\nContinue to update GSAS-II?'
     5513            dlg = wx.MessageDialog(self.frame, msg,'Confirm update',opt)
     5514            result = wx.ID_NO
     5515            try:
     5516                result = dlg.ShowModal()
     5517            finally:
     5518                dlg.Destroy()
     5519            if result != wx.ID_YES: return
    54965520        print ('GSAS-II version on server: '+repos)
    54975521        if local == repos:
     
    55365560                                   'conflicts arise, local changes will be '
    55375561                                   'discarded. It is also possible that the '
    5538                                    'local changes may prevent GSAS-II from running. '
     5562                                   'merge may prevent GSAS-II from running. '
    55395563                                   '\n\nPress OK to start an update if this is acceptable:',
    55405564                                   'Local GSAS-II Mods',
     
    56035627                                   'if merging is not possible, your local changes will be '
    56045628                                   'discarded. It is also possible that the '
    5605                                    'local changes my prevent GSAS-II from running. '
     5629                                   'merge may prevent GSAS-II from running. '
    56065630                                   'Press OK to continue anyway.',
    56075631                                   'Local GSAS-II Mods',
  • trunk/GSASIIdataGUI.py

    r5433 r5442  
    390390  versions that are known to have bugs. One should select an older or
    391391  newer version of the package.
     392* ``versionDict['tooNewUntested']`` is a dict with module versions that have
     393  not been tested but there is no reason to expect problems
    392394* ``versionDict['tooNewWarn']`` is a dict with module versions that have not
    393   been tested but raise concerns that problems may occur.
     395  been tested but there are concerns that problems may occur.
    394396
    395397**Packages/versions to be avoided**
     
    427429'''
    428430# add comments above when changing anything below
    429 versionDict['tooOld'] = {'matplotlib': '1.'}
     431versionDict['tooOld'] = {'matplotlib': '1.', 'Python':'2.7'}
    430432'modules that will certainly fail'
    431 versionDict['tooOldWarn'] = {'wx': '2.'}
    432 'modules that may fail but should be updated'
     433versionDict['tooOldWarn'] = {'wx': '2.','Python':'3.6'}
     434'modules that may fail and should be updated'
    433435versionDict['badVersionWarn'] = {'numpy':['1.16.0'],
    434                                  'matplotlib': ['3.1','3.2']}
     436                                 'matplotlib': ['3.1','3.2'],
     437                                 'wx':['4.2.0']}
    435438'versions of modules that are known to have bugs'
    436 versionDict['tooNewWarn'] = {'wx':'4.2','python':'3.10'}
     439versionDict['tooNewWarn'] = {'wx':'4.2'}
    437440'module versions newer than what we have tested & where problems are suspected'
     441versionDict['tooNewUntested'] = {'Python':'3.11'}
     442'module versions newer than what we have tested & no problems are suspected'
    438443
    439444def ShowVersions():
     
    446451    import OpenGL as ogl
    447452    import GSASIIpath
    448     # print (versions)
    449     print ("Python module versions loaded:")
    450     print ("  Python:     {} from {}".format(sys.version.split()[0],sys.executable))
    451     if compareVersions(platform.python_version(),
    452                         versionDict['tooNewWarn']['python']) >= 0:
    453         print (22*' '+"-- We are anticipating significant problems with this new version of Python. Please report them.")
     453    print ("Python/module versions loaded:")
    454454    version = '?'
    455455    versionDict['errors'] = ''
    456456    warn = False
    457     for s,m in [('wx',wx), ('matplotlib', mpl), ('numpy',np),
     457    for s,m in [('Python',None), ('wx',wx), ('matplotlib', mpl), ('numpy',np),
    458458                    ('scipy',sp), ('OpenGL',ogl)]:
    459459        msg = ''
     460        if s == 'Python':
     461            pkgver = platform.python_version()
     462            prefix = ''
     463            msg = "from {}. ".format(sys.executable)
     464        else:
     465            pkgver = m.__version__
     466            prefix = 'Package '
    460467        if s in versionDict['tooOld']:
    461             match = compareVersions(m.__version__,versionDict['tooOld'][s])
     468            match = compareVersions(pkgver,versionDict['tooOld'][s])
    462469            if match <= 0:
    463                 msg = "version will cause problems"
     470                if msg: msg += ' -- '
     471                msg += "Too old, problems are likely"
    464472                warn = True
    465473                if versionDict['errors']: versionDict['errors'] += '\n'
    466                 versionDict['errors'] += 'Package {} version {} is too old for GSAS-II. An update is required'.format(s,m.__version__)
     474                versionDict['errors'] += prefix + '{} version {} is too old for GSAS-II. An update is required. '.format(s,pkgver)
    467475        if s in versionDict['tooOldWarn']:
    468             match = compareVersions(m.__version__,versionDict['tooOldWarn'][s])
     476            match = compareVersions(pkgver,versionDict['tooOldWarn'][s])
    469477            if match <= 0:
    470                 msg = "version can cause problems"
    471                 warn = True
    472         if s in versionDict['tooNewWarn']:
    473             match = compareVersions(m.__version__,versionDict['tooNewWarn'][s])
    474             if match >= 0:
    475                 msg = "version is too new and has not been tested"
     478                msg += "Version can cause problems"
    476479                warn = True
    477480        if s in versionDict['badVersionWarn']:
    478481            for v in versionDict['badVersionWarn'][s]:
    479                 if compareVersions(m.__version__,v) == 0:
    480                     msg = "version is known to be buggy"
     482                if compareVersions(pkgver,v) == 0:
     483                    msg += "Version is known to be buggy"
    481484                    warn = True
    482485                    break
    483         print("  {:12s}{}  {}".format(s+':',m.__version__,msg))
     486        if s in versionDict['tooNewWarn'] and not warn:
     487            match = compareVersions(pkgver,versionDict['tooNewWarn'][s])
     488            if match >= 0:
     489                msg += "Problems are anticipated with this version (not tested)"
     490                warn = True
     491        if s in versionDict['tooNewUntested'] and not warn:
     492            match = compareVersions(pkgver,versionDict['tooNewUntested'][s])
     493            if match >= 0:
     494                msg += "New version not tested; please keep us posted"
     495                warn = True
     496        print("  {:12s}{}  {}".format(s+':',pkgver,msg))
     497
    484498    Image = None
    485499    try:
     
    513527    else:
    514528        rev = "SVN version {}".format(rev)
    515     print ("Latest GSAS-II revision (from .py files): {} ({})\n".format(
     529    print ("Latest GSAS-II revision (from .py files): {} ({})".format(
    516530        GSASIIpath.GetVersionNumber(),rev))
    517531    # patch 11/2020: warn if GSASII path has not been updated past v4576.
     
    525539        print('Warning GSAS-II incompletely updated. Please contact toby@anl.gov')
    526540    # end patch
     541    prog = 'convcell'
     542    if sys.platform.startswith('win'): prog += '.exe'
     543    if not os.path.exists(os.path.join(GSASIIpath.binaryPath,prog)):
     544        versionDict['errors'] += 'Installed binary files need an update. If you built them, rerun scons'
     545        warn = True
     546    elif GSASIIpath.GetConfigValue('debug'):
     547        print('N.B. current binaries have been updated')
    527548    if warn:
    528549        print('You are suggested to install a new version of GSAS-II.\nSee https://bit.ly/G2install',
    529550              '\n\nFor information on packages see\nhttps://gsas-ii.readthedocs.io/en/latest/packages.html and',
    530551              '\nhttps://gsas-ii.readthedocs.io/en/latest/GSASIIGUI.html#GSASIIdataGUI.versionDict')
    531 
     552    print()
     553
     554def TestOldVersions():
     555    '''Test the versions of required Python packages, etc.
     556    Returns a non-empty text string if there are problems.
     557    '''
     558    import numpy as np
     559    import scipy as sp
     560    import wx
     561    import matplotlib as mpl
     562    import OpenGL as ogl
     563    warnmsg = ''
     564    errmsg = ''
     565    for s,m in [('Python',None), ('wx',wx), ('matplotlib', mpl), ('numpy',np),
     566                    ('scipy',sp), ('OpenGL',ogl)]:
     567        if s == 'Python':
     568            pkgver = platform.python_version()
     569            prefix = ''
     570        else:
     571            pkgver = m.__version__
     572            prefix = 'Package '+s
     573        if s in versionDict['tooOld']:
     574            match = compareVersions(pkgver,versionDict['tooOld'][s])
     575            if match <= 0:
     576                if errmsg: errmsg += '\n'
     577                errmsg += prefix + '{} version {} is too old to run GSAS-II.'.format(s,pkgver)
     578        if s in versionDict['tooOldWarn']:
     579            match = compareVersions(pkgver,versionDict['tooOldWarn'][s])
     580            if match <= 0:
     581                if warnmsg: warnmsg += '\n'
     582                warnmsg += prefix + '{} version {} is likely too old for GSAS-II.'.format(s,pkgver)
     583        if s in versionDict['badVersionWarn']:
     584            for v in versionDict['badVersionWarn'][s]:
     585                if compareVersions(pkgver,v) == 0:
     586                    if errmsg: errmsg += '\n'
     587                    errmsg += prefix + '{} version {} causes problems with GSAS-II.'.format(s,pkgver)
     588                    break
     589    return errmsg,warnmsg
     590       
    532591#### GUI creation #############################################################
    533592def GSASIImain(application):
  • trunk/docs/source/packages.rst

    r5438 r5442  
    4545* PyOpenGL (http://pyopengl.sourceforge.net/documentation). Note: a copy of this is distributed with GSAS-II (at present) and will be installed if the Python setuptools package is present.
    4646
    47 Several packages are used in sections of the code, but are not
     47Several Python packages are used in sections of the code, but are not
    4848required. If these packages are not present, warning messages may be
    4949generated if they would be needed, but the vast bulk of GSAS-II will function normally.
     
    5757  warning message appears on GSAS-II startup.
    5858* imageio is used to make movies.
    59 * svn: When using Anaconda we also encourage installation of the
    60   svn (subversion) conda package. This is not actually part of Python
    61   and can be installed directly into your system's configuration. It is used by
    62   GSAS-II to download updates to our code. This can be skipped if svn
    63   is installed directly (easy Linux, but a bit harder on MacOS and
    64   Windows). In conda-forge this package is called subversion, but at
    65   present is only available for Linux.
    66 * pywin32 (windows only): this provides the win32com module that is
     59* requests: this package simplifies http access
     60  (https://requests.readthedocs.io/). It is used for access to
     61  webpages such as ISODISTORT and for some internal software downloads.
     62* win32com (windows only): this module is
    6763  used to install GSAS-II on windows machines. GSAS-II can be used on
    6864  Windows without this, but the installation will offer less
    69   integration into Windows.
     65  integration into Windows. Conda provides this under the name pywin32.
    7066* conda: the conda package allows access to conda features from
    71   inside Python. It will be used inceasingly by GSAS-II to
     67  inside Python. It will be used increasingly by GSAS-II to
    7268  self-install software. The conda package is installed by default in
    7369  miniconda and anaconda but if you create an environment for GSAS-II
    7470  (`conda create -n <env> package-list...`), it will not be added
    7571  unless you request it specifically. 
    76 * requests: this package simplifies http access
    77   (https://requests.readthedocs.io/). It is used for access to
    78   webpages such as ISODISTORT and for some internal software downloads.
     72
     73The following are conda package is used in GSAS-II but is not
     74actually a Python package.
     75 
     76* svn (or subversion): the GSAS-II code works much better when
     77  subversion is available to install and update the GSAS-II
     78  code. Technically it is optional, but is not easy to bypass. The
     79  Anaconda distribution once provided this, but does this no longer. With
     80  the conda-forge repository we now use, it is only available for
     81  Linux (where it really is not needed since it is easy to install
     82  there) and the package is called subversion. For MacOS and Windows, the GSAS-II
     83  self-installer now provides binaries for the svn program.
    7984 
    8085*Conda command*:
Note: See TracChangeset for help on using the changeset viewer.