activity-browser
activity-browser copied to clipboard
Failing installation on Apple Silicon M1
I cannot install activity-browser. I have been trying from a new environment, but I get the following:
(base) romain@Romains-MBP ~ % conda create -n ab activity-browser
WARNING: A conda environment already exists at '/Users/romain/miniconda3/envs/ab'
Remove existing environment (y/[n])? y
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError:
(base) romain@Romains-MBP ~ % conda config --show channels
channels:
- conda-forge
- defaults
- cmutel
- bsteubing
- haasad
- pascallesage
It does not list any conflicting packages though, which does not help.
OS: macOS Monterey, Apple Silicon M1
May this have something to do with the OS, or the wheel not being available for Mac M1 chips?
After pinning the Python version, we get a little more info
(base) romain@Romains-MBP ~ % conda create -n ab_dev activity-browser-dev python=3.9
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
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 versions
Package python conflicts for:
python=3.9
activity-browser-dev -> arrow -> python[version='3.7.*|<3.7|>=2.7|>=3.6|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.10,<3.11.0a0|>=3.10,<3.11.0a0|>=3.5|>=3.7|>=3.9',build=*_cpython]
activity-browser-dev -> python[version='<3.8|<3.9|>=3.8|>=3.8,<=3.9']
(base) romain@Romains-MBP ~ %
The macOS github actions pipeline does not show this error and can create the environment: https://github.com/LCA-ActivityBrowser/activity-browser/runs/5042587092?check_suite_focus=true (the failure is unrelated)
Therefore I think it's possible that a package is missing for your M1 chip architecture, however the conda
output isn't very helpful. Have you installed the AB before on this machine? Could you try what happens with python 3.8?
No, it's the first time I try to install it.
Here's the output with Python 3.8:
(base) romain@Romains-MBP ~ % conda create -n ab activity-browser python=3.8
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
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 versions
Package python conflicts for:
python=3.8
activity-browser -> arrow -> python[version='3.7.*|<3.7|>=2.7|>=3.6|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.10,<3.11.0a0|>=3.10,<3.11.0a0|>=3.5|>=3.7|>=3.9',build=*_cpython]
activity-browser -> python[version='<3.8|<3.9|>=3.8|>=3.8,<=3.9']
But you can install your own packages and things like brightway2 without issues? Quick google search says there's a lot of issues with conda and M1 Macs. People are recommending https://github.com/conda-forge/miniforge, maybe worth a try?
Yes, so far, no issues encountered with any other things installed (incl. bw2). Will give miniforge a try and report back. Thanks!
Unfortunately, using miniforge for M1 architecture did not help. Same output.
(base) romain@Romains-MBP ~ % conda create -n ab activity-browser python=3.9
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
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 versions
Package python conflicts for:
python=3.9
activity-browser -> python[version='<3.8|<3.9|>=3.8|>=3.8,<=3.9']
activity-browser -> arrow -> python[version='3.7.*|<3.7|>=2.7|>=3.6|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.10,<3.11.0a0|>=3.10,<3.11.0a0|>=3.5|>=3.7|>=3.9',build=*_cpython]
Maybe a solution will arise in the future.
Is conda failing to resolve any of these commands?:
conda create --dry-run -n test arrow
conda create --dry-run -n test eidl
conda create --dry-run -n test pyside2
conda create --dry-run -n test matplotlib-base
matplotlib and arrow went through, but not eidl and pyside:
(base) romain@Romains-MBP ~ % conda create --dry-run -n test eidl
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError:
(base) romain@Romains-MBP ~ % conda create --dry-run -n test pyside2
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- pyside2
Current channels:
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/osx-arm64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-arm64
- https://repo.anaconda.com/pkgs/r/noarch
- https://conda.anaconda.org/cmutel/osx-arm64
- https://conda.anaconda.org/cmutel/noarch
- https://conda.anaconda.org/bsteubing/osx-arm64
- https://conda.anaconda.org/bsteubing/noarch
- https://conda.anaconda.org/haasad/osx-arm64
- https://conda.anaconda.org/haasad/noarch
- https://conda.anaconda.org/pascallesage/osx-arm64
- https://conda.anaconda.org/pascallesage/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Ok, looks like I finally have a good reason to replace https://github.com/haasad/eidl7zip with https://github.com/miurahr/py7zr. eidl7zip is a small helper package that allows to unpack the ecoinvent 7zip files cross-platform, but looks like my old hack finally broke on apple silicon. But fixing this should be straight-forward.
PySide2 is a whole other story though, this is the whole Qt stack that the activity-browser is built upon for the GUI. According to https://www.qt.io/blog/qt-on-apple-silicon there is support for Qt 6.2+, however pyside2 is based on Qt 5. I assume the activity-browser would have to be rewritten for Qt 6.2 and pyside6 to support apple M1. Major roadblock there is that pyside6 is so far only available on PyPI and not on conda from what I can tell. I can try and make an experimental branch for the AB with pyside6 and see if it works with the pip pyside6, but I assume there are some breaking changes between Qt 5 and Qt 6.
thanks @haasad for looking into this. It does sound like a lot of work for a very small number of users at the moment. I can find a solution in the meanwhile and use AB on another computer. But certainly the number of users using those chips in a year or so will increase.
But certainly the number of users using those chips in a year or so will increase.
It only took half a day until somebody else approached me with problems on a M1 Macbook :smiley:
Could you please check for me if you can install brightway with conda?
conda create --dry-run -n test brightway2
I'm pretty sure it shouldn't work, unless you only install brightway's components individually without using the brighway2 metapackage. Reason being that it has dependency on pypardiso
which in turn needs mkl
. mkl
is the Intel Math Kernel Library and I assume Intel won't make it available for Apple Silicon as their direct competitor.
Indeed, it cannot be installed via conda (but via pip). I guess that's because bw2calc resorts to using scipy if it cannot get pypardiso when installing it from pip, isn't?
bw2calc doesn't have a dependency on pypardiso, only the conda brightway2 metapackage does: https://github.com/cmutel/conda-recipes/blob/c7299f103cdd5bbc19d9bc4e282e2c7b63e25c59/brightway2/meta.yaml#L35
bw2calc: https://github.com/cmutel/conda-recipes/blob/master/bw2calc/meta.yaml
For a long time MKL was only available from conda and for this reason only the conda brightway2 metapackge uses it, but not the PyPI one.
Hi @romainsacchi,
I read up some more on apple silicon and from what I understood it should be possible to run the activity browser with the rosetta emulation, i.e. applications built for the old intel chip architecture should automatically be run with the rosetta emulation layer. In the case of the activity browser that would mean that all packages have to use the old intel architecture, because you can't mix packages built for x86_64
and arm64
.
Would you be so kind and test if this works?:
CONDA_SUBDIR=osx-64 conda create -n ab_rosetta python=3.9
conda activate ab_rosetta
conda env config vars set CONDA_SUBDIR=osx-64
conda install activity-browser-dev
It's interesting. After installing rosetta I proceeded to conda-install activity-browser and things installed well.
Unfortunately, I get a MKL-related error that prevents launching the AB
(ab_rosetta) romain@Romains-MBP ~ % activity-browser
Intel MKL FATAL ERROR: This system does not meet the minimum requirements for use of the Intel(R) Math Kernel Library.
The processor must support the Intel(R) Supplemental Streaming SIMD Extensions 3 (Intel(R) SSSE3) instructions.
The processor must support the Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) instructions.
The processor must support the Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.
Maybe I'm wrong but this has more to do with bw2calc
than AB, right?
If bw2io
can work without pypardiso
(and the underlying MKL solvers), then maybe I can have AB working with bw2io
and scipy
, can't I?
What happens if you pip install brightway2
before installing the activity-browser?
And yes, if it's only an MKL problem, then bw2calc
should be able to run with the scipy solver
So, I started anew and pip-installed brightway
, which go me the following:
# Name Version Build Channel
activity-browser-dev 2019.10.30 py_0 bsteubing
appdirs 1.4.4 pyh9f0ad1d_0 conda-forge
arrow 1.2.2 pyhd8ed1ab_0 conda-forge
asteval 0.9.26 pypi_0 pypi
astunparse 1.6.3 pyhd8ed1ab_0 conda-forge
beautifulsoup4 4.10.0 pyha770c72_0 conda-forge
brightway2 2.4.1 pypi_0 pypi
brotli 1.0.9 h0d85af4_6 conda-forge
brotli-bin 1.0.9 h0d85af4_6 conda-forge
brotlipy 0.7.0 py39h89e85a6_1003 conda-forge
bw-migrations 0.2 pypi_0 pypi
bw2analyzer 0.10 pypi_0 pypi
bw2calc 1.8.0 pypi_0 pypi
bw2data 3.6.2 pypi_0 pypi
bw2io 0.8.6 pypi_0 pypi
bw2parameters 0.7 pypi_0 pypi
bw_migrations 0.1 py_0 cmutel
bw_processing 0.7.1 py_0 cmutel
and then I did:
conda env config vars set CONDA_SUBDIR=osx-64
conda install activity-browser-dev
but i now get the following:
import brightway2 as bw
File "/opt/homebrew/Caskroom/miniforge/base/envs/ab_rosetta/lib/python3.9/site-packages/brightway2/__init__.py", line 3, in <module>
from bw2calc import *
AttributeError: module 'bw2calc' has no attribute 'ComparativeMonteCarlo'
It seems conda did not fetch the latest version of AB though (2021.11.17).
Yes, that looks like a really old AB version, strange ...
conda install activity-browser-dev=2021.11.17
maybe?
It updated fine:
# Name Version Build Channel
activity-browser-dev 2021.11.17 pypy_0 bsteubing
appdirs 1.4.4 pyh9f0ad1d_0 conda-forge
arrow 1.2.2 pyhd8ed1ab_0 conda-forge
asteval 0.9.26 pypi_0 pypi
astunparse 1.6.3 pyhd8ed1ab_0 conda-forge
beautifulsoup4 4.10.0 pyha770c72_0 conda-forge
brightway2 2.4.1 pypi_0 pypi
brotli 1.0.9 h0d85af4_6 conda-forge
brotli-bin 1.0.9 h0d85af4_6 conda-forge
brotlipy 0.7.0 py39h89e85a6_1003 conda-forge
bw-migrations 0.2 pypi_0 pypi
bw2analyzer 0.10 pypi_0 pypi
bw2calc 1.8.0 pypi_0 pypi
bw2data 3.6.2 pypi_0 pypi
bw2io 0.8.6 pypi_0 pypi
bw2parameters 0.7 pypi_0 pypi
bw_migrations 0.1 py_0 cmutel
bw_processing 0.7.1 py_0 cmutel
but same error:
from .activity import ActivityController, ExchangeController
File "/opt/homebrew/Caskroom/miniforge/base/envs/ab_rosetta/lib/python3.9/site-packages/activity_browser/controllers/activity.py", line 5, in <module>
import brightway2 as bw
File "/opt/homebrew/Caskroom/miniforge/base/envs/ab_rosetta/lib/python3.9/site-packages/brightway2/__init__.py", line 3, in <module>
from bw2calc import *
AttributeError: module 'bw2calc' has no attribute 'ComparativeMonteCarlo'
bw2calc
is up-to-date (1.8.0), and I do not understand if something is trying to import ComparativeMonteCarlo
form it.
brightway2
is also up-to-date (2.4.1).
what does python -c "import brightway2 as bw"
say? same error?
Yep
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/homebrew/Caskroom/miniforge/base/envs/ab_rosetta/lib/python3.9/site-packages/brightway2/__init__.py", line 3, in <module>
from bw2calc import *
AttributeError: module 'bw2calc' has no attribute 'ComparativeMonteCarlo'
So something is wrong with the pip installed brightway, which make no sense at all to me :man_shrugging:
Maybe try again from scratch with:
conda deactivate
CONDA_SUBDIR=osx-64 conda create -n ab_rosetta2 python=3.9
conda activate ab_rosetta2
pip install brighway2
conda env config vars set CONDA_SUBDIR=osx-64
conda install activity-browser-dev=2021.11.17
So I tried:
python -c "import brightway2 as bw"
after doing:
conda deactivate
CONDA_SUBDIR=osx-64 conda create -n ab_rosetta2 python=3.9
conda activate ab_rosetta2
pip install brighway2
and I got the error (so, before even installing activity-browser
).
This is weird, because I remember being able to install and do calculaitons with BW (but it was using scipy, so it was pretty slow). But now it seems this fails too.