GMaster
GMaster

Reputation: 1521

How to create standalone installer from pip package?

I am installing a pip package called SSLyze on CentOS offline like this

pip download SSLyze  # this downloads all the other pip dependencies as well in the same dir
pip install --no-index --find-links ./ SSLyze

The problem with this approach is I need to install gcc and a bunch of other packages for this to work. And also install time is long as gcc needs to compile the SSLyze source.

I would like to create a binary installer like SSLyze.run which will install everything offline. Is there any python tool to do so?

I have previously tried to created RPM from the SSLyze pip package and it ends up being a dependency nightmare; I ended up having to repackage lots of python packages from pip as the ones in CentOS official repo are too old to make SSLyze run.

Upvotes: 0

Views: 667

Answers (2)

GMaster
GMaster

Reputation: 1521

This is what I did:

On build host: install the required packages for building

yum install epel-release
yum install gcc  python2-pip python2-devel openssl-devel 
pip install wheel cryptography
pip install --upgrade setuptools

On the build host: build the wheel files for SSLyze and all its dependencies

pip wheel --wheel-dir=./sslyze_setup SSLyze==1.1.1

This will create all the *.whl files in sslyze_setup/ for offline installation

On the target host: copy all the files from build host inside sslyze_setup/ to the target host

yum install epel-release
yum install python2-pip
pip install --no-index --find-links=./sslyze_setup SSLyze

(Afterwards, rpm or deb file can be created from the files in sslyze_setup/)

Upvotes: 0

phd
phd

Reputation: 94397

PyInstaller or cx_Freeze generate binary installers.

pip wheel -r requirements.txt builds separate wheels for all requirements. The wheels can be moved to the offline host and installed.

Upvotes: 3

Related Questions