Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c727f92
fix style
anssakthi Mar 14, 2024
157a87c
Update ci_cd.yml
anssakthi Mar 14, 2024
a2636c8
fix style
anssakthi Mar 15, 2024
e8a9691
Merge branch 'feature/remove-python-installations' of https://github.…
anssakthi Mar 15, 2024
0247c26
adding warning/note for pre-compiled python version on linux
tusharbana-ansys Mar 15, 2024
e872bc0
minor
tusharbana-ansys Mar 15, 2024
9c8d7ae
Merge remote-tracking branch 'origin/main' into feature/remove-python…
anssakthi Mar 15, 2024
9b04cb8
fix style
anssakthi Mar 15, 2024
6fdc0fe
centos & fedora specific changes
tusharbana-ansys Mar 19, 2024
3763adb
fix style
anssakthi Mar 20, 2024
c95f96a
Merge branch 'main' into feature/remove-python-installations
anssakthi Mar 20, 2024
ad6fdfe
fix style
anssakthi Mar 20, 2024
8fc406c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 20, 2024
f0663ae
Update ci_cd.yml
anssakthi Mar 20, 2024
1e0989b
fix style
anssakthi Mar 20, 2024
3550842
Merge branch 'feature/remove-python-installations' of https://github.…
anssakthi Mar 20, 2024
8b06509
fix style
anssakthi Mar 21, 2024
a355f70
centos/fedora uninstaller script fix
tusharbana-ansys Mar 21, 2024
3156b72
fix style
tusharbana-ansys Mar 21, 2024
85f4a84
fix style
tusharbana-ansys Mar 21, 2024
70f7426
Update src/ansys/tools/installer/installed_table.py
RobPasMue Mar 27, 2024
4b8eb06
Update src/ansys/tools/installer/main.py
RobPasMue Mar 27, 2024
5d148df
Merge branch 'main' into feature/remove-python-installations
RobPasMue Mar 27, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ cython_debug/
#.idea/

# End of https://www.toptal.com/developers/gitignore/api/python
.vscode/settings.json
45 changes: 30 additions & 15 deletions doc/source/installer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ Installing the ``Ansys Python Manager``
#. **OS** supported for **Ubuntu(20.04 and 22.04)**.

#. Update ``apt-get`` repository and install the following packages with **sudo** privileges:
**libffi-dev, libssl-dev, libsqlite3-dev, libxcb-xinerama0 and build-essential** packages with **sudo** privileges
**wget, gnome, libffi-dev, libssl-dev, libsqlite3-dev, libxcb-xinerama0 and build-essential** packages with **sudo** privileges

.. code:: shell

sudo apt-get update -y
sudo apt-get install libffi-dev libssl-dev libsqlite3-dev libxcb-xinerama0 build-essential -y
sudo apt-get install wget gnome libffi-dev libssl-dev libsqlite3-dev libxcb-xinerama0 build-essential -y

#. Install **zlib** package

Expand Down Expand Up @@ -71,12 +71,17 @@ Installing the ``Ansys Python Manager``

#. In the pop up window:

* If you want to remove all the virtual environments as part of
uninstallation, mark ``Delete virtual environment`` checkbox
* If you want to remove all virtual environments which were created by
the Ansys Python Manager as part of uninstallation, mark
``Delete virtual environments`` checkbox

* If you want to remove all the configurations as part of
* If you want to remove all configurations as part of
uninstallation, mark ``Delete configurations`` checkbox

* If you want to remove all Python installations which were installed by
the Ansys Python Manager as part of uninstallation, mark
``Delete Python installations`` checkbox

#. Click ``Uninstall`` button.


Expand All @@ -87,13 +92,13 @@ Installing the ``Ansys Python Manager``
#. **OS** supported for **CentOS9** and **RHEL9**.

#. Update ``yum`` repository and install the following packages with **sudo** privileges:
**Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel**
**wget, gnome-terminal, Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel, coreutils**

.. code:: shell

sudo yum update -y;
sudo yum groupinstall 'Development Tools' -y;
sudo yum install libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel -y;
sudo yum install wget gnome-terminal libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel coreutils -y;

#. Install **zlib** package using **wget**

Expand Down Expand Up @@ -130,12 +135,17 @@ Installing the ``Ansys Python Manager``

