ubermag / help

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

Difficulty installing Ubermag in Ubuntu 22.04.3 LTS #256

Closed jcl25 closed 1 year ago

jcl25 commented 1 year ago

I tried to install Ubermag on Ubuntu 22.04.3 LTS on a new hard drive.

I followed the instructions on https://ubermag.github.io/installation.html:

conda create -n ubermag_env python=3.10
conda activate ubermag_env

conda install --channel conda-forge ubermag

The installation hung for several hours at

Solving environment

and I quit the installation with control-C.

I then installed Ubermag using

pip install ubermag

I also installed OOMMF using

git clone https://github.com/fangohr/oommf.git
make build
export OOMMFTCL="/path/to/your/oommf.tcl"

This appeared to be successful but when I ran the test

python3 -c "import oommfc; oommfc.oommf.status()"

It gave the error

oommfc.oommf has no attribute 'status'

Can anyone help?

lang-m commented 1 year ago

Hi @jcl25, the information on the website is slightly outdated. To test if OOMMF can be found, please use

python3 -c "import oommfc; oommfc.runner.runner.status"

In an empty environment, the conda installation should normally work fine and the Solving environment step should not take more that a few minutes maximum. To solve these issues, you could try to use mamba (as a much faster drop-in replacement for conda, which you can install into your base environment using conda install mamba). The second possibility (to avoid compiling OOMMF manually) would be to just use conda to install OOMMF and afterwards install all Ubermag packages use pip. However, as you already compiled manually, this does not really bring any advantages anymore.

jcl25 commented 1 year ago

Thanks Martin. I tried conda install mamba and that crunched for the entire weekend before ending with the message:

Your installed version is: Not available.
lang-m commented 1 year ago

What hardware are you on? In particular CPU.

jcl25 commented 1 year ago

lscpu gives:

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 36 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Vendor ID: GenuineIntel Model name: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz CPU family: 6 Model: 42 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 Stepping: 7 CPU max MHz: 3800.0000 CPU min MHz: 1600.0000 BogoMIPS: 6784.54

lang-m commented 1 year ago

I have no idea why the mamba installation failed on such standard hardware. Do you have a lot of packages installed in your base conda environment? Or maybe a very old Anaconda or miniconda version (although that should not cause problems)?

If the conda-based packages would be an advantage for you, could you maybe try to start with a fresh miniconda installation, where you just add mamba and then try to create a new environment based on this?

jcl25 commented 1 year ago

It's a fresh installation of anadonda and I had the same problem on two identical computers. I'll try uninstalling anaconda and installing miniconda as you suggest.

jcl25 commented 1 year ago

I uninstalled anaconda and installed mamba.

mamba install --channel conda-forge ubermag

seemed to work with no error messages.

python3 -c "import oommfc; oommfc.runner.runner.status"

gave OOMMF found and running.

python -c "import ubermag;ubermag.test()"

gave 5 failures:

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_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

Can you give me any advice on how to solve the failures?

DivineMassacre commented 1 year ago

Hi, I just have the same problems when tried to install Ubermag on Windows machine link, but I haven't received any answers for a couple of weeks :(

lang-m commented 1 year ago

@jcl25 The failing tests are a known problem but we don't know yet in detail why the arise. It seems that it might be related to the Python version and switching to Python 3.8 might resolve the issue. I will have to look more into this anyways and will keep you updated when we make progress.

Side note: the failures are only relevant if you intend to use the interactive plotting based on HoloViews.

lang-m commented 1 year ago

@DivineMassacre Your problem seems a bit different on a first look. I think your holoviews tests work fine? I made some suggestions on Zulip.

jcl25 commented 1 year ago

As far as I can tell, I have successfully installed Ubermag apart from the failed tests using the method above.

My next problem is that it looks like the syntax for Ubermag has changed slightly which has messed up

  1. a plotting programme I wrote as there is no longer an mpl_scalar attibute.
  2. (More seriously) relaxing the magnetisation gives the error 'TypeError: cannot unpack non-iterable NoneType object'.

I think these would be easily solved by someone familiar with Ubermag. What is the best thing to do? Can I send you the .ipynb file?

lang-m commented 1 year ago

Yes, the best thing would be if you can share your .ipynb file.

jcl25 commented 1 year ago

I've attached the file. (I had to zip it as I can't upload .ipynb files in this chat.)

antiskyrmion_Peng.ipynb.zip

lang-m commented 1 year ago

I had a look at your notebook:

  1. There were some changes in Ubermag, you have to replace mpl_scalar with mpl.scalar and mpl_vector with mpl.vector.
  2. The problem comes from your energy definition. For the CubicAnisotropy you have to also define u1 and u2 in addition to K (https://ubermag.github.io/api/_autosummary/micromagneticmodel.CubicAnisotropy.html#micromagneticmodel.CubicAnisotropy). Unfortunately, this is not at all clear from the error message. [@samjrholt and @swapneelap We really need to to something here, it is the usual typesystem problem]

Regarding plotting (and the notebook in general): We will release a new Ubermag version soon (propably a couple of weeks) that will break some more things in your notebook. We have renamed/modified a few things to remove several inconsistencies in the code base and make it more generic for the future. Once this is out and you update, you will again have to change some syntax. We will summarise all required changes upon release.

jcl25 commented 1 year ago

Thanks for all the advice - it was very helpful. I recompiled it with Python 3.8 and it passed all the tests.