# Installing pygplates using numpy2.0

**URL:** <https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908>\
**Category:** Q&A\
**Created:** [25 June 2024 10:06 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908 "2024-06-25T10:06:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sia](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@Sia](https://discourse.gplates.org/u/Sia)\
**Post date:** [25 June 2024 10:06 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908/1 "2024-06-25T10:06:44Z")

</div>

Hi team,

Just wondering if anyone has had any luck with installing pygplates using numpy2.0+python3.12 on macOs? Having gdal with numpy2.0 seems to be a tricky.

S

---

<div class="post-metadata">

**Author:** ![mchin](https://discourse.gplates.org/user_avatar/discourse.gplates.org/mchin/32/2_2.png) [@mchin](https://discourse.gplates.org/u/mchin)\
**Post date:** [25 June 2024 23:06 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908/2 "2024-06-25T23:06:21Z")

</div>

Hi @john.cannon ,

Lauren also mention the problem that pygplates would not work with numpy2.0 a few days before. Below is the error message she sent me.

_ **A module that was compiled using NumPy 1.x cannot be run in** _  
_ **NumPy 2.0.0 as it may crash. To support both 1.x and 2.x** _  
_ **versions of NumPy, modules must be compiled with NumPy 2.0.** _  
_ **Some module may need to rebuild instead e.g. with ‘pybind11\>=2.12’.** _

_ **If you are a user of the module, the easiest solution will be to** _  
_ **downgrade to ‘numpy\<2’ or try to upgrade the affected module.** _  
_ **We expect that some modules will need time to support NumPy 2.** _

---

<div class="post-metadata">

**Author:** ![Sia](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@Sia](https://discourse.gplates.org/u/Sia)\
**Post date:** [26 June 2024 01:06 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908/3 "2024-06-26T01:06:05Z")

</div>

Yeah, without actually trying it, I think having gdal installed with numpy2.0 should be the solution. I will report back if nobody has had any success so far.

---

<div class="post-metadata">

**Author:** ![john.cannon](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@john.cannon](https://discourse.gplates.org/u/john.cannon)\
**Post date:** [27 June 2024 13:04 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908/4 "2024-06-27T13:04:49Z")

</div>

Thanks Sia and Michael, I hadn’t realized that you need to _compile_ using NumPy 2.0 in order to work with both NumPy 1.x and 2.x (but it makes sense).

The next pyGPlates release (soon) will add support for wheels (ie, so you can `pip install pygplates`). And I’ve just ensured the wheels will always get compiled with `NumPy >= 2.0`. I’ll do the same for `conda install pygplates` before the next release. Note that you can actually use conda now (see [here](https://www.gplates.org/docs/pygplates/pygplates_getting_started#install-using-conda)) but it currently only supports NumPy 1.x.

In the meantime, it might be easier to downgrade your NumPy to 1.x. I suspect it might be a little while before the majority of modules support NumPy 2.x (seeing as it was only released on June 16th). Easiest is to use conda to install pygplates (it’ll take care of all those _binary_ dependency restrictions for you).

---

<div class="post-metadata">

**Author:** ![Sia](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@Sia](https://discourse.gplates.org/u/Sia)\
**Post date:** [1 July 2024 03:37 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908/5 "2024-07-01T03:37:02Z")

</div>

Hi John and Micheal,

Having a PyPI package for pygplates is the best thing that can happen. This way, we would be able to add pygplates as requirement for gadopt package ([gadopt.org](http://gadopt.org)) and would make a lot of our user-end hassle go away. (Conda is unfortunately not supported when installing our dependencies! But Pip install works great. )

Yes, in order to be backward compatible you need to compile with numpy2.0 which on MacOS using brew was very tricky.

The work around on Mac: The tricky part is that many default brew packages use numpy1.X under the hood. So these are more or less the steps one needs to take:  
1 - Install numpy2.x with brew using the head version by `brew install numpy --head`  
2 - install a boost-python3 version that uses that numpy2.x. Unfortunately this is very tricky, because even the head version of boost-python3 using nuymy1.X. Angus Gibson at ANU found a nice solution for that by patching the boost-python3.rb formula. Happy to share that anyone needs that.  
3 - Then install gdal from source by using `brew install -s gdal`.  
Hope this all helps!

---

<div class="post-metadata">

**Author:** ![Sia](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@Sia](https://discourse.gplates.org/u/Sia)\
**Post date:** [1 July 2024 03:41 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908/7 "2024-07-01T03:41:21Z")

</div>

Also there are a few bugs in the published 0.36.0 tar file. Here is how I could make it work:

```auto
diff --git a/src/src/api/PyFeatureCollection.cc b/src/src/api/PyFeatureCollection.cc
index 41fe37c..a06d075 100644
--- a/src/src/api/PyFeatureCollection.cc
+++ b/src/src/api/PyFeatureCollection.cc
@@ -28,6 +28,7 @@
 #include <vector>
 #include <boost/noncopyable.hpp>
 #include <boost/optional.hpp>
+#include <boost/numeric/conversion/cast.hpp>
 #include <QString>
 
 #include "PyFeatureCollectionFileFormatRegistry.h"
@@ -47,6 +48,7 @@
 #include "utils/ReferenceCount.h"
 
 
+
 namespace bp = boost::python;
 
 
diff --git a/src/src/qt-widgets/KinematicGraphPicker.h b/src/src/qt-widgets/KinematicGraphPicker.h
index c3a34cf..5e73e00 100644
--- a/src/src/qt-widgets/KinematicGraphPicker.h
+++ b/src/src/qt-widgets/KinematicGraphPicker.h
@@ -24,6 +24,8 @@
 #ifndef KINEMATICGRAPHPICKER_H
 #define KINEMATICGRAPHPICKER_H
 
+#include <qwt_series_data.h>
+
 #include "qwt_plot_canvas.h"
 #include "qwt_plot_picker.h"
 #include "qwt_text.h"
@@ -31,7 +33,6 @@
 #include "KinematicGraphsDialog.h"
 
 class QwtPlotCurve;
-class QwtPointSeriesData;
 
 namespace GPlatesQtWidgets
 {
diff --git a/src/src/qt-widgets/KinematicGraphsDialog.h b/src/src/qt-widgets/KinematicGraphsDialog.h
index 791426c..853b078 100644
--- a/src/src/qt-widgets/KinematicGraphsDialog.h
+++ b/src/src/qt-widgets/KinematicGraphsDialog.h
@@ -26,6 +26,7 @@
 
 #include <QDialog>
 #include <QScopedPointer>
+#include <qwt_series_data.h>
 
 #include "maths/LatLonPoint.h"
 
@@ -49,7 +50,7 @@
 
 class QwtPlot;
 class QwtPlotCurve;
-class QwtPointSeriesData;
+//class QwtPointSeriesData;
 
 class QStandardItemModel;
 

```

---

<div class="post-metadata">

**Author:** ![john.cannon](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@john.cannon](https://discourse.gplates.org/u/john.cannon)\
**Post date:** [1 July 2024 04:23 UTC](https://discourse.gplates.org/t/installing-pygplates-using-numpy2-0/908/8 "2024-07-01T04:23:17Z")

</div>

> [@Sia](#):
>
> (Conda is unfortunately not supported when installing our dependencies! But Pip install works great. )

Good to know pip works. Interesting about conda - yes it’s unfortunate (conda being better for _binary_ libraries commonly found in the scientific community).

> [@Sia](#):
>
> numpy2.0 which on MacOS using brew was very tricky

Thanks, I’m hoping that Macports will support NumPy 2.0 ([here](https://trac.macports.org/ticket/70251)) before the next pyGPlates release. But yes, if need be, might have to use brew (or find a similar solution for Macports).

> [@Sia](#):
>
> Also there are a few bugs in the published 0.36.0 tar file

Thanks. That will be in the next release. (Also mentioned in [this post](https://discourse.gplates.org/t/source-build-failing-with-qwt-6-3-0/898))
