Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions local_install/install_pytentiostat.bat
Original file line number Diff line number Diff line change
@@ -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%".
44 changes: 44 additions & 0 deletions local_install/install_pytentiostat.py
Original file line number Diff line number Diff line change
@@ -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()
33 changes: 33 additions & 0 deletions local_install/install_pytentiostat.sh
Original file line number Diff line number Diff line change
@@ -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'."
23 changes: 23 additions & 0 deletions news/install_pytentiostat.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Added automatic environment conda creator and pytentiostat installer for windows and macbook users

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>