Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied for adding packages #682

Closed
Willywang8216 opened this issue Oct 13, 2021 · 5 comments
Closed

Permission denied for adding packages #682

Willywang8216 opened this issue Oct 13, 2021 · 5 comments
Labels
🐛 bug Something isn't working 🤔 waiting for feedback Requires more information to clarify the issue

Comments

@Willywang8216
Copy link

Hello dear creator,
I have a problem adding a package called "bpython". Are we supposed to use sudo for adding packages?
I run the following command after pdm init. Any help is deeply appreciated.
Thank you :D

Raw output:

❯ pdm add bpython
Adding packages to default dependencies: bpython
✔ 🔒 Lock successful
Changes are written to pdm.lock.
Changes are written to pyproject.toml.
Synchronizing working set with lock file: 12 to add, 0 to update, 0 to remove

✔ Install blessings 1.7 successful
✔ Install bpython 0.21 successful
✔ Install certifi 2021.10.8 successful
✔ Install charset-normalizer 2.0.7 successful
✔ Install curtsies 0.3.10 successful
✔ Install cwcwidth 0.1.5 successful
✖ Install greenlet 1.1.2 failed
✔ Install idna 3.3 successful
✔ Install pygments 2.10.0 successful
✔ Install pyxdg 0.27 successful
✔ Install requests 2.26.0 successful
✔ Install urllib3 1.26.7 successful
Retry failed jobs
✖ Install greenlet 1.1.2 failed

ERRORS:
add greenlet failed:
Traceback (most recent call last):
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/will/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/installers/synchronizers.py", line 190, in install_candidate
self.manager.install(can)
File "/home/will/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/installers/manager.py", line 38, in install
installer(candidate.build(), self.environment, candidate.direct_url())
File "/home/will/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/installers/installers.py", line 74, in install_wheel
_install_wheel(
File "/home/will/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/installers/installers.py", line 189, in _install_wheel
record = destination.write_file(
File "/home/will/.local/share/pdm/venv/lib/python3.9/site-packages/installer/destinations.py", line 151, in write_file
return self.write_to_fs(scheme, path, stream)
File "/home/will/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/installers/installers.py", line 60, in write_to_fs
record = super().write_to_fs(scheme, path, stream)
File "/home/will/.local/share/pdm/venv/lib/python3.9/site-packages/installer/destinations.py", line 130, in write_to_fs
with open(target_path, "wb") as f:
PermissionError: [Errno 13] Permission denied: '/usr/include/python3.9/greenlet.h'

@frostming frostming transferred this issue from pdm-project/pdm-venv Oct 14, 2021
@frostming
Copy link
Collaborator

Can you show the output of pdm info?

@frostming frostming added 🤔 waiting for feedback Requires more information to clarify the issue 🐛 bug Something isn't working labels Oct 14, 2021
@Willywang8216
Copy link
Author

Willywang8216 commented Oct 14, 2021

Sure.
❯ pdm info
PDM version: 1.9.0
Python Interpreter: /home/will/.local/share/pdm/venv/bin/python (3.9)
Project Root: /home/will/python_project/ML2/Normalizing_flows
Project Packages: None

I dont' have any venv for this project.

❯ pdm venv list
Virtualenvs created with this project:

Although I pdm add bpython produces error, I run pdm list. There is greenlet 1.1.2 in this list.

My config:
❯ pdm config
Home configuration (/home/will/.pdm/config.toml):
auto_global = False
build_isolation = True
cache_dir = /home/will/.cache/pdm
check_update = True
feature.install_cache = False
parallel_install = True
project_max_depth = 5
pypi.json_api = False
pypi.url = https://pypi.org/simple
pypi.verify_ssl = True
python.use_pyenv = True
strategy.resolve_max_rounds = 10000
strategy.save = compatible
strategy.update = reuse
use_venv = True
venv.backend = virtualenv
venv.location = /home/will/.local/share/pdm/venvs

Project configuration (/home/will/python_project/ML2/Normalizing_flows/.pdm.toml):
python.path = /home/will/.local/share/pdm/venv/bin/python

@aadityaverma
Copy link

with pdm sync
"Inside an active virtualenv /home/aditya/anaconda3/envs/tts, reusing it.
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
All packages are synced to date, nothing to do.
Installing the project as an editable package...
✖ Install fish-diffusion 2.2.0 failed

See /tmp/pdm-install-_n8gppz5.log for detailed debug log.
[BuildError]: Build backend raised error: Showing the last 10 lines of the
build output:
self.call_hook("pdm_build_update_files", context, files)
File
"/tmp/pdm-build-env-hykqnjur-shared/lib/python3.10/site-packages/pdm/backend/ba
se.py", line 138, in call_hook
getattr(hook, hook_name)(context, *args, **kwargs)
File
"/tmp/pdm-build-env-hykqnjur-shared/lib/python3.10/site-packages/pdm/backend/ed
itable.py", line 48, in pdm_build_update_files
context.ensure_build_dir()
File
"/tmp/pdm-build-env-hykqnjur-shared/lib/python3.10/site-packages/pdm/backend/ho
oks/base.py", line 59, in ensure_build_dir
self.build_dir.mkdir(mode=0o700, parents=True, exist_ok=True)
File "/home/aditya/anaconda3/envs/tts/lib/python3.10/pathlib.py", line 1175,
in mkdir
self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied:
'/home/aditya/wf/tts/fish-diffusion/.pdm-build'
Add '-v' to see the detailed traceback
"

@frafra
Copy link
Contributor

frafra commented Nov 21, 2023

More information have been provided. I have the same issue when installing using pdm 3.10.3. I use pipx.

$ pdm add lark
Adding packages to default dependencies: lark
🔒 Lock successful
Changes are written to pyproject.toml.
Synchronizing working set with resolved packages: 1 to add, 0 to update, 0 to remove

  ✖ Install lark 1.1.8 failed
Retry failed jobs
  ✖ Install lark 1.1.8 failed

ERRORS:
add lark failed:
Traceback (most recent call last):
  File "/usr/lib64/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/pdm/installers/synchronizers.py", line
286, in install_candidate
    self.manager.install(can)
  File "/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/pdm/installers/manager.py", 
line 33, in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
  File "/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/pdm/installers/installers.py", 
line 182, in install_wheel
    _install_wheel(wheel=wheel, destination=destination, additional_metadata=additional_metadata)
  File "/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/pdm/installers/installers.py", 
line 278, in _install_wheel
    install(source, destination, additional_metadata=additional_metadata or {})
  File "/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/installer/_core.py", line 109, 
in install
    record = destination.write_file(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/installer/destinations.py", 
line 207, in write_file
    return self.write_to_fs(scheme, path_, stream, is_executable)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/pdm/installers/installers.py", 
line 154, in write_to_fs
    return super().write_to_fs(scheme, path, stream, is_executable)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frafra/.local/pipx/venvs/pdm/lib64/python3.11/site-packages/installer/destinations.py", 
line 171, in write_to_fs
    os.makedirs(parent_folder)
  File "<frozen os>", line 215, in makedirs
  File "<frozen os>", line 215, in makedirs
  File "<frozen os>", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.11'
$ pdm info
PDM version:
  2.10.3
Python Interpreter:
  /usr/bin/python (3.11)
Project Root:
  /home/frafra/Code/seabird-gps-database/logger2csv
Local Packages:

@frostming
Copy link
Collaborator

Python Interpreter:
/usr/bin/python (3.11)

Don't the global python, use venv instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🤔 waiting for feedback Requires more information to clarify the issue
Projects
None yet
Development

No branches or pull requests

4 participants