ubermag / help

Repository for raising issues and requesting help on Ubermag
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

Installation issue on Mac M1/arm64 arch #140

Open fgr1986 opened 3 years ago

fgr1986 commented 3 years ago

conda install -c conda-forge oommfc

Reports (verbose output):

collecting package metadata (current_repodata.json): ...working... Unable to retrieve repodata (response: 404) for https://repo.anaconda.com/pkgs/r/osx-arm64/current_repodata.json

Unable to retrieve repodata (response: 404) for https://repo.anaconda.com/pkgs/r/osx-arm64/repodata.json

done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): ...working... Unable to retrieve repodata (response: 404) for https://repo.anaconda.com/pkgs/r/osx-arm64/repodata.json

done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Solving environment: ...working... 
Building graph of deps:   0%|          | 0/5 [00:00<?, ?it/s]
Examining @/osx-arm64::__osx==11.1=0:   0%|          | 0/5 [00:00<?, ?it/s]
Examining @/osx-arm64::__archspec==1=arm64:  20%|██        | 1/5 [00:00<00:00, 5607.36it/s]
Examining python=3.9:  40%|████      | 2/5 [00:00<00:00, 7115.02it/s]                      
Examining @/osx-arm64::__unix==0=0:  60%|██████    | 3/5 [00:00<00:00, 409.53it/s]
Examining oommfc:  80%|████████  | 4/5 [00:00<00:00, 541.32it/s]                  

