From 7a04298155637f70dcf1b4414a98280ab56695b7 Mon Sep 17 00:00:00 2001 From: niklases Date: Sat, 19 Oct 2024 18:07:22 +0200 Subject: [PATCH] Update gui_setup.sh: Can install and use Python 3.12.7 locally now --- .gitignore | 3 +++ gui/qt_window.py | 11 +++++++---- gui_setup.bat | 34 ++++++++++++++++++++++++++++++---- gui_setup.sh | 2 +- requirements_dev.txt | 16 ---------------- run_pypef_gui.sh | 2 ++ 6 files changed, 43 insertions(+), 25 deletions(-) delete mode 100644 requirements_dev.txt create mode 100644 run_pypef_gui.sh diff --git a/.gitignore b/.gitignore index eb829a7..b8e0770 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ dist/ *.egg workflow/.ipynb_checkpoints/ .idea/ +Python3127/* +python-3.12.7-amd64.exe +run_pypef_gui.bat # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/gui/qt_window.py b/gui/qt_window.py index a5e2534..3c8c542 100644 --- a/gui/qt_window.py +++ b/gui/qt_window.py @@ -14,11 +14,14 @@ # https://stackoverflow.com/questions/67297494/redirect-console-output-to-pyqt5-gui-in-real-time # sudo apt-get install -y libxcb-cursor-dev pypef_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -with open(os.path.join(pypef_root, 'pypef', '__init__.py')) as fh: - for line in fh: - if line.startswith('__version__'): - version = re.findall(r"[-+]?(?:\d*\.*\d.*\d+)", line)[0] #os.environ["PATH"] += os.pathsep + pypef_root +try: + with open(os.path.join(pypef_root, 'pypef', '__init__.py')) as fh: + for line in fh: + if line.startswith('__version__'): + version = re.findall(r"[-+]?(?:\d*\.*\d.*\d+)", line)[0] +except FileNotFoundError: + version = "Unknown" class MainWindow(QtWidgets.QWidget): diff --git a/gui_setup.bat b/gui_setup.bat index 0a2d1ef..66e61db 100644 --- a/gui_setup.bat +++ b/gui_setup.bat @@ -1,3 +1,23 @@ +@echo off +echo Installing PyPEF... + +set "python_exe=python" + +set /P AREYOUSURE=Install and use local Python version (Y/[N]) (downloads Python installer and installs Python locally in the current working directory)? +if /I "%AREYOUSURE%" NEQ "Y" if /I "%AREYOUSURE%" NEQ "y" goto NO_PYTHON + +echo Installing Python... +powershell -Command "$ProgressPreference = 'SilentlyContinue';Invoke-WebRequest https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe -OutFile python-3.12.7-amd64.exe" + +.\python-3.12.7-amd64.exe /quiet TargetDir="%~dp0Python3127" Include_pip=1 Include_test=0 AssociateFiles=1 PrependPath=0 CompileAll=1 InstallAllUsers=0 + +REM Not removing Python installer EXE as it can be used for easy uninstall/repair +REM del /Q python-3.12.7-amd64.exe + +set "python_exe=.\Python3127\python.exe" + + +:NO_PYTHON ( echo: @@ -13,10 +33,16 @@ echo run_main^(^) ) > run.py -powershell -Command "python -m pip install -U pypef pyside6" +powershell -Command "%python_exe% -m pip install -U pypef pyside6" -echo powershell -Command ^"python gui/qt_window.py^" > run_pypef_gui.bat +echo start /min cmd /c powershell -Command ^"%python_exe% gui/qt_window.py^" > run_pypef_gui.bat -echo Created file run_pypef_gui.bat for future GUI starting. +echo Finished installation... +echo +++ Created file +++ +echo +++ run_pypef_gui.bat +++ +echo +++ for future GUI starting +++ +echo You can close this window now. -.\run_pypef_gui +REM call .\run_pypef_gui.bat +start cmd /c ".\run_pypef_gui.bat" +cmd /k diff --git a/gui_setup.sh b/gui_setup.sh index 16556e0..d651ff1 100644 --- a/gui_setup.sh +++ b/gui_setup.sh @@ -18,4 +18,4 @@ python gui/qt_window.py printf "Created file run_pypef_gui.sh for future GUI starting." chmod a+x ./run_pypef_gui.sh -./run_pypef_gui.sh +./run_pypef_gui.sh && exit diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 5f2246f..0000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,16 +0,0 @@ -numpy -pandas -tqdm -docopt -matplotlib -scipy -adjustText -scikit-learn -scikit-learn-intelex -biopython -schema -https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp312-cp312-win_amd64.whl; sys_platform == 'win32' -https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp312-cp312-manylinux2014_x86_64.whl; sys_platform == "linux" -https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp312-cp312-macosx_10_15_x86_64.whl; sys_platform == "darwin" -ray[default] -tensorflow \ No newline at end of file diff --git a/run_pypef_gui.sh b/run_pypef_gui.sh new file mode 100644 index 0000000..182a585 --- /dev/null +++ b/run_pypef_gui.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python gui/qt_window.py