setools package throws an error in Jammy

Asked by Tillmann Severin

During execution of setools on ubuntu jammy, I can see the following issues occure when executing all of the setools (e.g. seinfo)

~$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy

~$ seinfo
Traceback (most recent call last):
  File "/home/user/.local/bin/seinfo", line 8, in <module>
    import setools
  File "/home/user/.local/lib/python3.10/site-packages/setools/__init__.py", line 82, in <module>
    from .infoflow import InfoFlowAnalysis
  File "/home/user/.local/lib/python3.10/site-packages/setools/infoflow.py", line 12, in <module>
    import networkx as nx
  File "/usr/lib/python3/dist-packages/networkx/__init__.py", line 115, in <module>
    import networkx.readwrite
  File "/usr/lib/python3/dist-packages/networkx/readwrite/__init__.py", line 15, in <module>
    from networkx.readwrite.graphml import *
  File "/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py", line 314, in <module>
    class GraphML(object):
  File "/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py", line 345, in GraphML
    (np.float16, "float"), (np.float_, "float"),
  File "/home/user/.local/lib/python3.10/site-packages/numpy/__init__.py", line 400, in __getattr__
    raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.

I think this might be a bug, python3-numpy is installed in version python3-numpy/jammy-updates,jammy-security,now 1:1.21.5-1ubuntu22.04.1 amd64. Can someone confirm this as a bug?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

The version of setools that you are running seems not to be from the Ubuntu repositories, but from some foreign source.
The Ubuntu-provided version has its file in /usr/bin/seinfo

What output do you receive for the command

/usr/bin/seinfo

Revision history for this message
Tillmann Severin (tseverin) said :
#2

It is the same:

~$ /usr/bin/seinfo
Traceback (most recent call last):
  File "/usr/bin/seinfo", line 21, in <module>
    import setools
  File "/home/user/.local/lib/python3.10/site-packages/setools/__init__.py", line 82, in <module>
    from .infoflow import InfoFlowAnalysis
  File "/home/user/.local/lib/python3.10/site-packages/setools/infoflow.py", line 12, in <module>
    import networkx as nx
  File "/usr/lib/python3/dist-packages/networkx/__init__.py", line 115, in <module>
    import networkx.readwrite
  File "/usr/lib/python3/dist-packages/networkx/readwrite/__init__.py", line 15, in <module>
    from networkx.readwrite.graphml import *
  File "/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py", line 314, in <module>
    class GraphML(object):
  File "/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py", line 345, in GraphML
    (np.float16, "float"), (np.float_, "float"),
  File "/home/user/.local/lib/python3.10/site-packages/numpy/__init__.py", line 400, in __getattr__
    raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#3

It throws the same error, because it is still using the foreign version (/home/user/.local/lib/python3.10/site-packages/setools/__init__.py instead of Ubuntu's /usr/lib/python3/dist-packages/setools/__init__.py)

I suggest that you delete everything related to setools from /home/user/.local/ and below, and then try again.

Revision history for this message
Tillmann Severin (tseverin) said :
#4

I deleted everything from my local pip directory related to setools. Then I removed setools with apt and afterwards reinstalled it with apt. Yet again, the same issue occurs. seutils are indeed python tools (see https://github.com/SELinuxProject/setools/tree/main/setools), so I think this might nevertheless be a broken package.

Still the output is:

~$ /usr/bin/seinfo
Traceback (most recent call last):
  File "/usr/bin/seinfo", line 21, in <module>
    import setools
  File "/usr/lib/python3/dist-packages/setools/__init__.py", line 94, in <module>
    from .infoflow import InfoFlowAnalysis
  File "/usr/lib/python3/dist-packages/setools/infoflow.py", line 24, in <module>
    import networkx as nx
  File "/usr/lib/python3/dist-packages/networkx/__init__.py", line 115, in <module>
    import networkx.readwrite
  File "/usr/lib/python3/dist-packages/networkx/readwrite/__init__.py", line 15, in <module>
    from networkx.readwrite.graphml import *
  File "/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py", line 314, in <module>
    class GraphML(object):
  File "/usr/lib/python3/dist-packages/networkx/readwrite/graphml.py", line 345, in GraphML
    (np.float16, "float"), (np.float_, "float"),
  File "/home/ul26405/.local/lib/python3.10/site-packages/numpy/__init__.py", line 400, in __getattr__
    raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.

Revision history for this message
Tillmann Severin (tseverin) said :
#5

Actually, I think I solved it. Apparently it was not related to the setools package itself, but rather the pip numpy package. Thanks Manfred for pointing me to the correct direction!

Revision history for this message
Tillmann Severin (tseverin) said :
#6

Thanks Manfred Hampl, that solved my question.