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:
- Created 5 years ago
- Comments:13 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When I was using python 3.5, the following step solved this problem.
rm -r ~/.cache/pypoetry/virtualenvs/project-py3.5
sudo apt-get install -y python3-venv
Then I updated python to 3.7.1, the following step solved this problem.
rm -r ~/.cache/pypoetry/virtualenvs/project-py3.7
sudo apt-get install -y python3.7-venv
os: ubuntu 16.04
This happens due to incomplete virtualenv creation. E.g. I’ve typed
and quickly realized my mistype, pressed ctrl+C. After this virtualenv is half-working. Recreating virtualenv helps.