Create a requirements.txt file specifying the
Python package and version dependencies required by your Cloudera Data Engineering
job.
Ensure that the following hostnames are reacheable from within the cluster, to install
the Python package successfully if no PyPi mirror is configured:
pypi.python.org
pypi.org
pythonhosted.org
files.pythonhosted.org
Steps
Run the cde resource create command as follows
to create a Python virtual environment resource.
When you first create a Python virtual environment resource, Cloudera Data Engineering
builds the environment according to the
requirements.txt file. During this build time, you
cannot run a job associated with the virtual environment. You can
check the status of the environment by running cde resource
list-events --name <resource_name>.
For example:
Create a requirements.txt file specifying the
Python package and version dependencies required by your Cloudera Data Engineering
job.
Ensure that the following hostnames are reacheable from within the cluster, to install
the Python package successfully if no PyPi mirror is configured:
pypi.python.org
pypi.org
pythonhosted.org
files.pythonhosted.org
Steps
In the Cloudera management console, click the Data
Engineering tile and click Overview.
In the CDE Services column, select the
service containing the virtual cluster where you want to create the
Python virtual environment.
In the Virtual Clusters column on the
right, click the View Jobs icon for the
virtual cluster where you want to create the Python virtual
environment.
Click Resources in the left menu.
Click Create Resource at the top
right.
Specify a resource name, and then select Python
Environment from the Type
drop-down menu.
Choose the Python version for the environment and optionally
specify the PyPi Mirror URL. The PyPi mirror
must be accessible from the Cloudera environment.
Click Create.
Click Upload File and select the
requirements.txt file from your local machine.
You can also drag-and-drop the file to the outlined area on the
page.
Result
The UI displays Building the resource... while
the Python virtual environment is building. After the environment is
built, the page displays the Python packages and versions included in
the environment.