pip freeze returns an error: Permission denied: hg

Updated on January 13, 2021

Used pip install -e to install a python package. As I saw lot of sympy deprecation warning in the logs, I used pip freeze to list all the packages installed on the system and its version information. However, pip freeze throwed 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] Permission denied: 'hg'
PermissionError: [Errno 13] Permission denied: 'hg'
Environment

pip 19.1.1
Python 3.7.3
OS: CentOS 7.8
pip freeze is a very useful command

tells you which modules you’ve installed with pip install and the versions of these modules that you are currently have installed on your computer.

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

$ hg
-bash: hg: command not found
Mercurial

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

hgcommand 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, or use a Git server as a collaboration point for a team with developers using both Git and Mercurial.

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 article helpful?

Related Articles

Leave a Comment