Determining conflicts:   0%|          | 0/5 [00:00<?, ?it/s]
Examining conflict for python oommfc:   0%|          | 0/5 [00:00<?, ?it/s]

Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/cli/install.py", line 261, in install
    unlink_link_transaction = solver.solve_for_transaction(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 114, in solve_for_transaction
    unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 157, in solve_for_diff
    final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 281, in solve_final_state
    ssc = self._run_sat(ssc)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/common/io.py", line 88, in decorated
    return f(*args, **kwds)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 815, in _run_sat
    ssc.solution_precs = ssc.r.solve(tuple(final_environment_specs),
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/common/io.py", line 88, in decorated
    return f(*args, **kwds)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/resolve.py", line 1320, in solve
    raise UnsatisfiableError({})
conda.exceptions.UnsatisfiableError: 
Did not find conflicting dependencies. If you would like to know which
packages conflict ensure that you have enabled unsatisfiable hints.

conda config --set unsatisfiable_hints True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/exceptions.py", line 1079, in __call__
    return func(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/cli/main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 83, in do_call
    return getattr(module, func_name)(args, parser)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/cli/main_install.py", line 20, in execute
    install(args, parser, 'install')
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/cli/install.py", line 308, in install
    raise e
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/cli/install.py", line 295, in install
    unlink_link_transaction = solver.solve_for_transaction(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 114, in solve_for_transaction
    unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 157, in solve_for_diff
    final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 275, in solve_final_state
    ssc = self._add_specs(ssc)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/core/solve.py", line 704, in _add_specs
    ssc.r.find_conflicts(spec_set)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/conda/resolve.py", line 352, in find_conflicts
    raise UnsatisfiableError(bad_deps, strict=strict_channel_priority)
conda.exceptions.UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions
marijanbeg commented 3 years ago

Hi @fgr1986, thank you for your question. This is a difficult question since we do not have a machine to do the tests ourselves. However, from the error messages, it looks like you did not create an environment with Python 3.8. Could you please make sure you have a clean environment? You can follow this tutorial: https://oommfc.readthedocs.io/en/latest/ipynb/installation-testing-update.html

Please keep us updated.

fgr1986 commented 3 years ago

Hi @marijanbeg , thanks for your quick responses. This was in a clean environment, and I tried with both 3.9 and 3.8. The installation with pip fails on hp5 libs (will report it).

I will update the tread if I find anything from the log. Thanks

marijanbeg commented 3 years ago

Hi @fgr1986, I transferred this issue to our help repository. Is this issue still active?

fgr1986 commented 3 years ago

Hi, yes, I just tried to install it and it is still a problem.

AkravasTheWise commented 3 years ago

tl:;dr you're out of luck. Try to get a computer with amd or armv8

Any arm chip lower than v8 presents this problem with the piwheels of hp5. I encountered this while trying to run Ubermag in a Raspberry Pi 4. I got further installing missing packages from the piwheels website, but run into more problems since there was no actual software for arm64 architecture to emulate that library. I am hoping that I can make the rig work and upload a tutorial when I can get my hands on the new Pi 4B with ARMv8

nickfanion commented 1 year ago

This is still an issue in 2023. I'm unable to install oommfc, and therefore ubermag, on Apple Silicon (osx-arm64) machines. Apple doesn't sell Intel machines anymore. I'm using miniforge, so conda-forge is the default channel.

conda install oommfc -v

Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: ...working... unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: ...working... 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                             
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/install.py", line 309, in install
    unlink_link_transaction = solver.solve_for_transaction(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 153, in solve_for_transaction
    unlink_precs, link_precs = self.solve_for_diff(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 214, in solve_for_diff
    final_precs = self.solve_final_state(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 387, in solve_final_state
    ssc = self._run_sat(ssc)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/common/io.py", line 83, in decorated
    return f(*args, **kwds)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 1048, in _run_sat
    ssc.solution_precs = ssc.r.solve(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/common/io.py", line 83, in decorated
    return f(*args, **kwds)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/resolve.py", line 1507, in solve
    raise UnsatisfiableError({})
conda.exceptions.UnsatisfiableError: 
Did not find conflicting dependencies. If you would like to know which
packages conflict ensure that you have enabled unsatisfiable hints.

conda config --set unsatisfiable_hints True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/exception_handler.py", line 16, in __call__
    return func(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/main.py", line 84, in main_subshell
    exit_code = do_call(args, p)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/conda_argparse.py", line 126, in do_call
    return getattr(module, func_name)(args, parser)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/notices/core.py", line 123, in wrapper
    return func(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/main_install.py", line 22, in execute
    install(args, parser, "install")
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/install.py", line 378, in install
    raise e
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/cli/install.py", line 361, in install
    unlink_link_transaction = solver.solve_for_transaction(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 153, in solve_for_transaction
    unlink_precs, link_precs = self.solve_for_diff(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 214, in solve_for_diff
    final_precs = self.solve_final_state(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 379, in solve_final_state
    ssc = self._add_specs(ssc)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/core/solve.py", line 915, in _add_specs
    ssc.r.find_conflicts(spec_set)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/conda/resolve.py", line 418, in find_conflicts
    raise UnsatisfiableError(bad_deps, strict=strict_channel_priority)
conda.exceptions.UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

I was able to install ubermag via pip, compile oommfc from source, and add oommfc to my path, but ubermag.test() returned several errors and warnings.

fangohr commented 1 year ago

I can reproduce your error using miniforge.

The installation works fine using normal anaconda:

conda create -c conda-forge -n myubermag python=3.10 conda activate myubermag conda install -c conda-forge oommfc

Once this is done, I could run:

$ python
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import oommfc
>>> oommfc.test()
============================= test session starts ==============================
platform darwin -- Python 3.10.12, pytest-7.4.0, pluggy-1.2.0 -- ...
<snip>
=========== 111 passed, 2 skipped, 89 warnings in 465.79s (0:07:45) ============

Could you try to use anaconda (or mini conda) instead of mini forge?

nickfanion commented 1 year ago

Thanks @fangohr

I tried your installation steps, with miniconda and the full Anaconda distribution. Unfortunately, it didn't make a difference on my machine, and the same error occurred. I ran anaconda-clean and removed all config files before trying a new conda installer.

conda version = 23.5.0 macOS version = Ventura 13.4.1 MacBook Air with M2

Attached is the output with the -vv flag:

oommfc-vv-log.txt

fangohr commented 1 year ago

Thanks. I could recreate this error now on a fresh user account. Installed anaconda from https://repo.anaconda.com/archive/Anaconda3-2023.03-1-MacOSX-arm64.sh

Then commands as above:

conda create -c conda-forge -n myubermag python=3.10
conda activate myubermag
conda install -c conda-forge oommfc -vv &> anaconda-install-oommfc.log

anaconda-install-oommfc.log

conda version = 23.3.1 macOS version = Ventura 13.4.1 MacBook Air with M2

Re-running the command after setting conda config --set unsatisfiable_hints True does not change what is captured in the output.

nickfanion commented 1 year ago

I tried mamba and received a more detailed error message:

mamba install oommfc

Looking for: ['oommfc']

conda-forge/osx-arm64                                       Using cache
conda-forge/noarch                                          Using cache

Pinned packages:
  - python 3.10.*

Could not solve for environment specs
The following packages are incompatible
└─ oommfc is not installable because there are no viable options
   ├─ oommfc [0.10|0.10.1|...|0.9] would require
   │  └─ oommf 2.0a1 , which does not exist (perhaps a missing channel);
   ├─ oommfc 0.60.0 would require
   │  └─ oommf 2.0a2 , which does not exist (perhaps a missing channel);
   ├─ oommfc [0.61.0|0.61.1|0.62.0|0.63.0] would require
   │  └─ oommf 2.0a3 , which does not exist (perhaps a missing channel);
   ├─ oommfc 0.64.0 would require
   │  └─ oommf 2.0b0 , which does not exist (perhaps a missing channel);
   └─ oommfc [0.8.10|0.8.11|...|0.8.9] would require
      └─ oommf, which does not exist (perhaps a missing channel).

oommf does not have a noarch or osx-arm64 package.

nickfanion commented 1 year ago

I did some more tests by building OOMMF from source.

Built OOMMF (Terminal output attached): git clone https://github.com/fangohr/oommf.git cd oommf make build oommf build log.txt

Ran the make test (test output attached): make test-all boxsi.errors.txt

Added the OOMMFTCL path variable to .zshrc in my home directory and restarted Terminal: export OOMMFTCL="/Users/nick/compiled-apps/oommf/oommf/oommf.tcl"

Installed ubermag with pip in a clean python 3.10 environment: conda create -n ubermag_env python=3.10 conda activate ubermag_env pip install ubermag

Ran test to see if ubermag can find OOMMF. It returned an error: python3 -c "import oommfc; oommfc.oommf.status()"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'oommfc.oommf' has no attribute 'status'

Ran the ubermag test: python -c "import ubermag; ubermag.test()"

=============================================== short test summary info ================================================
FAILED tests/test_field.py::TestField::test_mpl_lightess - AttributeError: 'NoneType' object has no attribute '_get_renderer'
FAILED tests/test_field.py::TestField::test_hv_vector - RecursionError: maximum recursion depth exceeded while calling a Python object
FAILED tests/test_field.py::TestField::test_hv - RecursionError: maximum recursion depth exceeded while calling a Python object
FAILED tests/test_micromagnetictests.py::test_schedule - FileNotFoundError: [Errno 2] No such file or directory: 'oommf'
FAILED tests/test_oommf.py::test_exe_oommf_runner - TypeError: expected str, bytes or os.PathLike object, not NoneType
FAILED tests/test_oommf.py::test_get_oommf_runner - OSError: Cannot find OOMMF.
FAILED tests/test_oommf.py::test_get_cached_runner - OSError: Cannot find OOMMF.
FAILED tests/test_oommf.py::test_set_exe_oommf_runner - TypeError: expected str, bytes or os.PathLike object, not NoneType
FAILED tests/test_oommf.py::test_choose_runner - TypeError: expected str, bytes or os.PathLike object, not NoneType
FAILED tests/test_combined_drive.py::TestDrive::test_hv - RecursionError: maximum recursion depth exceeded while calling a Python object
FAILED tests/test_drive.py::TestDrive::test_hv - RecursionError: maximum recursion depth exceeded while calling a Python object
========================= 11 failed, 468 passed, 2 skipped, 1367 warnings in 319.23s (0:05:19) =========================
Exception ignored in: <function OOMMFRunner.__del__ at 0x2a48641f0>
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/site-packages/oommfc/oommf/oommf.py", line 32, in __del__
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/site-packages/oommfc/oommf/oommf.py", line 193, in _kill
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/subprocess.py", line 503, in run
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/subprocess.py", line 971, in __init__
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/subprocess.py", line 1793, in _execute_child
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/os.py", line 630, in get_exec_path
ImportError: sys.meta_path is None, Python is likely shutting down
lang-m commented 1 year ago

Two short notes on the test problems:

  1. oommfc.oommf.status() is not the right command (the naming is maybe a bit confusing). Instead, you can use one of:
    • python3 -c "import oommfc; oommfc.runner.runner.status"
    • python3 -c "import oommfc; oommfc.runner.autoselect_runner(); print(oommfc.runner)"
  2. The ImportError shown in the test output is known and will be fixed in the next release. It does not affect running simulations.
nickfanion commented 1 year ago

Thanks @lang-m. This is my output from python3 -c "import oommfc; oommfc.runner.runner.status"

Running OOMMF (TclOOMMFRunner)[2023/07/12 10:22]... (1.0 s)
OOMMF found and running.
Exception ignored in: <function OOMMFRunner.__del__ at 0x293b991b0>
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/site-packages/oommfc/oommf/oommf.py", line 32, in __del__
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/site-packages/oommfc/oommf/oommf.py", line 193, in _kill
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/subprocess.py", line 503, in run
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/subprocess.py", line 971, in __init__
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/subprocess.py", line 1793, in _execute_child
  File "/opt/homebrew/Caskroom/miniforge/base/envs/ubermag_env/lib/python3.10/os.py", line 630, in get_exec_path
ImportError: sys.meta_path is None, Python is likely shutting down
lang-m commented 1 year ago

That looks like OOMMF is found and running (same meaningless ImportError at the end). If you try the other command, you should see the full path to oommf.tcl in the output. That might be useful to confirm that oommfc did indeed pick up the right version (in case you were to have multiple copies of OOMMF).

nickfanion commented 1 year ago

Yes, it did find the correct (and only) OOMMF:

OOMMF runner: TclOOMMFRunner(/Users/nick/compiled-apps/oommf/oommf/oommf.tcl)
runner is cached: True

My only outstanding issues are the 11 failures ubermag.test() returns. However, I assume some are meaningless (like the exe runner), and I haven't run into any issues with my projects yet.

DebanjanPolley commented 9 months ago

Recently, I found an easier way to install UBERMAG on a Mac (M1/M2 chip).

I had to build an osx-64 environment within my M2 Mac in the following way:

  1. Create an osx-64 virtual environment ubermag_env CONDA_SUBDIR=osx-64 conda create -n ubermag_env python
  2. activate the virtual environment conda activate ubermag_env
  3. config osx-64 conda config --env --set subdir osx-64

Then use $ conda install --channel conda-forge ubermag to install UBERMAG.