Merge pull request #20 from joelmathewthomas/refactor/venv

refactor/venv
This commit is contained in:
Joel Mathew Thomas
2025-01-26 16:46:52 +05:30
committed by GitHub
6 changed files with 222 additions and 60 deletions
+4
View File
@@ -6,6 +6,7 @@ __pycache__/
# Ignore virtual environment folder
venv/
envs/
# Ignore other common files
*.pyc
@@ -14,3 +15,6 @@ venv/
# Ignore VSCode config
.vscode/
# site-packages.pth
site-packages.pth
+16 -60
View File
@@ -1,63 +1,43 @@
absl-py==2.1.0
amqp==5.3.1
antlr4-python3-runtime==4.9.3
asgiref==3.8.1
asttokens==3.0.0
astunparse==1.6.3
audioread==3.0.1
billiard==4.2.1
celery==5.4.0
certifi==2024.12.14
cffi==1.17.1
charset-normalizer==3.4.0
charset-normalizer==3.4.1
click==8.1.8
click-didyoumean==0.3.1
click-plugins==1.1.1
click-repl==0.3.0
cloudpickle==3.1.0
cloudpickle==3.1.1
contourpy==1.3.1
cycler==0.12.1
decorator==5.1.1
demucs==4.0.1
Django==5.1.4
dora_search==0.1.12
einops==0.8.0
executing==2.1.0
filelock==3.16.1
flatbuffers==24.12.23
fonttools==4.55.3
filelock==3.17.0
fonttools==4.55.6
fsspec==2024.12.0
gast==0.6.0
google-pasta==0.2.0
grpcio==1.68.1
h5py==3.12.1
idna==3.10
iniconfig==2.0.0
jedi==0.19.2
Jinja2==3.1.5
joblib==1.4.2
julius==0.2.7
keras==3.7.0
kiwisolver==1.4.8
kombu==5.4.2
lameenc==1.7.0
lameenc==1.8.1
lazy_loader==0.4
libclang==18.1.1
librosa==0.10.2.post1
llvmlite==0.43.0
Markdown==3.7
markdown-it-py==3.0.0
llvmlite==0.44.0
MarkupSafe==3.0.2
matplotlib==3.10.0
matplotlib-inline==0.1.7
mdurl==0.1.2
ml-dtypes==0.4.1
mpmath==1.3.0
msgpack==1.1.0
namex==0.0.8
networkx==3.4.2
numba==0.60.0
numpy==2.0.2
numba==0.61.0
numpy==2.1.3
nvidia-cublas-cu12==12.4.5.8
nvidia-cuda-cupti-cu12==12.4.127
nvidia-cuda-nvrtc-cu12==12.4.127
@@ -72,60 +52,36 @@ nvidia-nvjitlink-cu12==12.4.127
nvidia-nvtx-cu12==12.4.127
omegaconf==2.3.0
openunmix==1.3.0
opt_einsum==3.4.0
optree==0.13.1
packaging==24.2
parso==0.8.4
pexpect==4.9.0
pillow==11.0.0
pillow==11.1.0
platformdirs==4.3.6
pluggy==1.5.0
pooch==1.8.2
prompt_toolkit==3.0.48
protobuf==5.29.2
ptyprocess==0.7.0
pure_eval==0.2.3
prompt_toolkit==3.0.50
pycparser==2.22
Pygments==2.18.0
pyparsing==3.2.0
PyQt6==6.8.0
PyQt6-Qt6==6.8.1
PyQt6_sip==13.9.1
pyparsing==3.2.1
pytest==8.3.4
python-dateutil==2.9.0.post0
PyYAML==6.0.2
redis==5.2.1
requests==2.32.3
retrying==1.3.4
rich==13.9.4
scikit-learn==1.6.0
scipy==1.14.1
setuptools==75.6.0
scikit-learn==1.6.1
scipy==1.15.1
setuptools==75.8.0
six==1.17.0
soundfile==0.12.1
soundfile==0.13.1
soxr==0.5.0.post1
sqlparse==0.5.3
stack-data==0.6.3
submitit==1.5.2
sympy==1.13.1
tensorboard==2.18.0
tensorboard-data-server==0.7.2
tensorflow==2.18.0
tensorflow-hub==0.16.1
termcolor==2.5.0
tf_keras==2.18.0
threadpoolctl==3.5.0
torch==2.5.1
torchaudio==2.5.1
tqdm==4.67.1
traitlets==5.14.3
treetable==0.2.5
triton==3.1.0
typing_extensions==4.12.2
tzdata==2024.2
tzdata==2025.1
urllib3==2.3.0
vine==5.1.0
wcwidth==0.2.13
Werkzeug==3.1.3
wheel==0.45.1
wrapt==1.17.0
+51
View File
@@ -0,0 +1,51 @@
absl-py==2.1.0
astunparse==1.6.3
certifi==2024.12.14
charset-normalizer==3.4.1
flatbuffers==25.1.24
gast==0.6.0
google-pasta==0.2.0
grpcio==1.70.0
h5py==3.12.1
idna==3.10
keras==3.8.0
libclang==18.1.1
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
ml-dtypes==0.4.1
namex==0.0.8
numpy==2.0.2
nvidia-cublas-cu12==12.5.3.2
nvidia-cuda-cupti-cu12==12.5.82
nvidia-cuda-nvcc-cu12==12.5.82
nvidia-cuda-nvrtc-cu12==12.5.82
nvidia-cuda-runtime-cu12==12.5.82
nvidia-cudnn-cu12==9.3.0.75
nvidia-cufft-cu12==11.2.3.61
nvidia-curand-cu12==10.3.6.82
nvidia-cusolver-cu12==11.6.3.83
nvidia-cusparse-cu12==12.5.1.3
nvidia-nccl-cu12==2.21.5
nvidia-nvjitlink-cu12==12.5.82
opt_einsum==3.4.0
optree==0.14.0
packaging==24.2
protobuf==5.29.3
Pygments==2.19.1
requests==2.32.3
rich==13.9.4
setuptools==75.8.0
six==1.17.0
tensorboard==2.18.0
tensorboard-data-server==0.7.2
tensorflow==2.18.0
tensorflow-hub==0.16.1
termcolor==2.5.0
tf_keras==2.18.0
typing_extensions==4.12.2
urllib3==2.3.0
Werkzeug==3.1.3
wheel==0.45.1
wrapt==1.17.2
+46
View File
@@ -0,0 +1,46 @@
#!/bin/bash
# Check if the script is running in the root directory of the project
PROJECT_ROOT="freq-split-enhance"
CURRENT_DIR=$(basename "$PWD")
if [ "$CURRENT_DIR" != "$PROJECT_ROOT" ]; then
echo "This script must be run in the root directory of the project: '$PROJECT_ROOT'."
exit 1
fi
# Check if the envs/ directory exists
if [ ! -d "envs" ]; then
echo "Directory 'envs/' does not exist. Please make sure it exists and contains the required environments. Please run the scripts/setup_env.sh script."
exit 1
fi
# Check if the requirements/ directory exists, create it if not
if [ ! -d "requirements" ]; then
echo "Directory 'requirements/' does not exist. Creating it..."
mkdir requirements
fi
# Function to freeze the dependencies of an environment
freeze_env_deps() {
local env_dir=$1
local requirements_file=$2
echo "Freezing dependencies for environment '$env_dir'..."
source "$env_dir/bin/activate" # Activate the environment
pip freeze > "$requirements_file" # Freeze the dependencies
deactivate # Deactivate the environment
echo "Dependencies for '$env_dir' saved to '$requirements_file'."
}
# Loop through all the environments inside envs/
for env_dir in envs/*; do
if [ -d "$env_dir" ]; then
env_name=$(basename "$env_dir")
requirements_file="requirements/$env_name.txt"
freeze_env_deps "$env_dir" "$requirements_file"
fi
done
echo "Dependencies for all environments have been successfully frozen."
+69
View File
@@ -0,0 +1,69 @@
#!/bin/bash
# Check if the script is running in the root directory of the project
PROJECT_ROOT="freq-split-enhance"
CURRENT_DIR=$(basename "$PWD")
if [ "$CURRENT_DIR" != "$PROJECT_ROOT" ]; then
echo "This script must be run in the root directory of the project: '$PROJECT_ROOT'."
exit 1
fi
# Check if the envs/ directory exists
if [ ! -d "envs" ]; then
echo "Directory 'envs/' does not exist. Please make sure it exists and contains the required environments. Please run the scripts/setup_env.sh script."
exit 1
fi
# List all environments in the envs/ directory
echo "Available environments:"
env_count=0
envs_list=()
for env_dir in envs/*; do
if [ -d "$env_dir" ]; then
env_name=$(basename "$env_dir")
envs_list+=("$env_name")
echo "$((env_count + 1)). $env_name"
((env_count++))
fi
done
# Check if any environments exist
if [ "$env_count" -eq 0 ]; then
echo "No environments found in 'envs/'. Please create them first."
exit 1
fi
# Ask the user to select an environment
read -p "Select an environment (1-$env_count): " env_choice
# Validate the user's choice
if [[ ! "$env_choice" =~ ^[0-9]+$ ]] || [ "$env_choice" -lt 1 ] || [ "$env_choice" -gt "$env_count" ]; then
echo "Invalid choice. Please select a number between 1 and $env_count."
exit 1
fi
# Get the selected environment name
selected_env="${envs_list[$((env_choice - 1))]}"
# Ask the user for the module they want to install
read -p "Enter the module you want to install in the '$selected_env' environment: " module_name
# Function to install a module in the selected environment
install_module() {
local env_dir=$1
local module=$2
echo "Activating environment '$env_dir' and installing module '$module'..."
source "$env_dir/bin/activate" # Activate the environment
pip install "$module" # Install the module
deactivate # Deactivate the environment
echo "Module '$module' installed successfully in '$env_dir'."
}
# Install the module in the selected environment
install_module "envs/$selected_env" "$module_name"
echo "Module installation complete."
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
# Check if the script is running in the root directory of the project
PROJECT_ROOT="freq-split-enhance"
CURRENT_DIR=$(basename "$PWD")
if [ "$CURRENT_DIR" != "$PROJECT_ROOT" ]; then
echo "This script must be run in the root directory of the project: '$PROJECT_ROOT'."
exit 1
fi
echo "Setting up virtual environments"
mkdir envs
#Create common env
echo "Creating common virtual environment env"
python -m venv envs/env
#Create env for tensorflow
echo "Creating virtual environment env_tensorflow"
python -m venv envs/env_tensorflow
source envs/env/bin/activate
echo "Installing dependencies in virtual environment env"
pip install -r requirements/env.txt
deactivate
source envs/env_tensorflow/bin/activate
pip install -r requirements/env_tensorflow.txt
deactivate
echo "Creating site-packages.pth"
touch site-packages.pth
echo "env/env/lib/python3.12/site-packages" >> site-packages.pth
echo "env/env_tensorflow/lib/python3.12/site-packages" >> site-packages.pth