Why Do I Get Permission Denied When I Try Use "Make" to Install Something

Why do I get permission denied when I try use make to install something?

On many source packages (e.g. for most GNU software), the building system may know about the DESTDIR make variable, so you can often do:

 make install DESTDIR=/tmp/myinst/
sudo cp -va /tmp/myinst/ /

The advantage of this approach is that make install don't need to run as root, so you cannot end up with files compiled as root (or root-owned files in your build tree).

Permission denied error by installing matplotlib

It looks like your user does not have the permission to install packages in your system (for all users). Here's how to fix this problem for Linux, macOS and Windows.



Linux / macOS

From your terminal, you can install the package for your user only, like this:

pip install <package> --user

OR

You can use su or sudo from your terminal, to install the package as root:

sudo pip install <package>


Windows

From the Command Prompt, you can install the package for your user only, like this:

pip install <package> --user

OR

You can install the package as Administrator, by following these steps:

  1. Right click on the Command Prompt icon
  2. Select the option Run This Program As An Administrator
  3. Run the command pip install <package>

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Change your file permissions... Like this

First check who owns the directory

ls -la /usr/local/lib/node_modules

it is denying access because the node_module folder is owned by root

drwxr-xr-x   3 root    wheel  102 Jun 24 23:24 node_modules

so this needs to be changed by changing root to your user but first run command below to check your current user How do I get the name of the active user via the command line in OS X?

id -un OR whoami

Then change owner

sudo chown -R [owner]:[owner] /usr/local/lib/node_modules

OR

sudo chown -R ownerName: /usr/local/lib/node_modules

OR

sudo chown -R $USER /usr/local/lib/node_modules

Could not install packages due to an EnvironmentError: [Errno 13]

If you want to use python3+ to install the packages you need to use pip3 install package_name

And to solve the errno 13 you have to add --user at the end

pip3 install package_name --user

EDIT:

For any project in python it's highly recommended to work on a Virtual enviroment, is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them.

In order to create one with python3+ you have to use the following command:

virtualenv enviroment_name -p python3

And then you work on it just by activating it:

source enviroment_name/bin/activate

Once the virtual environment is activated, the name of your virtual environment will appear on left side of terminal. This will let you know that the virtual environment is currently active.
Now you can install dependencies related to the project in this virtual environment by just using pip.

pip install package_name

Permission denied with pip install --user -e /home/me/package/

It's a bug. The issue is being tracked at https://github.com/pypa/pip/issues/7953 .

The workaround for now is to modify your setup.py() to contain this:

import site
import sys
site.ENABLE_USER_SITE = "--user" in sys.argv[1:]

Or to use something like this on the command line, if you use setup.cfg or pyproject.toml:

$ python3 -c 'import setuptools, site, sys; site.ENABLE_USER_SITE = 1; sys.argv[1:] = ["develop", "--user"]; setuptools.setup()'

pip install access denied on Windows

For Windows, in Command Prompt (Admin) try to run pip install using the Python executable:

python -m pip install mitmproxy

This should work, at least it worked for me for other package installation.



Related Topics



Leave a reply



Submit