#. In the pop up window:

* If you want to remove all the virtual environments as part of
uninstallation, mark ``Delete virtual environment`` checkbox
* If you want to remove all virtual environments which were created by
the Ansys Python Manager as part of uninstallation, mark
``Delete virtual environments`` checkbox

* If you want to remove all the configurations as part of
* If you want to remove all configurations as part of
uninstallation, mark ``Delete configurations`` checkbox

* If you want to remove all Python installations which were installed by
the Ansys Python Manager as part of uninstallation, mark
``Delete Python installations`` checkbox

#. Click ``Uninstall`` button.

#. Follow the uninstaller script & provide sudo permission to uninstall the application.
Expand All @@ -147,13 +157,13 @@ Installing the ``Ansys Python Manager``
#. **OS** supported for **Fedora39**.

#. Update ``yum`` repository and install the following packages with **sudo** privileges:
**Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel**
**wget, gnome-terminal, Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel, coreutils**

.. code:: shell

sudo yum update -y;
sudo yum groupinstall 'Development Tools' -y;
sudo yum install libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel -y;
sudo yum install wget gnome-terminal libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel coreutils -y;

#. Install **zlib** package using **wget**

Expand Down Expand Up @@ -190,12 +200,17 @@ Installing the ``Ansys Python Manager``

#. In the pop up window:

* If you want to remove all the virtual environments as part of
uninstallation, mark ``Delete virtual environment`` checkbox
* If you want to remove all virtual environments which were created by
the Ansys Python Manager as part of uninstallation, mark
``Delete virtual environments`` checkbox

* If you want to remove all the configurations as part of
* If you want to remove all configurations as part of
uninstallation, mark ``Delete configurations`` checkbox

* If you want to remove all Python installations which were installed by
the Ansys Python Manager as part of uninstallation, mark
``Delete Python installations`` checkbox

#. Click ``Uninstall`` button.

#. Follow the uninstaller script & provide sudo permission to uninstall the application.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ have options available, such as deleting a virtual environment, Launch
Options, General Package Management, and PyAnsys Package Management for
the selected virtual environment. You can also delete a virtual
environment by selecting it from the available list under “Available
virtual environments” and clicking on the “Delete virtual environment
virtual environments” and clicking on the “Delete virtual environments
option available with context menu.

.. image:: _static/manage_venv_tab.PNG
Expand Down
20 changes: 16 additions & 4 deletions linux/debian/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ else
dependencies_available=false
fi
# check other dependencies
arr=("libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0")
arr=("wget" "gnome" "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0")
for x in "${arr[@]}"; do
c="dpkg -s $x >/dev/null 2>&1"
eval $c
Expand All @@ -28,7 +28,13 @@ done
if [ $dependencies_available = true ]; then
dpkg -x ./ansys_python_manager.deb ${HOME}/.local
./postInstallScript.sh
printf "\nInstallation success...\n"
available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l)
echo $available
if [ $available -lt 1 ]
then
echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" >> ~/.bashrc
fi
printf "\nInstallation successful. \nIt is suggested to restart your machine to begin using the software....\n"
else
echo "Missing dependencies..."
while true; do
Expand Down Expand Up @@ -69,7 +75,7 @@ else
dependencies_available=false
fi
# check other dependencies
arr=("libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0")
arr=("wget" "gnome" "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0")
for x in "${arr[@]}"; do
c="dpkg -s $x >/dev/null 2>&1"
eval $c
Expand All @@ -86,7 +92,13 @@ else
else
dpkg -x ./ansys_python_manager.deb ${HOME}/.local
./postInstallScript.sh
printf "\nInstallation success...\n"
available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l)
echo $available
if [ $available -lt 1 ]
then
echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" >> ~/.bashrc
fi
printf "\nInstallation successful. \nIt is suggested to restart your machine to begin using the software....\n"
fi
else
echo "You don't have access to sudo. Please try again..."
Expand Down
10 changes: 8 additions & 2 deletions linux/non-debian/installer_CentOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [ "$user_selection" = "Y" ]; then
missing_deps+=("Development Tools")
dependencies_available=false
fi
arr=("wget" "libffi-devel" "openssl-devel" "rpm-build" "sqlite-devel" "sqlite-libs" "libXinerama-devel")
arr=("wget" "gnome-terminal" "libffi-devel" "openssl-devel" "rpm-build" "sqlite-devel" "sqlite-libs" "libXinerama-devel" "coreutils")
for x in "${arr[@]}"; do
c="rpm -qa | grep $x"
eval $c
Expand All @@ -48,7 +48,13 @@ if [ "$user_selection" = "Y" ]; then
done
if [ $dependencies_available = true ]; then
sudo rpm -iv ansys_python_manager_*.rpm
printf "\nInstallation success...\n"
available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l)
echo $available
if [ $available -lt 1 ]
then
echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | sudo tee -a ~/.bashrc
fi
printf "\nInstallation success...\nIt is suggested to restart your machine to begin using the software....\n"
else
echo "Missing dependencies..."
install_script="sudo yum update -y; sudo yum install "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ rm -rf ${HOME}/.local/share/applications/ansys_python_manager.desktop
rm -rf ${HOME}/.local/usr/share/doc/ansys-python-manager

