Skip to content

Bundler requires sudo to install gems #35

@ipepe

Description

@ipepe

I started my docker container with:

docker run -v /Users/redacted/projects/notebooks/work:/home/jovyan/work -p 8888:8888 rubydata/datascience-notebook

When I try to run in Ruby notebook:

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'faraday'
end

It fails with error:

Bundler::InstallError: Bundler::SudoNotPermittedError: Bundler requires sudo access to install at the moment. Try installing again, granting Bundler sudo access when prompted, or installing into a different path.
  /usr/local/lib/ruby/3.1.0/bundler.rb:557:in `block in sudo'
  /usr/local/lib/ruby/3.1.0/bundler.rb:542:in `synchronize'
  /usr/local/lib/ruby/3.1.0/bundler.rb:542:in `sudo'
  /usr/local/lib/ruby/3.1.0/bundler/source/rubygems.rb:494:in `fetch_gem'
  /usr/local/lib/ruby/3.1.0/bundler/source/rubygems.rb:465:in `fetch_gem_if_possible'
  /usr/local/lib/ruby/3.1.0/bundler/source/rubygems.rb:158:in `install'
  /usr/local/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:54:in `install'
  /usr/local/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /usr/local/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:186:in `do_install'
  /usr/local/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:62:in `apply_func'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:57:in `block in process_queue'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:54:in `loop'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:54:in `process_queue'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing faraday-net_http (3.0.2), and Bundler cannot continue.

In Gemfile:
  faraday was resolved to 2.7.4, which depends on
    faraday-net_http


Bundler::SudoNotPermittedError: Bundler requires sudo access to install at the moment. Try installing again, granting Bundler sudo access when prompted, or installing into a different path.
  /usr/local/lib/ruby/3.1.0/bundler.rb:557:in `block in sudo'
  /usr/local/lib/ruby/3.1.0/bundler.rb:542:in `synchronize'
  /usr/local/lib/ruby/3.1.0/bundler.rb:542:in `sudo'
  /usr/local/lib/ruby/3.1.0/bundler/source/rubygems.rb:494:in `fetch_gem'
  /usr/local/lib/ruby/3.1.0/bundler/source/rubygems.rb:465:in `fetch_gem_if_possible'
  /usr/local/lib/ruby/3.1.0/bundler/source/rubygems.rb:158:in `install'
  /usr/local/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:54:in `install'
  /usr/local/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /usr/local/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:186:in `do_install'
  /usr/local/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:62:in `apply_func'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:57:in `block in process_queue'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:54:in `loop'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:54:in `process_queue'
  /usr/local/lib/ruby/3.1.0/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing ruby2_keywords (0.0.5), and Bundler cannot continue.

In Gemfile:
  faraday was resolved to 2.7.4, which depends on
    ruby2_keywords

/usr/local/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:220:in `handle_error'
/usr/local/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:102:in `call'
/usr/local/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:71:in `call'
/usr/local/lib/ruby/3.1.0/bundler/installer.rb:254:in `install_in_parallel'
/usr/local/lib/ruby/3.1.0/bundler/installer.rb:209:in `install'
/usr/local/lib/ruby/3.1.0/bundler/installer.rb:89:in `block in run'
/usr/local/lib/ruby/3.1.0/bundler/process_lock.rb:19:in `rescue in lock'
/usr/local/lib/ruby/3.1.0/bundler/process_lock.rb:15:in `lock'
/usr/local/lib/ruby/3.1.0/bundler/installer.rb:71:in `run'
/usr/local/lib/ruby/3.1.0/bundler/installer.rb:23:in `install'
/usr/local/lib/ruby/3.1.0/bundler/inline.rb:58:in `block (2 levels) in gemfile'
/usr/local/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary'
/usr/local/lib/ruby/3.1.0/bundler/inline.rb:57:in `block in gemfile'
/usr/local/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary'
/usr/local/lib/ruby/3.1.0/bundler/inline.rb:50:in `gemfile'
(irb):2:in `<top (required)>'

In my docker output there are messages:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions