I encounter the following error when trying to load swiftsimio with numpy 2.0.0:
Traceback (most recent call last):
File "plot_gas_density.py", line 8, in <module>
import swiftsimio as sw
File "py_analysis/lib/python3.11/site-packages/swiftsimio/__init__.py", line 1, in <module>
from .reader import *
File "py_analysis/lib/python3.11/site-packages/swiftsimio/reader.py", line 15, in <module>
from swiftsimio.accelerated import read_ranges_from_file
File "py_analysis/lib/python3.11/site-packages/swiftsimio/accelerated.py", line 87, in <module>
columns: np.lib.index_tricks.IndexExpression = np.s_[:],
^^^^^^^^^^^^^^^^^^^
File "py_analysis/lib/python3.11/site-packages/numpy/lib/__init__.py", line 77, in __getattr__
raise AttributeError(
AttributeError: numpy.lib.index_tricks is now private. If you are using a public function, it should be available in the main numpy namespace, otherwise check the NumPy 2.0 migration guide.
Here are the first lines of my plot_gas_density.py script:
"""
Makes a gas density projection plot. Uses the swiftsimio library.
"""
import matplotlib.pyplot as plt
import numpy as np
import swiftsimio as sw #Here is line 8
from swiftsimio.visualisation.projection import project_gas
import unyt
from unyt import mh, cm
from tqdm import tqdm
from matplotlib.colors import LogNorm
from matplotlib.animation import FuncAnimation
Finally, the virtual env is created in the following way:
Hi everyone,
I encounter the following error when trying to load
swiftsimio
withnumpy 2.0.0
:Here are the first lines of my
plot_gas_density.py
script:Finally, the virtual env is created in the following way:
Notice that enforcing numpy version to be smaller than 2.0.0 works fine (
pip install "numpy<2.0.0"
).