diff --git a/local_install/install_pytentiostat.bat b/local_install/install_pytentiostat.bat new file mode 100644 index 00000000..f6043615 --- /dev/null +++ b/local_install/install_pytentiostat.bat @@ -0,0 +1,32 @@ +@echo off +SET ENV_NAME=pytentiostat_env + +REM Check if conda is installed +where conda >nul 2>nul +IF ERRORLEVEL 1 ( + echo Conda could not be found. Please install Anaconda or Miniconda first. + exit /b 1 +) + +REM Create a new conda environment +echo Creating conda environment "%ENV_NAME%"... +conda create -n %ENV_NAME% python=3.12 -y + +REM Activate the new environment +echo Activating conda environment "%ENV_NAME%"... +call conda activate %ENV_NAME% + +REM Install pytentiostat +echo Installing pytentiostat... +pip install pytentiostat + +REM Confirm installation +pip show pytentiostat >nul 2>nul +IF ERRORLEVEL 1 ( + echo Failed to install pytentiostat. + exit /b 1 +) ELSE ( + echo pytentiostat installed successfully in the "%ENV_NAME%" environment. +) + +echo Setup complete! To activate the environment, run "conda activate %ENV_NAME%". diff --git a/local_install/install_pytentiostat.py b/local_install/install_pytentiostat.py new file mode 100644 index 00000000..2c349448 --- /dev/null +++ b/local_install/install_pytentiostat.py @@ -0,0 +1,44 @@ +import subprocess +import sys + + +def create_conda_env(env_name): + """Create a new conda environment.""" + try: + subprocess.check_call( + [ + sys.executable, + "-m", + "conda", + "create", + "-n", + env_name, + "python=3.12", + "-y", + ] + ) + print(f"Conda environment '{env_name}' created successfully.") + except subprocess.CalledProcessError as e: + print(f"Error creating conda environment: {e}") + sys.exit(1) + + +def install_pytentiostat(env_name): + """Install pytentiostat in the specified conda environment.""" + try: + subprocess.check_call(["conda", "activate", env_name]) + subprocess.check_call(["pip", "install", "pytentiostat"]) + print("pytentiostat installed successfully.") + except subprocess.CalledProcessError as e: + print(f"Error installing pytentiostat: {e}") + sys.exit(1) + + +def main(): + env_name = "pytentiostat_env" + create_conda_env(env_name) + install_pytentiostat(env_name) + + +if __name__ == "__main__": + main() diff --git a/local_install/install_pytentiostat.sh b/local_install/install_pytentiostat.sh new file mode 100644 index 00000000..88ae461e --- /dev/null +++ b/local_install/install_pytentiostat.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Pytentiostat installer for Macbooks +ENV_NAME="pytentiostat_env" + +# Check if conda is installed +if ! command -v conda &> /dev/null +then + echo "Conda could not be found. Please install Anaconda or Miniconda first." + exit 1 +fi + +# Create a new conda environment +echo "Creating conda environment '$ENV_NAME'..." +conda create -n $ENV_NAME python=3.12 -y + +# Activate the new environment +echo "Activating conda environment '$ENV_NAME'..." +source activate $ENV_NAME + +# Install pytentiostat +echo "Installing pytentiostat..." +pip install pytentiostat + +# Confirm installation +if pip show pytentiostat &> /dev/null; then + echo "pytentiostat installed successfully in the '$ENV_NAME' environment." +else + echo "Failed to install pytentiostat." + exit 1 +fi + +echo "Setup complete! To activate the environment, run 'conda activate $ENV_NAME'." diff --git a/news/install_pytentiostat.rst b/news/install_pytentiostat.rst new file mode 100644 index 00000000..3b4d06b6 --- /dev/null +++ b/news/install_pytentiostat.rst @@ -0,0 +1,23 @@ +**Added:** + +* Added automatic environment conda creator and pytentiostat installer for windows and macbook users + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +*