Please, help me to switch to the Python 3.10 under macOS environment!

gdalik's Avatar

gdalik

07 Feb, 2024 01:26 PM

Hello everyone!

I'm not a professional coder, it's my hobby and passion.
But I've created an Open Source app for ear training on equalization, written in Python.
I build the binaries successfully for Windows and for macOS (x86_64) on my local computers with PyInstaller, with my spec files, running pyinstaller macos_build.spec or pyinstaller windows_build.spec correspondingly.

Though, I'm quite new to AppVeyor, I could build the Windows part of my recent release with it.

But unfortunately, I couldn't do the same on macOS environment.
I really need that, because my goal is to build a release both for x86_64 (Intel) and arm64 (Apple Silicon) platforms. I tried to do this for Intel first, because I own mac mini with i7, and I can test the binary manually.

The current codebase is adapted to Python 3.9 and 3.10. I do not know all the upcoming pitfalls yet, but the first problem I encountered with was that I simply couldn't switch from Python 3.8.9 to one of above-mentioned. Unlike the instructions for Windows, the macOS part of the documentation declares, that Python 3.10.8 is installed, but it has no paths.

I tried the following ones with no luck:

/Library/Frameworks/Python.framework/Versions/3.10
/Applications/Xcode-13.2.1.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.10

I tried several different settings like this:

image: macos-bigsur
environment:
  matrix:
    - PYTHON: "/Applications/Xcode-13.2.1.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.10"
      PYTHON_VERSION: "3.10.11"
      PYTHON_ARCH: "64"
init:
  - export PATH="$PYTHON:$PYTHON/bin:$PATH"

No luck...

I even tried to use python3.10 command instead of python or just python3, and it says:

/usr/local/Cellar/appveyor-build-agent/7.0.3212/bash-shell.sh: line 51: python3.10: command not found

I would appreciate your help!

Thanks in advance!!!

Best,
Gdaliy.

  1. Support Staff 1 Posted by Owen McDonnell on 07 Feb, 2024 10:31 PM

    Owen McDonnell's Avatar

    Did you try locating the desired python binary at $HOME/venv3.10 as is done on linux builds?
    Also, I see you have the command pip -U install... but -U is an option for the install command so should come after.

  2. 2 Posted by gdalik on 07 Feb, 2024 11:15 PM

    gdalik's Avatar

    No, I haven't. I'm not familiar with Linux at all...
    Could you give me the right settings for YAML file, please?

    As for pip -U install, yeah, right you are, thanks!

    --

    UPD:
    I have just built an artifact, installing Python 3.10 from scratch with homebrew (under macos-monterey) and creating the Python virtual environment:

    install:
      - brew install python@3.10
      - python3 -m venv venv
      - source venv/bin/activate
      - python3 -m pip install -r requirements.txt
      - python3 -m pip install -U pyinstaller
      - pyinstaller macos_build.spec
    

    But there are two issues:
    - The smaller one is that the installation takes too much time;
    - And the bigger one is that the AppVeyor macOS environment seems to have issues with symlinks. In the cases when PyInstaller (the same version, the same *.spec file) normally creates symlinks, it duplicates the files instead. So, the resulting *.app bundle is three times bigger than it should be, and it doesn't work...

    This case is described in PyInstaller documentation:

    Failing to preserve symbolic links will turn them into full file copies; the duplicated > files will balloon the size of your frozen application, and may also lead to run-time issues.

    Should I create a separate ticket for that?

    Thanks again!

  3. 3 Posted by gdalik on 08 Feb, 2024 12:30 AM

    gdalik's Avatar

    And also, I didn't understand, how I could locate the desired python binary anywhere inside your virtual machine, if I don't know your macOS python paths... They are not documented. I tried to guess them with no success...

  4. 4 Posted by gdalik on 08 Feb, 2024 01:07 AM

    gdalik's Avatar

    UPD:

    $HOME/venv3.10/bin/activate
    /usr/local/Cellar/appveyor-build-agent/7.0.3212/bash-shell.sh: line 51:
    /Users/appveyor/venv3.10/bin/activate: Permission denied
    Command exited with code 126
    Build failed

  5. 5 Posted by gdalik on 08 Feb, 2024 01:28 AM

    gdalik's Avatar

    Finally, this worked!

    • chmod +x $HOME/venv3.10/bin/activate
    • source $HOME/venv3.10/bin/activate
  6. gdalik closed this discussion on 08 Feb, 2024 02:48 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM
20 Sep, 2024 05:50 PM