freegs-plasma / freegs

Free boundary Grad-Shafranov solver
GNU Lesser General Public License v3.0
90 stars 52 forks source link

import geqdsk error; Numpy.bool #97

Closed bensteinlubrano closed 1 year ago

bensteinlubrano commented 1 year ago

Attempting to import the eqdsk reader:

from freegs import _geqdsk as geqdsk

from a python 3.8.10 virtual environment, yields the following error message:

[...] in from freegs import _geqdsk as geqdsk [...] from .equilibrium import Equilibrium [...] from . import machine [...] class Solenoid: [...] in Solenoid (str("control"), np.bool), [...] in getattr raise AttributeError(__former_attrs_[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

tbody-cfs commented 1 year ago

Hi Ben, Have you pulled the latest version of main? I can't see np.bool anymore in the repository (seems to have been fixed in https://github.com/freegs-plasma/freegs/pull/50)

bensteinlubrano commented 1 year ago

Hi Tom,

I was using the pip install version of freegs, I should have realized it might not be the latest version. Thank you!

I have just tried cloning and installing the latest version with "python setup.py install --user", but did not have much success. freegs claims to install successfully in my virtual environment, but when I import it I get "ModuleNotFoundError: No module named 'freegs'". Do I need to be careful about file locations or something when installing in a virtual environment?

Many "UNKNOWN.egg" files are created in the cloned freegs repository when I run "python setup.py install", in case that is a hint to what I'm doing wrong.

Thanks! --Ben

ZedThree commented 1 year ago

I've just released v0.8.0 which has fixed this issue, and is installable from PyPI with pip install --upgrade freegs

@bensteinlubrano Just to let you know that running python setup.py install is now deprecated, and you can generally install local versions of Python packages with pip install .