Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing using Conda on macOS 14.0 Apple Silicon fails #611

Open
moe93 opened this issue Oct 26, 2023 · 13 comments
Open

Installing using Conda on macOS 14.0 Apple Silicon fails #611

moe93 opened this issue Oct 26, 2023 · 13 comments

Comments

@moe93
Copy link

moe93 commented Oct 26, 2023

Using conda install -c conda-forge fmpy to install fmpy, the following error message is produced:

$ conda install -c conda-forge fmpy

Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your system:

  • feature:/osx-arm64::__osx==14.0=0
  • feature:|@/osx-arm64::__osx==14.0=0
  • fmpy -> matplotlib-base -> __osx[version='>=10.9']

Your installed version is: 14.0

I have Miniconda installed through homebrew, using macOS 14.0 M1 Pro.

@t-sommer
Copy link
Contributor

Can you try python -m pip install fmpy to install from PyPI?

@moe93
Copy link
Author

moe93 commented Oct 26, 2023

Using pip install fmpy[complete] fails with no matches found.

Using pip install fmpy works but then I have to manually install all the PyQt dependancies, which eventually fails as well because it keeps complaining about a bunch of Qt platform plugins that I am not even sure how to start on hacking around to get it to work.

@t-sommer
Copy link
Contributor

Can you install PySide6 on Apple Silicon? I'm asking because we're considering switching and this would be another reason to do so.

@moe93
Copy link
Author

moe93 commented Oct 27, 2023

It seems that PySide6 is available as a brew install for Apple Silicon. I will attempt installation tomorrow and will update you here.

@moe93
Copy link
Author

moe93 commented Oct 27, 2023

PySide6 installs successfully on Apple Silicon, I have no issues running it in a venv/conda environments. However, running fmpy.gui still fails

@jschueller
Copy link

conda-forge relies on the .whl for now which doesnt have the required binaries anyway
we will need #617 and #619 to be resolved until we can build from source on conda-forge

@valerianoCarlos
Copy link

Hi are there any updates on the fmpy.gui support for Apple Silicon? I was trying to run it after installing fmpy but I am getting the same errors cited above regarding PyQt5.

@davedawkins
Copy link

Adding a "me too", please

@davedawkins
Copy link

davedawkins commented Sep 11, 2024

This seems to be working for me, in that the main window appears and allows me to choose an FMU:

pip install fmpy
pip install PyQt5
pip install PyQtWebEngine
pip install pyqtgraph

Apple M3 Pro

[] fmu % pip --version
pip 24.2 from /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pip (python 3.12)
[] fmu % python3 --version
Python 3.12.0

@i-mein
Copy link

i-mein commented Sep 21, 2024

I have a similar issue working on Macos M3 max. I can install fmpy with pip properly, load the sample FMU (Rectifier.fmu) and print the info with dump() but fails in the simulation part. Any ideas why?

arch: M3 max (sonoma 14.6)

Steps to reproduce the issue:

  1. create new conda env

conda create --name dev_cosim python=3.12

  1. install python packages with pip
pip install fmpy  # 3.21.0
pip install PyQt5
pip install PyQtWebEngine
pip install pyqtgraph
  1. run simulation

python src/run_simulation.py

where it fails here

from fmpy import *
model_name = 'Rectifier.fmu'

res = simulate_fmu(model_name)

OSError: dlopen(/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib, 0x0006): tried: '/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (no such file), '/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/private/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (no such file), '/private/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/ime/Work/Cardimed-DigitalTwin/src/run_simulation.py", line 46, in
res = simulate_fmu(fmu_path)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ime/miniconda3/envs/dev_cosim/lib/python3.12/site-packages/fmpy/simulation.py", line 741, in simulate_fmu
fmu = instantiate_fmu(unzipdir, model_description, fmi_type, visible, debug_logging, logger, fmi_call_logger, None, early_return_allowed, use_event_mode, None, validate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ime/miniconda3/envs/dev_cosim/lib/python3.12/site-packages/fmpy/simulation.py", line 823, in instantiate_fmu
fmu = FMU2Slave(**fmu_args)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ime/miniconda3/envs/dev_cosim/lib/python3.12/site-packages/fmpy/fmi2.py", line 524, in init
super(FMU2Slave, self).init(**kwargs)
File "/Users/ime/miniconda3/envs/dev_cosim/lib/python3.12/site-packages/fmpy/fmi2.py", line 85, in init
super(_FMU2, self).init(**kwargs)
File "/Users/ime/miniconda3/envs/dev_cosim/lib/python3.12/site-packages/fmpy/fmi1.py", line 166, in init
raise Exception("Failed to load shared library %s. %s" % (libraryPath, e))
Exception: Failed to load shared library /var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib. dlopen(/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib, 0x0006): tried: '/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (no such file), '/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/private/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (no such file), '/private/var/folders/_r/x3qbsnyx5sj0skt7yc133npr0000gn/T/tmphzdnybcu/binaries/darwin64/Rectifier.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))


the FMU object info in case it helps

print(dump(model_name))

Model Info

FMI Version 2.0
FMI Type Co-Simulation
Model Name Rectifier
Description Model Rectifier
Platforms darwin64
Continuous States 4
Event Indicators 6
Variables 63
Generation Tool MapleSim (1357016/1357197/1357197)
Generation Date 2018-10-25T13:27:45Z

Default Experiment

Stop Time 0.1
Step Size 1e-07

Variables (input, output)

Name Causality Start Value Unit Description
outputs output 2.82842712474619020e+02 V Rectifier1.Capacitor1.v

@davedawkins
Copy link

I'm not an expert with FMU by any definition, but I think that's because the model you've loaded didn't target arm:

but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

@i-mein
Copy link

i-mein commented Sep 21, 2024

I'm not an expert with FMU by any definition, but I think that's because the model you've loaded didn't target arm:

but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

thanks for your response. That is my doubt as well, but I confirm I have have downloaded the FMU from the indicated dir 'macos' as per instructions. Actually in the info above it is shown

Platforms darwin64

Additionaly, when I try to load a win64 compatible FMU the error is clear

Exception: The FMU cannot be simulated on the current platform (darwin64).

From my understanding it has something to do with the shared library when trying to read fm1.py

/fmpy/fmi1.py", line 166, in init
raise Exception("Failed to load shared library %s. %s" % (libraryPath, e))
Exception: Failed to load shared library

but can't figure out what exactly fails

@jbernalr
Copy link

@i-mein macos and darwin64 do not refer to processor architectures but to an operating system.
you can have macos and darwing running on x86-64.
Recompile for 'arm64e' or 'arm64'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants