0

I want to use PyAMG (https://pyamg.readthedocs.io/en/latest/#).
I install it using (pip install pyamg)
I use spyder in windows. It gives error when I want to import it
I run it's example:

import pyamg
import numpy as np
A = pyamg.gallery.poisson((500,500), format='csr')  # 2D Poisson problem on 500x500 grid
ml = pyamg.ruge_stuben_solver(A)                    # construct the multigrid hierarchy
print(ml)                                           # print hierarchy information
b = np.random.rand(A.shape[0])                      # pick a random right hand side
x = ml.solve(b, tol=1e-10)                          # solve Ax=b to a tolerance of 1e-10
print("residual: ", np.linalg.norm(b-A*x))          # compute norm of residual vector

The error is :
import pyamg.amg_core

File "C:\Users\Admin\AppData\Local\Programs\Spyder\pkgs\pyamg\amg_core_init_.py", line 5, in from .evolution_strength import *

ModuleNotFoundError: No module named 'pyamg.amg_core.evolution_strength'

How can I resolve this issue?

Thanks in advance

  • 1
    (*Spyder maintainer here*) It seems you're using our Windows installer and (somehow) you installed `pyamg` on it, even if we don't provide pip on it. That was the wrong way of doing it. – Carlos Cordoba May 17 '21 at 15:14
  • 1
    If you want to use to other modules that don't come with our installer, you need to install [Miniconda](https://docs.conda.io/en/latest/miniconda.html), create a [conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) after that with the packages you want to use and `spyder-kernels`, and finally [connect Spyder](http://docs.spyder-ide.org/current/faq.html#using-existing-environment) to that env. – Carlos Cordoba May 17 '21 at 15:14
  • Great! I'm glad it works now for you. – Carlos Cordoba May 18 '21 at 13:55

0 Answers0