pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.15k stars 131 forks source link

Cannot install as Root. #487

Open Noahyt opened 2 years ago

Noahyt commented 2 years ago

I am encountering an issue where install.py does not seem to properly pick up the FLIT_ROOT_INSTALL env variable.

Specifically, when I run:

$ export FLIT_ROOT_INSTALL=1
$ sudo flit install

I get the error:

  File "[CONDA_PATH]/python3.9/site-packages/flit/install.py", line 112, in __init__
    raise RootInstallError
flit.install.RootInstallError: Installing packages as root is not recommended. To allow this, set FLIT_ROOT_INSTALL=1 and try again.

I am running Python 3.9 on Mac OSX 12.0.1.

takluyver commented 2 years ago

You can also now use pip install . to install a package built with Flit.

I think sudo discards environment variables by default. On Linux, I can use sudo --preserve-env=FLIT_ROOT_INSTALL to preserve a specific environment variable, or -E to preserve all of them. The options might be different on Mac.