How to fix pip freeze returns an error:: Permission denied: hg?

 

pip freeze is a very useful command. It tells you which modules you've installed and the versions of these modules installed on your computer.

 

Scenario:

Used pip install -e to install a python package. Got warning in the logs, pip freeze to list all the packages installed on the system. pip freeze threw few more errors.

#pip freeze
...
File "/usr/share/httpd/.conda/envs/apache_iisc_dm/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py", line 120, in call_subprocess proc = subprocess.Popen(
File "/usr/share/httpd/.conda/envs/apache_iisc_dm/lib/python3.9/subprocess.py", line 947, in __init__ self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/share/httpd/.conda/envs/apache_iisc_dm/lib/python3.9/subprocess.py", line 1819, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) PermissionError: [Errno 13]


Environment

pip 19.1.1
Python 3.7.3
OS: CentOS 7.8

 

Solution:

The issue is because the hg command is unavailable, from the pip’s point of view.

$ hg
-bash: hg: command not found

 

hg command is available inside the package Hg-Git. Hg-Git plugin for Mercurial, adds the ability to push to and pull from a Git server repository from Mercurial. This means you can collaborate on Git-based projects from Mercurial.

 

Mercurial

Mercurial is a free distributed source control management tool. Mercurial is used by software development teams to manage and track changes across projects.

 

Since Mercurial is merged with pip freeze, so it seems likely that pip freeze expects hg to be available.

 

So install Hg-Git to fix the above issue:

#sudo yum install hg-git -y

 

That’s It!

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)