linien-org / linien

Spectroscopy lock application using RedPitaya
GNU General Public License v3.0
74 stars 19 forks source link

Add instructions of how to install Linien without internet connection #378

Open bleykauf opened 9 months ago

bleykauf commented 9 months ago

Along the lines of https://stackoverflow.com/questions/36725843/installing-python-packages-without-internet-and-using-source-code-as-tar-gz-and

doronbehar commented 3 months ago

OK so today I tried to tackle this today, and this SO Q&A was a bit more helpful for me. I encountered many issues along the way - some of them will be hard to fix and some of them I managed to easily workaround.

First of all, these PRs are important:

If all of the above will be accepted, and a new pyrp3 will get a new release one would be able to run the following 3 commands, given that pip-tools is available for the python in $PATH:

  1. On the machine with the internet connection, download .whl and .tar.gz files:
python -m pip download \
  --platform=linux-armv7l \
  --no-deps \
  linien-server==2.0.4 \
  --requirement <(python -m piptools compile \
    /path/to/linien/linien-server/pyproject.toml \
    --output-file - 2>/dev/null | sed \
      -e 's/^\(numpy==1.26.4\|six==1.16.0\|scipy==1.14.0\)/#\0 is available on the target host by the Debian distribution/g' \
  )

--no-deps is used because all dependencies are known thanks to the piptools compile output - which includes recursively all the dependencies of all dependencies. numpy, scipy and six are filtered out from that piptools compile output, because they are available already in the RedPitaya OS.

  1. Then send them to the target RedPitaya with:
scp *.whl *.tar.gz root@rp-XXXXXX.local:
  1. Install the server with pip and the offline packages on the target RedPitaya:
ssh root@rp-XXXXXX.local pip install --no-index --find-links . linien-server==2.0.4 --no-build-isolation

--no-build-isolation is needed for numpy, scipy, and six to be detected as already installed (as part of the RedPitaya OS).

  1. Enable the server's Systemd service with:
ssh root@rp-XXXXXX.local linien-server enable

Until the 3 PRs mentioned above are merged, steps 1 and 2 should be slightly modified:

python -m pip download \
  --platform=linux-armv7l \
  --no-deps \
  linien-server==2.0.4 \
  --requirement <(python -m piptools compile \
    <(curl \ 
      --silent \
      --location \
      https://github.com/doronbehar/linien/raw/pyrp3-all-platforms/linien-server/pyproject.toml \
    ) --output-file - 2>/dev/null | sed \
      -e 's/^\(numpy==1.26.4\|six==1.16.0\|scipy==1.14.0\)/#\0 is available on the target host by the Debian distribution/g' \
  )
rm pyrp3-2.0.1.tar.gz && python -m pip download --platform=linux-armv7l --no-deps git+https://github.com/doronbehar/pyrp3@no-setuptools_scm

And after step 2 run:

scp pyrp3-2.0.1.zip root@rp-XXXXXX.local:

And step 3 should work smoothly with the .zip (and not the .tar.gz file) file as well.