Skip to content

Scripts are not being installed correctly on OSX

I am experiencing very weird behavior with dune-python when Python and pip are installed through Homebrew on OSX:

Scripts (e.g. from dune-testtools) are installed into /usr/local/lib instead of into the virtualenv, and even worse, carry a wrong shebang line pointing to the Homebrew Python interpreter instead of the interpreter of the virtualenv (pretty much as described here). This causes the wrong Python instance to be invoked when these scripts are called, thus all dependency packages installed into the virtualenv are not being found, and the scripts fail.

I think I roughly understand what's happening:

  • The virtualenvs are created with --system-site-packages
  • pip is not being installed into the virtualenv because it is already present in the system site packages (requirement already satisfied)
  • The pip instance that is then being used belongs to the system interpreter, so all installed packages carry a wrong shebang
  • If I use python setup.py develop instead of pip, everything works fine. If I remove --system-site-packages from the create_virtualenv CMake function, everything works fine as well.

I understand that OSX support is not really a priority of yours, but it would be great if you could just introduce an environment variable to opt-out from the --system-site-packages call when creating virtualenvs (or merge !6 (closed)).

I am on the 2.4 release branch.