Embarcadero / PythonEnvironments

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

Apple M1 Install Gets Stuck #1

Closed peardox closed 2 years ago

peardox commented 2 years ago

The screenshot below is an M1 I rented for the day trying to install Python via PythonEnvironments

It's been stuck like that for hours now... Got the thing til tomorrow so I'll leave it going just in case...

I can see its installed a load of stuff in lib then stops at man

m1

peardox commented 2 years ago

Ooh (just got ssh working on the box - that helped)

Found the issue - activate.sh don't work (I think) - zsh shell...

peardox commented 2 years ago

OK - bad info - the PAServer window had the problem

It can't find libpython3.9.dylib - trying to fix

peardox commented 2 years ago

Found the problem - on a M1 it's installing an x64 dylib

> file python/3.9/lib/libpython3.9.dylib
python/3.9/lib/libpython3.9.dylib: Mach-O 64-bit dynamically linked shared library x86_64
peardox commented 2 years ago

Manually unzipped the correct file

> file python/3.9/lib/libpython3.9.dylib
python/3.9/lib/libpython3.9.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
python/3.9/lib/libpython3.9.dylib (for architecture x86_64):    Mach-O 64-bit dynamically linked shared library x86_64
python/3.9/lib/libpython3.9.dylib (for architecture arm64):     Mach-O 64-bit dynamically linked shared library arm64

That's more like it :)

But it still won't activate :(

Note that I'm installing Python in {$HOME}/SomeProject/python using a runtime created TPyEmbeddedResEnvironment39

PAServer says ...

> Error: Could not open DLL "libpython3.9.dylib'
> Python could not be properly activated. We must quit!

This explains why it works on my MacBook Pro (X64) but not on the Cloud Rented M1 Mini (Arm 64) - not sure whats wrong after manually unzipping the right dylib...

peardox commented 2 years ago

Running from command line without Delphi and the ETA on my job is 1 day 14 hours and 20 mins. Same job takes 105m on a 3060 and be still be quicker without (i.e. 8C/16T AMD 5900HX CPU only).

Having said that the Mac Mini only has 8Gb

Hmm - the CPUs are under-utilized - I'll have a play...

peardox commented 2 years ago

OK - much better...

The M1 needs a different method of turning GPU on - specify 'mps' where you'd usually use 'cpu' or 'cuda'.

It's giving me an ETA of 10 hours so my 3060 is 10 times faster than a M1 but the M1 is about twice as fast as my CPU

The Mac is only using about 4Gb ATM and the processors are only about 20% load which is annoying, My laptop goes crazy when training :)

Gonna try a Steam Deck in three months...:)

peardox commented 2 years ago

I've worked out what's happening

Delphi 10.4.2 CE don't do M1 compilation - that was a waste of a day...

peardox commented 2 years ago

So - will CE be able to compile a x64 version that works on a M1 now?

AWS just gave me $500 (just over a month) credit for a 16G M1 Mini

lmbelo commented 2 years ago

I can compile it for you, if you want so. You can also get a trial version so far.

lmbelo commented 2 years ago

Can I invalidate this one?

peardox commented 2 years ago

It's a closed issue anyway :)