# PB2 Error ('select\_length' is not defined)

**URL:** <https://discuss.ray.io/t/pb2-error-select-length-is-not-defined/3109>\
**Category:** Ray Tune\
**Created:** [August 2, 2021, 8:33am UTC](https://discuss.ray.io/t/pb2-error-select-length-is-not-defined/3109 "2021-08-02T08:33:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![runedog48](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@runedog48](https://discuss.ray.io/u/runedog48)\
**Post date:** [August 2, 2021, 8:33am UTC](https://discuss.ray.io/t/pb2-error-select-length-is-not-defined/3109/1 "2021-08-02T08:33:20Z")

</div>

Hello! I’m attempting to use the pb2 scheduler and I’m receiving the following error when it attempts to perturb.

```auto
File ray\tune\schedulers\pb2.py", line 55, in select_config
     length = select_length(Xraw, yraw, bounds, num_f)
NameError: name 'select_length' is not defined

```

Here is what I’m trying to run: [train.py - Pastebin.com](https://pastebin.com/iCux6SHn)  
I have installed both scikit-learn and gpy. Any help would be appreciated.

```auto
Requirement already satisfied: scikit-learn (0.24.2)
Requirement already satisfied: gpy (1.10.0)

```

---

<div class="post-metadata">

**Author:** ![kai](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/kai/32/3380_2.png) [@kai](https://discuss.ray.io/u/kai)\
**Post date:** [August 2, 2021, 8:54am UTC](https://discuss.ray.io/t/pb2-error-select-length-is-not-defined/3109/2 "2021-08-02T08:54:00Z")

</div>

Hi @runedog48, this is strange. Can you add some debugging output to `pb2.py` to see which of the imports fails?

Alternatively, can you open a python console and type

```auto
import GPy

```

and

```auto
import sklearn

```

and see if it returns anything?

Which version of Python and Ray are you using?

---

<div class="post-metadata">

**Author:** ![runedog48](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@runedog48](https://discuss.ray.io/u/runedog48)\
**Post date:** [August 2, 2021, 9:15am UTC](https://discuss.ray.io/t/pb2-error-select-length-is-not-defined/3109/3 "2021-08-02T09:15:25Z")

</div>

Wish I would have thought to do this. Looks like GPy depends on matplotlib so it wasn’t importing. Works now!
