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.

Poetry add package Permission Denied

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Question

When I try to add a new package, poetry tries to access root folders and a ‘Permission denied’ error is thrown:

$ poetry add tldextract
Using version ^2.2 for tldextract

Updating dependencies
Resolving dependencies... (0.6s)


Package operations: 8 installs, 1 update, 5 removals

Writing lock file

 - Updating six (1.10.0 -> 1.11.0)
                                                                                                                                                      
[EnvCommandError]                                                                                                                       
Command ['pip', 'install', '--no-deps', '-U', 'six==1.11.0'] errored with the following output:                                                      
Collecting six==1.11.0                                                                                                                               
 Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-a  
ny.whl                                                                                                                                               
Installing collected packages: six                                                                                                                   
 Found existing installation: six 1.10.0                                                                                                            
   Uninstalling six-1.10.0:                                                                                                                         
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/__pycache__/six.cpython-35.pyc

It tries to update a package that is installed as the root user and fails when uninstalling the old version.

Does poetry not create its own virtual environment to manage the dependencies? I assumed it would never try access any root folder.

Also, when I run poetry shell command, it looks like it is using virtualenv, but I cannot run any command in it:

$ poetry shell
Spawning shell within /home/$USER/.cache/pypoetry/virtualenvs/my-package-py3.5

$ poetry add tldextract
[ImportError]
No module named 'pkg_resources'

I assume something is wrong with my setup, but I could not pinpoint where the problem is. Any help is greatly appreciated.

Thanks

$ python --version
Python 3.5.3

$ pip --version
pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)

$ poetry --version
Poetry 0.12.7

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
xialu4820723commented, Nov 29, 2018

When I was using python 3.5, the following step solved this problem.

  1. remove created poetry venv: rm -r ~/.cache/pypoetry/virtualenvs/project-py3.5
  2. install python-venv: sudo apt-get install -y python3-venv

Then I updated python to 3.7.1, the following step solved this problem.

  1. remove created poetry venv: rm -r ~/.cache/pypoetry/virtualenvs/project-py3.7
  2. install python3.7-venv: sudo apt-get install -y python3.7-venv

os: ubuntu 16.04

4reactions
neumondcommented, Dec 29, 2018

This happens due to incomplete virtualenv creation. E.g. I’ve typed

poetry add request

and quickly realized my mistype, pressed ctrl+C. After this virtualenv is half-working. Recreating virtualenv helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry fails with "permission denied" pip - Garuda Linux Forum
I am using this machine as a dev box. I've installed poetry package (python-poetry) and pyenv;; I installed python 3.8.12; made python 3.8...
Read more >
Have PermissionError when I run "poetry run" command
To run my code, I tried another way. $ poetry shell (myproject-x8XipcUE-py3.7)$ python myproject/main.py. I had no error.
Read more >
Configuration | Documentation | Poetry - Python dependency ...
Configuration Poetry can be configured via the config command (see more about its usage here) or directly in the config.toml file that will...
Read more >
Configure a Poetry environment | PyCharm Documentation
You can declare the libraries your project depends on, and Poetry will install and update them for you. Project dependencies are recorded in...
Read more >
Dependency Management With Python Poetry
When your Python project relies on external packages, you need to make sure you're using the right version of each package.
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