openpreserve / jpylyzer

JP2 (JPEG 2000 Part 1) validator and properties extractor. Jpylyzer was specifically created to check that a JP2 file really conforms to the format's specifications. Additionally jpylyzer is able to extract technical characteristics.
http://jpylyzer.openpreservation.org/
Other
69 stars 28 forks source link

FEAT - Multi-architecture, multi-Python builds #151

Closed carlwilson closed 4 years ago

carlwilson commented 4 years ago
carlwilson commented 4 years ago

64bit and 32bit builds for Python 2 & 3 from a single Docker container :)

bitsgalore commented 4 years ago

Just merged this, but I do have some questions:

  1. Running ./docker-package.sh from the project dir results in:
You MUST provide a docker image name

If I then I do something like ./docker-package.sh test I get this:

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
ERRO[0000] failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial unix /var/run/docker.sock: connect: permission denied 
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/build?buildargs=%7B%22CODENAME%22%3A%22test%22%2C%22DIST_ID%22%3A%22test%22%2C%22PKGNAME%22%3A%22jpylyzer%22%2C%22VERSION%22%3A%222.0.0rc1%22%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile.build&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=1q3kvdqmg56y69rky3kol8r2t&shmsize=0&t=jpylyzer-test-test&target=&ulimits=null&version=1: dial unix /var/run/docker.sock: connect: permission denied

Not sure what exactly is causing this (I have Docker installed on my machine)

  1. I'm also wondering why we would need a build process for Python 2 at all, as Python 2 will be retired in 2 months time.

  2. Looking here I also see that there are two separate Debian packages for Python 2 and Python 3. Do we really this?

  3. As for naming: to avoid confusion with the existing python-jpylyzer packages I'd suggest to go for something like opf-jpylyzer-*, and then perhaps see if we can co-ordinate things with the maintainers of python-jpylyzer.

  4. I don't really have a preference for including/excluding the docs in the main package. Maybe combining them is simpler?

bitsgalore commented 4 years ago

Here's another problem: I just unzipped the 64-bit Windows binaries created by Python 3 (jpylyzer_2.0.0rc1_Python3_win64.zip) to my Windows machine, which is running Windows 7. When I execute jpylyzer.exe, I get this:

Error loading Python DLL 'c:\temp\jpylyzer\python35.dll'.
No error messages generated.
FormatMessageW: The parameter is incorrect.
LoadLibrary: PyInstaller: FormatMessageW failed.

Same for the 32-bit binaries (the binaries created with Python 2 work fine).

After a bit of searching I found this, which looks very similar (assuming this issue is specific to Windows 7, but I cannot test that as it is the only Windows version I have access to):

https://github.com/cdrx/docker-pyinstaller/issues/15

carlwilson commented 4 years ago

Hi @bitsgalore to build the windows images you still need to supply parameters to the build script, i.e. /docker-package-win.sh debian:stretch. I confess that I only tested the packages on Windows 10.

bitsgalore commented 4 years ago

Hi @carlwilson OK, so I just ran ./docker-package-win.sh debian:stretch. Result:

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
ERRO[0000] failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial unix /var/run/docker.sock: connect: permission denied 
context canceled

In addition: what are the possible/allowed values for the build platform? Also, it's a bit confusing that the error message shown by the script asks for a "docker image name" whereas it actually needs the build platform. Or perhaps this is just because I'm not really familiar with docker.

carlwilson commented 4 years ago

Hi @bitsgalore the solution to your socket problem is here: https://docs.docker.com/install/linux/linux-postinstall/ you basically need to create a docker group on linux and add yourself to it, then no more sudo docker...

bitsgalore commented 4 years ago

Maybe I missed something but I thought that the issue with the python35.dll had been fixed in the run-up to the pre-release. However I just re-ran the Docker file that builds the Windows executables, and I'm still getting executables that result in this error on my Windows 7 machine.

In addition I see that the Docker file builds executables using both Python 2.7 and Python 3.5; I was under the impression that the Python 2.7 builds had been dropped. Or am I somehow running an old version of the script (which I can't imagine since I'm running it from the current jpylyzer-2-dev branch)?

bitsgalore commented 4 years ago

Update: just had another look at the RC binaries here and I see these were built with Python 3.6, whereas the Docker file still uses Python 3.5. So I suppose these were built using some changes that were never committed? I also vaguely recall @carlwilson mentioning something about an issue with Python 3.6, but I don't remember any specifics. As a test I tried to modify the Docker file so it uses Python 3.6, but that results in an error while unzipping the Python 3.6 installer.