question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip install fails with permission denied

See original GitHub issue
  • Pip version: 9.0.1
  • Python version: 3.6
  • Operating system: CentOS 7

I’m using a conda environment.

Description:

I’m trying to install the nnpy package. Unfortunately, pip fails because it creates read-only files in /tmp and then tries to write to them.

What I’ve run:


$ git clone https://github.com/nanomsg/nnpy.git
$ pip install ./nnpy
Processing ./nnpy
Exception:
Traceback (most recent call last):
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/site-packages/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/site-packages/pip/download.py", line 809, in unpack_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/site-packages/pip/download.py", line 686, in unpack_file_url
    shutil.copytree(link_path, location, symlinks=True)
  File "/om/user/vladfi1/.conda/envs/tf-cpu-pypi/lib/python3.6/shutil.py", line 359, in copytree
    raise Error(errors)
shutil.Error: [('/om/user/vladfi1/nnpy/.git/objects/pack/pack-b781daf3caebcd4b82b9fbf8e22a949dd886c891.idx', '/tmp/pip-ava1_73j-build/.git/objects/pack/pack-b781daf3caebcd4b82b9fbf8e22a949dd886c891.idx', "[Errno 13] Permission denied: '/tmp/pip-ava1_73j-build/.git/objects/pack/pack-b781daf3caebcd4b82b9fbf8e22a949dd886c891.idx'"), ('/om/user/vladfi1/nnpy/.git/objects/pack/pack-b781daf3caebcd4b82b9fbf8e22a949dd886c891.pack', '/tmp/pip-ava1_73j-build/.git/objects/pack/pack-b781daf3caebcd4b82b9fbf8e22a949dd886c891.pack', "[Errno 13] Permission denied: '/tmp/pip-ava1_73j-build/.git/objects/pack/pack-b781daf3caebcd4b82b9fbf8e22a949dd886c891.pack'")]
$ ls -la /tmp/pip-ava1_73j-build/.git/objects/pack/pack-b781daf3caebcd4b82b9fbf8e22a949dd886c891.pack
-r--r--r--

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vladfi1commented, May 31, 2017

I suspect this is an edge case caused by the presence of .git which doesn’t need to be copied. Removing the .git folder fixed the issue.

0reactions
ctaggartcommented, Jun 7, 2019

I’m pretty sure I hit this bug when trying to install this on Windows with 3.7.3 like so:

git clone https://github.com/Azure/azure-keyvault-cli-extension.git
cd azure-keyvault-cli-extension
pipenv --python C:\Users\taggac\AppData\Local\Programs\Python\Python37\python.exe
pip install pipenv
pipenv install -e git+https://github.com/Azure/azure-cli-dev-tools.git@master#egg=azdev

It says it is fixed in 3.8.0b1, so I installed it from https://www.python.org/downloads/release/python-380b1/ and it works. 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip is not able to install packages correctly: Permission denied ...
The answer is to do this: STATIC_DEPS=true pip install lxml . · When you edit your questions there's no need to include text...
Read more >
Permission denied when running "pip install"
When attempting to install or upgrade packages using "pip install", you receive a permission denied error. ... It's possible to install/upgrade ...
Read more >
"Permission Denied" error while trying to install modules with pip
pip is trying to install this library in a system folder that you do not have permission to write to. It suggests using...
Read more >
Permission denied errors when pip install package #4667
Launched new notebook service; On the home Jupyter page: New -> Terminal; pip install tqdm leads to error. Log: ... 6/dist-packages/tqdm' Consider ...
Read more >
pip install --user permission issue : Forums - PythonAnywhere
pip install --user permission issue ... That looks like a bug in the package that doesn't acknowledge the "--user" argument for the install....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found