brightway-lca / brightway2-calc

The calculation engine for the Brightway2 life cycle assessment framework.
BSD 3-Clause "New" or "Revised" License
14 stars 16 forks source link

`bw2calc` does not recognize `scikit-umfpack` installation on macOS (ARM) #112

Closed michaelweinold closed 6 days ago

michaelweinold commented 2 weeks ago

Following the installation instructions

conda create -n bw25arm -c conda-forge -c cmutel brightway25_nosolver scikit-umfpack ipykernel

and running

import bw2calc as bc

returns

[/opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/bw2calc/__init__.py:45](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/bw2calc/__init__.py:45): UserWarning: 
It seems like you have an ARM architecture, but haven't installed scikit-umfpack:

    https://pypi.org/project/scikit-umfpack/

Installing it could give you much faster calculations.

  warnings.warn(UMFPACK_WARNING)

The version of bw2calc installed by the brightway25_nosolver is 2.0.DEV23.

michaelweinold commented 2 weeks ago

...related to a NumPy issue. The test import in bw2calc:

import scikits.umfpack

returns

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[7], [line 1](vscode-notebook-cell:?execution_count=7&line=1)
----> [1](vscode-notebook-cell:?execution_count=7&line=1) import scikits.umfpack

File /opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/scikits/umfpack/__init__.py:25
     [22](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/scikits/umfpack/__init__.py:22)     del _umfpack_doc, _interface_doc
     [24](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/scikits/umfpack/__init__.py:24) __all__ = [s for s in dir() if not s.startswith('_')]
---> [25](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/scikits/umfpack/__init__.py:25) from numpy.testing import Tester
     [26](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/scikits/umfpack/__init__.py:26) test = Tester().test

ImportError: cannot import name 'Tester' from 'numpy.testing' (/opt/homebrew/Caskroom/miniconda/base/envs/bw25arm/lib/python3.11/site-packages/numpy/testing/__init__.py)

Which can be resolved by pinning NumPy to <1.24.

[!NOTE]
The current workaround is to use:

conda create -n bw25arm -c conda-forge -c cmutel numpy=1.24.4 brightway25_nosolver scikit-umfpack
cmutel commented 6 days ago

Fixed in https://github.com/brightway-lca/brightway-documentation/commit/417c8b6bb02af5e231d9fb7c9612acfb073aa182