You may not be able to use the pip command in CDP releases 7.1.7 and above and may
see the following error when using pip in a command: “ImportError: cannot import name
chardet”.
To fix this issue and use the pip
command, you must download
pip
from pypi.org
and
copy the chardet
package to the target directory.
-
SSH into the Hue host as a root user.
-
Change to the following directory:
cd /opt/cloudera/parcels/CDH/lib/hue
-
Check the pip version by running the following command:
./build/env/bin/pip --version
-
Download the
pip
package by running the following
command:
wget https://files.pythonhosted.org/packages/53/7f/55721ad0501a9076dbc354cc8c63ffc2d6f1ef360f49ad0fbcce19d68538/pip-20.3.4.tar.gz -O ~/pip-20.3.4.tar.gz
-
Extract the
tar
file by running the following command:
tar xvzf ~/pip-20.3.4.tar.gz -C ~
-
Copy the
chardet
package to the target directory by running
the following command:
cp -R ~/pip-20.3.4/src/pip/_vendor/chardet build/env/lib/python2.7/site-packages/pip/_vendor/.
-
Verify that you can run a pip command without any error by running any of the
following sample commands:
./build/env/bin/pip freeze
or