pipenv
pipenv copied to clipboard
PermissionError: [Errno 13] Permission denied: /usr/local/laps
Issue description
lately, I'll get the following error doing any commands related to pipenv shell (--python 3.8.5, --support)
PermissionError: [Errno 13] Permission denied: '/usr/local/laps'
I reinstalled pipenv using homebrew but the error persists on:
mac catalina 10.15.7
Homebrew 3.1.2
Im not sure why the folder is accessed where macOS LAPS (Local Administrator Password Solution) is located and therefore I dont really know whether to grant access rights
Appreciate any suggestions!
❯ pipenv --support | pbcopy Traceback (most recent call last): File "/usr/local/Cellar/pipenv/2020.11.15/libexec/bin/pipenv", line 8, in <module> sys.exit(cli()) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 1236, in invoke return Command.invoke(self, ctx) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func return ctx.invoke(f, obj, *args, **kwargs) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/cli/command.py", line 140, in cli get_pipenv_diagnostics() File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/help.py", line 33, in get_pipenv_diagnostics python_paths = finder.find_all_python_versions() File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 322, in find_all_python_versions versions = self.system_path.find_all_python_versions( File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 547, in find_all_python_versions values = list(self.get_pythons(sub_finder)) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 505, in get_pythons pythons = [entry for entry in self._get_all_pythons(finder)] File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 505, in <listcomp> pythons = [entry for entry in self._get_all_pythons(finder)] File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 498, in _get_all_pythons for python in self._filter_paths(finder): File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 490, in _filter_paths python_versions = finder(path) File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/mixins.py", line 330, in find_all_python_versions unnested = [sub_finder(path) for path in expand_paths(self)] File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/mixins.py", line 330, in <listcomp> unnested = [sub_finder(path) for path in expand_paths(self)] File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/utils.py", line 433, in expand_paths for p in path.children.values(): File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 751, in children for child_key, child_val in self._gen_children(): File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 733, in _gen_children for child in self._filter_children(): File "/usr/local/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1149, in iterdir for name in self._accessor.listdir(self): PermissionError: [Errno 13] Permission denied: '/usr/local/laps'
Have you tried installing using pip, rather than homebrew?
From the docs:
It’s possible to install Pipenv with Homebrew on MacOS, or with Linuxbrew on Linux systems. However, this is now discouraged, because updates to the brewed Python distribution will break Pipenv, and perhaps all virtual environments managed by it. You’ll then need to re-install Pipenv at least.
The issue is not Homebrew related, because I have the same problem and I have Pipenv installed via Pip.
The problem is that when running: pipenv --python 3.8.5, Pipenv searches for a Python executable with that version number. The search path includes /usr/local, where it trips over the write-only directory /usr/local/laps. This probably can be fixed easily by adding a try ... except somewhere.
In the meantime, a work-around is to provide the full path to the Python executable that you want to use: pipenv --python "/opt/local/python3.8"
Could you recheck this on the latest pipenv? I did some work on the pythonfinder logic and I believe this may be fixed now.
Sorry, I don't have access to this particular machine anymore.