vpype: vpype[all] can't be installed on Mac OSX on ARM based Macs (M1)

Edit by @abey79:

Thanks to MacPorts now properly supporting pyside2 and its dependences (in particular qt5-qtwebengine, thanks @chrstphrchvz!), this issue is now resolved. The install procedure is as follows:

Install/upgrade MacPorts

If you don’t have MacPorts installed, install it from here. You will need to install Xcode if you haven’t already.

If you had MacPorts previously installed, make sure its package database is up-to-date:

sudo port selfupdate
sudo port upgrade outdated

Install required packages

sudo port install python39 py39-shapely py39-scipy py39-numpy py39-pyside2

(optional) Make Python 3.9 the default interpreter

This is not strictly necessary, but this step will make python point towards MacPorts’ Python 3.9.x.

sudo port select --set python python39

Create a virtual environment for vpype

cd path/where/the/venv/should/be
/opt/local/bin/python3.9 -m venv vpype_venv --system-site-packages

Important: note the use of --system-site-packages. This will make the MacPorts-installed package (in particular pyside2) available to the virtuel environment. This is critically important because pip is unable to install PySide2 on arm64 Macs (this will likely never change).

Using the full path for the python interpreter is not needed if python points to the right interpreter (ie. you did the previous step and your PATH is not messed up.

Activate the virtual environment and install vpype

source vpype_venv/bin/activate
pip install "vpype[all]"

Check that the install was successful:

vpype random show

original message by @theomega

This is very likely not vpypes fault, but you can’t install vpype using pip on Mac OSX if your machine is one of the new m1 based arm machines.

Reason is that the PySides2 package can’t be installed on these machines as there is no official port of QT python bindings for the M1 yet.

Error Message:

ERROR: Cannot install vpype[all]==1.4.0, vpype[all]==1.5.0, vpype[all]==1.5.1, vpype[all]==1.6.0 and vpype[all]==1.7.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    vpype[all] 1.7.0 depends on PySide2<6.0.0 and >=5.15.2; extra == "all"
    vpype[all] 1.6.0 depends on PySide2<6.0.0 and >=5.15.2
    vpype[all] 1.5.1 depends on PySide2<6.0.0 and >=5.15.2
    vpype[all] 1.5.0 depends on PySide2<6.0.0 and >=5.15.2
    vpype[all] 1.4.0 depends on PySide2<6.0.0 and >=5.15.2

Manual install of PySide2:

$ pip install PySide2
ERROR: Could not find a version that satisfies the requirement PySide2 (from versions: none)
ERROR: No matching distribution found for PySide2

Some more information can be found on the QT Forum here: https://forum.qt.io/topic/124289/mac-m1-pyside-2-6-can-t-install-lib

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (18 by maintainers)

Most upvoted comments

Edit: updated required package list based on @abruto’s feedback. Edit: added forced submodule updated based on @abruto’s feedback.

I just managed to get everything running on Monterey/M1 using the following procedure

TL;DR

  • Python, Qt5 and librairies from MacPorts
  • PySide2 5.15.2 compiled from source

Install/upgrade MacPorts

If you don’t have MacPorts installed, install it from here. You will need to install Xcode if you haven’t already.

If you had MacPorts previously installed, make sure its package database is up-to-date:

sudo port selfupdate
sudo port upgrade outdated

Install required packages

sudo port install python39 qt5 py39-shapely py39-scipy py39-numpy llvm-13 clang-13 cmake

Create a virtual environment for vpype

cd path/where/the/venv/should/be
/opt/local/bin/python3.9 -m venv vpype_venv

Note the use of the full path for the python interpreter to ensure that the good one is actually used for the venv.

Build PySide2 from source

Checkout PySide2 source:

git clone --recursive https://code.qt.io/pyside/pyside-setup
cd pyside-setup
git checkout 5.15.2
git submodule update --init

Build PySide2 and install it in your virtual environment. CAUTION: the vpype_venv virtual environment must be activated before running this command!

CLANG_INSTALL_DIR=/opt/local/libexec/llvm-13 python setup.py install --qmake=/opt/local/libexec/qt5/bin/qmake --build-tests --ignore-git --parallel=8 --reuse-build

Install vpype

pip would fail installing PySide2 but, since it is already installed, it will simply skip it and the regular install should work:

pip install vpype[all]

Check that the install was successful:

vpype random show

PySide2 is now available in MacPorts 🥳 I’ve put the updated installation instruction in the top comment and pinned this issue for visibility.

scipy 1.7.3 with arm binaries has been released yesterday 🎉

FYI, I just got a new M1 Max MBP and I’m actively researching this issue. My current understanding is that the situation will take some time to fully normalise, but there may be ways to get this sorted “manually” in the mean time. I’ll post here whenever I have such a method sorted out.

WIP notes/pointers:

  • The official Qt 6.2.1 distribution is intel/apple universal, but 5.15.2 is not.
  • I already managed to build pyside6 from source based on the official qt build. Next: make a branch of vpype based on PySide6.
  • edit: pyside6-based vpype is tricky as the integration with ModernGL must be adapted
  • My attempt to build pyside2 from source failed.
  • qt6 in MacPorts in in the work: macports/macports-ports#12676
  • my attempts with installing pyside2 with Homebrew failed

@abey79 Got it. I was actually missing geos which was causing Shapely not to install. I had to run:

brew install geos

Excited to get the full vpype[all] installed when the libraries have better support for M1. Thanks for your work!

Yes, I could successfully build Pyside2 and install vpype. Thank you for the support!

Well I’m not sure what else to suggest then. The ARM scipy release is likely imminent (https://github.com/scipy/scipy/issues/13409#issuecomment-974681045). In the mean time, one work around is to pip install vpype matplotlib and use the classic viewer.