rm -rf ${HOME}/.local/opt/ansys_python_manager

sed -i '/# Add alias for Ansys Python Manager/d' ~/.bashrc
sed -i '/alias ansys_python_manager/d' ~/.bashrc
6 changes: 4 additions & 2 deletions src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
while true; do
read -p "Require sudo permission to uninstall this package and the dependencies. Do you want to continue?(Y/N): " user_selection
read -p "Require sudo permission to uninstall this package. Do you want to continue?(Y/N): " user_selection
if [ "$user_selection" = "Y" ] || [ "$user_selection" = "N" ]; then
break
fi
Expand All @@ -14,12 +14,14 @@ if [ "$user_selection" = "Y" ]; then
echo "Uninstalling Ansys Python Manager......."
sleep 2
sudo yum remove -y ansys_python_manager.x86_64
sudo sed -i '/# Add alias for Ansys Python Manager/d' ~/.bashrc
sudo sed -i '/alias ansys_python_manager/d' ~/.bashrc
printf "\nUninstalled successfully...\n"
else
echo "You don't have access to sudo. Please try again..."
fi
else
# Script aborted by user
printf "Aborting....\nUser permission denied.... \n\n"
echo "Ansys Python Manager and required dependencies require sudo access to uninstall."
echo "Ansys Python Manager package requires sudo access to uninstall."
fi
3 changes: 3 additions & 0 deletions src/ansys/tools/installer/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@

While choosing the latest version of Python is generally recommended, some third-party libraries and applications may not yet be fully compatible with the newest release. Therefore, it is recommended to try the second newest version, as it will still have most of the latest features and improvements while also having broader support among third-party packages."""

PRE_COMPILED_PYTHON_WARNING = """
<b>NOTE:</b> Only 'Python 3.11' version is readily available. Other Python versions are compiled from source and it takes approximately 2-3 minutes."""

PYTHON_VERSION_SELECTION_FOR_VENV = """Choose the version of Python to use for your virtual environment.

Please select the Python version from the table below to create its respective virtual environment."""
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/tools/installer/find_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from ansys.tools.installer.configure_json import ConfigureJson
from ansys.tools.installer.constants import ANSYS_SUPPORTED_PYTHON_VERSIONS
from ansys.tools.installer.linux_functions import (
find_installed_python_linux,
find_ansys_installed_python_linux,
find_miniforge_linux,
is_linux_os,
)
Expand Down Expand Up @@ -193,7 +193,7 @@ def _find_installed_python_linux():
pythons[path] = (version, admin)
LOG.debug("Identified %s at %s", version, path)
previous_found_version = version
except subprocess.CalledProcessError:
except:
# Ignore if the command fails (e.g., if the Python version is not installed)
pass

Expand Down Expand Up @@ -235,7 +235,7 @@ def find_all_python():
paths.update(_find_installed_ansys_python_win())
else:
paths = _find_installed_python_linux()
paths.update(find_installed_python_linux())
paths.update(find_ansys_installed_python_linux())

return paths

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/tools/installer/installed_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def find_env_type(self, table_name):
return is_vanilla_python, miniforge_path, parent_path

def delete_virtual_environment(self, point):
"""Delete virtual environment using right click."""
"""Delete virtual environments using right click."""
# Get the cell that was right-clicked
index = self.venv_table.indexAt(point)
configure_json = ConfigureJson()
Expand Down
38 changes: 22 additions & 16 deletions src/ansys/tools/installer/linux_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,15 @@ def install_python_linux(filename):
return 0


def find_miniforge_linux():
def find_miniforge_linux(ansys_manager_installed_only=False):
"""
Find miniforge installation on the host machine.

