Unable to import sklearn after installing any package

Hi all,
In our Jupyterhub we are using Py3.6 version. This py36 version is a venv. Recently we are facing this issue.
Whenever we install any new package using pip install command it installs and the chmod is for the new folders in the location “/usr/share/miniconda2/envs/py36/lib/python3.6/site-packages/” is 750. Immediately after that we can not import sklearn and getting the follow error message.
[Errno 13] Permission denied: ‘/usr/share/miniconda2/envs/py36/lib/python3.6/site-packages/PyAudio-0.2.11.dist-info’
We installed pyaudio just now.
The issue is resolved when I ran chmod and set 755 permission.
chmod 755 -R /usr/share/miniconda2/envs/py36/lib/python3.6/site-packages/PyAudio-0.2.11.dist-info
Not sure 755 is the right access. Please confirm how to resolve this.


This looks like a pip issue, and might be related to your umask. Can you check that pip is fully up to date (at least 21.1)? and what your umask is (the output of the command umask)?

Thanks @minrk
My pip version is 21.1.1.
Py version is 3.6.13. Using miniconda as package manager.
Umask command output is 0027.
Is it ok to provide read execute access to package dir in /usr/share/miniconda2/envs/py36/lib/python3.6/site-packages to “other”

umask 0027 means that new files are created with permissions 550 for directories or 440 for files, which is what you are seeing. Changing the umask with a call to umask 0022 will change that to the more common default of world-readable files.

I don’t know why your umask is set to that value or how to fix it systematically, but putting that call to umask 0022 somewhere prior to install will fix it.

reference on umask

1 Like

Thanks @minrk . I agree and happy with the resolution. Marking this as closed.
Thanks again for the suggestion.