Linux Virtual Delivery Agent

Create a Python3 virtual environment

If you are connecting to the network, running the sudo /opt/Citrix/VDA/bin/xdping command can create a Python3 virtual environment. However, if the commands fail to create a Python3 virtual environment, you can create it manually even without a network connection. This article details the prerequisites and steps to create a Python3 virtual environment without a network connection.

Prerequisites

  • You must have administrative privileges to access the /opt/Citrix/VDA/sbin/ctxpython3 directory.
  • The wheel files of Python3 packages are in place. You can download the wheel files from https://pypi.org/.

Create a Python3 virtual environment

Complete the following steps to create a Python3 virtual environment:

  1. Install Python3 dependencies.

    For RHEL and Rocky Linux:

    yum -y install python3-devel krb5-devel gcc
    <!--NeedCopy-->
    

    Note:

    You might have to enable a particular repository to install some dependencies. For RHEL 8, run the subscription-manager repos --enable=rhel-8-for-x86_64-appstream-rpms command. For RHEL 9, run the subscription-manager repos --enable=rhel-9-for-x86_64-appstream-rpms command. For RHEL 10, run the subscription-manager repos --enable=rhel-10-for-x86_64-appstream-rpms command.

    For Debian, Ubuntu:

    apt update
    
    apt-get -y install python3-dev python3-pip python3-venv libkrb5-dev libffi-dev
    <!--NeedCopy-->
    

    For SUSE:

    zypper -n install lsb-release python3-devel python3-setuptools krb5-devel gcc libffi-devel libopenssl-devel
    <!--NeedCopy-->
    
  2. Create a Python3 virtual environment.

    Note:

    If pip fails with an SSL error when it downloads packages in the next step — for example SSLError, CERTIFICATE_VERIFY_FAILED, or There was a problem confirming the ssl certificate — your machine cannot validate the PyPI certificate chain, which typically happens behind an inspecting proxy. Mark the two PyPI hosts as trusted so that pip skips certificate verification for them.

    Create /etc/pip.conf if it does not exist, then add:

    [global]
    trusted-host =
        pypi.org
        files.pythonhosted.org
    <!--NeedCopy-->
    

    To apply the exemption to a single command instead of system-wide, pass it inline:

    sudo /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <packages>
    <!--NeedCopy-->
    

    For Debian, RHEL, Rocky Linux, Ubuntu:

    sudo python3 -m venv /opt/Citrix/VDA/sbin/ctxpython3
    <!--NeedCopy-->
    

    For SUSE:

    sudo ln -s /usr/lib/mit/bin/krb5-config /usr/bin/krb5-config
    
    export PATH=$PATH:/usr/lib/mit/bin:/usr/lib/mit/sbin
    
    sudo mkdir -p /usr/lib/mit/include/gssapi/
    
    sudo ln -s /usr/include/gssapi/gssapi_ext.h /usr/lib/mit/include/gssapi/gssapi_ext.h
    
    sudo python3 -m venv /opt/Citrix/VDA/sbin/ctxpython3
    <!--NeedCopy-->
    
  3. Install XDPing dependencies.

    XDPing pins two different dependency sets, selected by the Python3 minor version of the interpreter that created the virtual environment, not by the distribution. Check the version first:

    /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -V
    <!--NeedCopy-->
    

    For Python 3.11 or later:

    sudo /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -m pip install --upgrade pip
    
    sudo /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -m pip install asn1crypto==1.5.1 cffi==2.0.0 cryptography==46.0.6 decorator==5.1.1 gssapi==1.8.3 ldap3==2.9.1 netifaces==0.11.0 packaging==24.1 pg8000==1.31.5 prettytable==3.11.0 psutil==6.0.0 pyasn1==0.6.4 pycparser pyparsing==3.1.4 python-dateutil==2.9.0.post0 scramp==1.4.5 six==1.16.0 termcolor==2.4.0 wcwidth==0.2.13
    
    sudo /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -m pip install /opt/Citrix/VDA/sbin/ctxpython3/packages/xdping-*.whl
    <!--NeedCopy-->
    

    For Python 3.10 or earlier:

    sudo /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -m pip install --upgrade pip
    
    sudo /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -m pip install asn1crypto==1.5.1 cffi==1.15.0 cryptography==36.0.2 decorator==5.1.1 gssapi==1.7.3 ldap3==2.9.1 netifaces==0.11.0 packaging==21.3 pg8000==1.26.0 psutil==5.9.0 pyasn1==0.4.8 pycparser==2.21 pyparsing==3.0.8 scramp==1.4.1 six==1.16.0 termcolor==1.1.0 prettytable==2.5.0 wcwidth
    
    sudo /opt/Citrix/VDA/sbin/ctxpython3/bin/python3 -m pip install /opt/Citrix/VDA/sbin/ctxpython3/packages/xdping-*.whl
    <!--NeedCopy-->
    

    The following table shows the default Python3 version on each Linux distribution supported by Linux VDA 2607. If you installed a non-default Python3, use the version reported by the command in this step instead.

    Distribution Default Python3
    Debian 13 3.13
    Debian 12 3.11
    RHEL 10, Rocky Linux 10 3.12
    RHEL 9.8/9.6, Rocky Linux 9.8/9.6 3.9
    RHEL 8.10, Rocky Linux 8.10 3.6
    SUSE 15.7 3.6
    Ubuntu 26.04, Ubuntu 24.04 3.12 and later
    Ubuntu 22.04 3.10
Create a Python3 virtual environment