Embarcadero / PythonEnvironments

Components to simplify the deployment for Python environments for Delphi applications using Python4Delphi.
MIT License
44 stars 15 forks source link

Branch pyupgrade report #24

Closed peardox closed 2 years ago

peardox commented 2 years ago

Works great so far (yet to give it the harder tests)

Windows x64 runs as normal with newer Python 3.9.15 (only version tested)

Linux x64 runs great on the build box as does my PR for GetPIP - need to see what other Linux distros think of it, got Arch x64 x2 - One a laptop with latest and one older one on Steam Deck. Also want to try running in a clean VM with Ubu 20.04 + 22.04 (build box is 22.04)

Linux images...

image Note this is the FIRST time this has worked without me having to hack around with the system to firnd missing libs

The next image is a re-run - rather similar (expected) but note the PIP version is now 22.3

image

I'll try other Distros in the AM (02:30 here - been at it all day, rest time)

Looks like a good candidate for moving to main to me

peardox commented 2 years ago

Oh - just noticed a Python error - this is NOT PythonEnvironment in any way - that's 'cos the thing's running on a really old GPU that doesn't support some things

peardox commented 2 years ago

Well, bed in a bit...

Steam Deck - Delphi issue probably fixed by using 20.04 as a buildbox - I'll make one in the AM

image

It seems to be running on the Arch box but that things dead old so waiting for results - newer OS must have the required GLIBC

peardox commented 2 years ago

Slow machine eventually finished image

This is the same executable on an Arch Laptop (which will become a Ubu 20.04 Laptop in some hours) - Static seems to be working really well then

lmbelo commented 2 years ago

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Linux_Application_Development

peardox commented 2 years ago

Yeah, read all that months ago. Looked into Flatpak as a workaround - whole different set of problems - wan't a makefile...

Ubuntu 20.04 looks like it will work as a base build target (can't use Arch - the proper target - not recognosed by Delphi) for Steam Deck now Python is static - about to find out.

peardox commented 2 years ago

Yaayyy! Added 20.04 to buildbox (now dual Linux boot) and compiled up 20.04 version of SimplePython test then copied just the executable to Steam Deck and...

image

Good result!

peardox commented 2 years ago

Rats - Lartis fails owing to bzip2 compatability

Checking StackOverflow this appears to be a common issue

This can, however, be a misleading report as it could be another dependancy of _bz2 causing a bad error report

peardox commented 2 years ago

This looks helpful https://github.com/indygreg/python-build-standalone

lmbelo commented 2 years ago

I too want a Steam Deck.

lmbelo commented 2 years ago

Rats - Lartis fails owing to bzip2 compatability

Checking StackOverflow this appears to be a common issue

This can, however, be a misleading report as it could be another dependancy of _bz2 causing a bad error report

Share your error then.

peardox commented 2 years ago

I too want a Steam Deck. I was lucky, the government gave some people without a "job" 650 GBP in two parts. That was enough to get the mid-range Steam Deck with a Dock and some other stuff. They are, however, not really up to running AI to be honest as the GPU is AMD (I'd hoped ROCm yould work - it doesn't).

Share your error then.


Traceback (most recent call last):
File "<string>", line 21, in <module>
File "/home/deck/.Lartis/pysrc/mlfuncts.py", line 11, in <module>
from torchvision import datasets
File "/home/deck/.Lartis/python/3.9/lib/python3.9/site-packages/torchvision/__init__.py", line 5, in <module>
from torchvision import datasets
File "/home/deck/.Lartis/python/3.9/lib/python3.9/site-packages/torchvision/datasets/__init__.py", line 1, in <module>
from ._optical_flow import KittiFlow, Sintel, FlyingChairs, FlyingThings3D, HD1K
File "/home/deck/.Lartis/python/3.9/lib/python3.9/site-packages/torchvision/datasets/_optical_flow.py", line 13, in <module>
from .utils import verify_str_arg
File "/home/deck/.Lartis/python/3.9/lib/python3.9/site-packages/torchvision/datasets/utils.py", line 1, in <module>
import bz2
File "/home/deck/.Lartis/python/3.9/lib/python3.9/bz2.py", line 18, in <module>
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
Import Exception in RunSystem
Class : EPyImportError
Error : ModuleNotFoundError: No module named '_bz2'
Value : No module named '_bz2'
Name : ModuleNotFoundError
RunSystem Completed


I _think_ that compiling the Python on an distro may help as the main Delphi worked fine on the deck - i'll give it a go to see what happens.
peardox commented 2 years ago

Here's a slightly more specific error report by running the embedded manually

Note ./py is a copy of activate.sh with bin/python3.9 added to the end to manually start Python

(deck@steamdeck 3.9)$ ./py Python 3.9.15 (main, Oct 15 2022, 19:07:07) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. import bz2 ### I typed this ### Traceback (most recent call last): File "", line 1, in File "/home/deck/.Lartis/python/3.9/lib/python3.9/bz2.py", line 18, in from _bz2 import BZ2Compressor, BZ2Decompressor ModuleNotFoundError: No module named '_bz2'

peardox commented 2 years ago

After some hacking around I got a version that sorta works on deck - lzma may be an issue - can't be sure, haven't tried the stuff that causes that (yet)

From Python build docs

At the end of the build you should see a success message, possibly followed by a list of extension modules that haven�t been built because their dependencies were missin

Python build finished successfully! The necessary bits to build these optional modules were not found: _bz2 _dbm _gdbm _lzma _sqlite3 _ssl _tkinter _uuid readline zlib

And...

sudo apt-get install build-essential gdb lcov pkg-config \ libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \ libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \ lzma lzma-dev tk-dev uuid-dev zlib1g-dev

So I did that and copied the missing _bz2.cpython-39-x86_64-linux-gnu.so to the deck's lib/python3.9 dir and it all worked fine again.

I have previously seen missing lzma related stuff when testing on Mac as well

lmbelo commented 2 years ago

bzip2 is included as dependency in the CI

https://github.com/lmbelo/python3-embeddable/blob/7c38c613ea39caf1948684ce73681438494c509e/python3-linux/Linux/build_deps.py#L41

lmbelo commented 2 years ago

I found the error. I'm fixing it.

peardox commented 2 years ago

Well, installing with the pyupgrade branch it errored as above - do I need a different branch?

peardox commented 2 years ago

Cool

lmbelo commented 2 years ago

Update it and retry.

lmbelo commented 2 years ago

I will remove TK from the macOS package, it will lean out the final zip file.

peardox commented 2 years ago

Updated and retried - perfect

May as well release it unless you need anything else checking

Possibly add Update GetPIP PR?

peardox commented 2 years ago

Python on Linux Steam Deck... image

peardox commented 2 years ago

Can you promote pyupgrade to main please - I just got proper 11.2 and I've just installed the version with broken Linux

Accepting the getpip upgrade property code would also help

peardox commented 2 years ago

I also note that Python 3.11 has just gone public release - definitely a good time to update this repo

lmbelo commented 2 years ago

@peardox new changes were just merged. I will release a new version as we get cp3.11 working.

peardox commented 2 years ago

@lmbelo What changed are there? There's no fixes list I can see.

I notice samples is new

lmbelo commented 2 years ago

Fix list will be displayed in new releases

peardox commented 2 years ago

Got a little weekly household stuff to do, will start a fresh test when that's done.

I've been playing with finding all Installed Components to improve my https://github.com/peardox/MakeP4DComponents (reading Registry - not ToolsApi)

It looks like the stuff I'm doing there might be good for a P4D Suite install useful as well as I'm identifying things that go wrong when installing

peardox commented 2 years ago

Closing this cos we're on a new branch