lavabit / robox

The tools needed to robotically create/configure/provision a large number of operating systems, for a variety of hypervisors, using packer.
620 stars 139 forks source link

generic/alpine313: cannot use pip #209

Closed oxr463 closed 3 years ago

oxr463 commented 3 years ago
default: Traceback (most recent call last):
    default:   File "/usr/bin/pip", line 33, in <module>
    default:     sys.exit(load_entry_point('pip==20.3.4', 'console_scripts', 'pip')())
    default:   File "/usr/bin/pip", line 22, in importlib_load_entry_point
    default:     for entry_point in distribution(dist_name).entry_points
    default:   File "/usr/lib/python3.8/importlib/metadata.py", line 503, in distribution
    default:     return Distribution.from_name(distribution_name)
    default:   File "/usr/lib/python3.8/importlib/metadata.py", line 177, in from_name
    default:     raise PackageNotFoundError(name)
    default: importlib.metadata.PackageNotFoundError: pip
Vagrant.configure("2") do |config|
  config.vm.box = "generic/alpine313"
  config.vm.box_version = "3.2.0"
  config.vm.hostname = "pentesting-vm"

  config.vm.provider "virtualbox" do |vb|
    vb.name = "pentesting-vm"
    vb.gui = true
  end

  config.ssh.forward_agent = true
  config.ssh.forward_x11 = true

  config.vm.provision "shell", inline: <<-SHELL
    apk update && \
    apk add --repository=https://sjc.edge.kernel.org/alpine/edge/community \
      bzip2 \
      cargo \
      coreutils \
      curl \
      g++ \
      gcc \
      go \
      git \
      libffi-dev \
      libxml2-dev \
      libxslt-dev \
      make \
      maturin \
      nikto \
      nmap \
      openjdk8 \
      openssl-dev \
      python3-dev \
      py3-pip \
      tar \
      unzip
    go get github.com/OJ/gobuster
    pip install mitmproxy sqlmap sslyze
  SHELL

end

Source: https://github.com/oxr463/pentesting-vm/blob/master/Vagrantfile

timschumi commented 3 years ago

The fact that this breaks isn't too surprising, since you are installing selected packages from the edge repository instead of the repository for Alpine 3.13.

In this case your system still has Python 3.8 installed, but the pip package that you installed is installed to /usr/lib/python3.9 instead, which is why Python 3.8 can't find it.

Not a robox issue.

oxr463 commented 3 years ago

The fact that this breaks isn't too surprising, since you are installing selected packages from the edge repository instead of the repository for Alpine 3.13.

In this case your system still has Python 3.8 installed, but the pip package that you installed is installed to /usr/lib/python3.9 instead, which is why Python 3.8 can't find it.

Not a robox issue.

Ah... thank you for spotting my mistake! I'll close this.