document and handle the case of a previous distutils installation.

in this case 'make install-python' should not continue but instead
it now aborts and asks the user to do a manual uninstall
This commit is contained in:
Axel Kohlmeyer
2022-02-25 16:10:46 -05:00
parent bb3a5b4057
commit 578a7cc54c
2 changed files with 21 additions and 2 deletions

View File

@ -83,8 +83,10 @@ for wheel in glob.glob('lammps-*.whl'):
txt = subprocess.check_output([sys.executable, '-m', 'pip', 'install', '--force-reinstall', wheel], stderr=subprocess.STDOUT, shell=False)
print(txt.decode('UTF-8'))
continue
except:
pass
except subprocess.CalledProcessError as err:
errmsg = err.output.decode('UTF-8')
if errmsg.find("distutils installed"):
sys.exit(errmsg + "You need to uninstall the LAMMPS python module manually first.\n")
try:
print('Installing wheel into standard site-packages folder failed. Trying user folder now')
txt = subprocess.check_output([sys.executable, '-m', 'pip', 'install', '--user', '--force-reinstall', wheel], stderr=subprocess.STDOUT, shell=False)