Parameters
----------
ansys_manager_installed_only : bool, optional
If this value is True, then the Python versions installed via Ansys Python Manager will be returned.

Returns
-------
dict
Expand All @@ -161,18 +166,19 @@ def find_miniforge_linux():

"""
paths = {}
try:
subprocess.check_output("printenv | grep CONDA_PYTHON_EXE > /tmp/conda.txt")
with open("/tmp/conda.txt") as f:
conda_system_path = f.read()
conda_system_path = conda_system_path.replace("CONDA_PYTHON_EXE=", "")
conda_system_path = conda_system_path.replace("/bin/python", "").strip()
version = subprocess.check_output([f"conda", "--version"])
version = version.split()[1].decode("utf-8")
paths[conda_system_path] = (version, True)
os.remove("/tmp/conda.txt")
except:
pass
if not ansys_manager_installed_only:
try:
subprocess.check_output("printenv | grep CONDA_PYTHON_EXE > /tmp/conda.txt")
with open("/tmp/conda.txt") as f:
conda_system_path = f.read()
conda_system_path = conda_system_path.replace("CONDA_PYTHON_EXE=", "")
conda_system_path = conda_system_path.replace("/bin/python", "").strip()
version = subprocess.check_output([f"conda", "--version"])
version = version.split()[1].decode("utf-8")
paths[conda_system_path] = (version, True)
os.remove("/tmp/conda.txt")
except:
pass
try:
version = subprocess.check_output(
[f"{ansys_linux_path}/conda/bin/conda", "--version"]
Expand Down Expand Up @@ -221,7 +227,7 @@ def create_venv_linux_conda(venv_dir, py_path):

def delete_venv_conda(miniforge_path, parent_path):
"""
Delete virtual environment for Miniforge.
Delete virtual environments for Miniforge.

Examples
--------
Expand Down Expand Up @@ -302,7 +308,7 @@ def run_linux_command_conda(pypath, extra, venv=False):
execute_linux_command(f"cd ~ {venvParam} ; {conda_path}{extra} ", wait=False)


def find_installed_python_linux():
def find_ansys_installed_python_linux():
"""
Find all installed Ansys Python Manager installed Python versions on Linux.

Expand All @@ -314,7 +320,7 @@ def find_installed_python_linux():

Examples
--------
>>> installed_pythons = find_installed_python_linux()
>>> installed_pythons = find_ansys_installed_python_linux()
>>> installed_pythons
{'/home/user/python/py311/bin/python': ('3.11.3', False),
'/home/user/python/py311/bin/python3': ('3.11.3', False),
Expand Down
10 changes: 9 additions & 1 deletion src/ansys/tools/installer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
ASSETS_PATH,
INSTALL_TEXT,
LOG,
PRE_COMPILED_PYTHON_WARNING,
PYTHON_VERSION_TEXT,
UNABLE_TO_RETRIEVE_LATEST_VERSION_TEXT,
)
Expand Down Expand Up @@ -229,14 +230,21 @@ def __init__(self, show=True):
self.python_version_select.addItem("Python 3.11", "3.11.6")
self.python_version_select.addItem("Python 3.12", "3.12.0")

# Set the default selection to "Python 3.10"
# Set the default selection to "Python 3.11"
default_index = self.python_version_select.findText("Python 3.11")
self.python_version_select.setCurrentIndex(default_index)
python_version_layout.addWidget(self.python_version_select)

python_version_box_layout.addWidget(python_version)
form_layout.addWidget(python_version_box)

# Linux Warning/Note for Python pre-compiled version
if is_linux_os():
python_version_warning = QtWidgets.QLabel(PRE_COMPILED_PYTHON_WARNING)
python_version_warning.setWordWrap(True)
python_version_warning.setAlignment(QtCore.Qt.AlignmentFlag.AlignJustify)
python_version_box_layout.addWidget(python_version_warning)

# ensure content does not get squished
form_layout.addStretch()

Expand Down
Loading