lightning
lightning copied to clipboard
Update installation.md - ubuntu
It's been a couple of months since trying to install anything not as root on a Debian-based system with pip fails like so:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
I think we just need to mention the --break-system-packages flag for pip? That always works for me.
I think we just need to mention the
--break-system-packagesflag for pip? That always works for me.
Yes, it should definitely be mentioned in the building instructions. Using pip to install those dependencies results in them not being in PATH is installed in '/home/j/.local/bin' which is not on PATH. And that would later result in ModuleNotFoundError when make is run as root. I find installing the said dependencies with a package manager such as apt a more seamless process.
The document describes two different installation procedures.
- Users that want to build Core Lightning from source
- Developers that want to contribute to Core Lightning
The result is that we get a document that is confusing to both users and developers @adi-shankara : It is probably a good idea to split these up. What do you think?
Users
I agree that installing dependencies using a package manager is the easiest and would serve our user-base the best.
However, the proposed changes don't fix the user-problem.
Even after the changes we are still suggesting users to run pip install which results in the error @whileunless describes.
https://github.com/ElementsProject/lightning/blob/97440ead7f119d15e0e4d48c8043b8c193838b96/doc/getting-started/getting-started/installation.md?plain=1#L129-L139
Even worse. I don't think using the systems package manager is a feasible solution.
We need three groups of python dependencies
mako: Can be installed usingpip install makoorapt install python3-makogprcio-tools: Can be installed usingpip install grpcio-toolsorapt install python3-grpc-tools- cln_rest dependencies: Can be installed using
pip install -r ./plugins/clnrest/requirements.txt. I don't want to maintain the equivalent list here usingapt.
In my opinion using a venv is the appropriate solution here.
I have bad experiences with --break-system-packages and recommend against doing it for a production node.
Proposed procedure
Install dependencies
sudo apt-get install -y \
autoconf automake build-essential git libtool libsqlite3-dev \
python3 python3-pip python3-venv
Create a new venv. This is an environment that will hold all your python dependencies.
By installing your dependencies in a venv we ensure we will not pollute your system.
python -m venv venv
You can activate the venv using
. venv/bin/activate
You can now install all dependencies.
pip install mako cln-grpcio-tools -r plugin/clnrest/requirements.txt
Make and install Core Lighting
./configure
make
sudo make install