# Batch Processing Error

**URL:** <https://forum.allencell.org/t/batch-processing-error/217>\
**Category:** Segmenter\
**Created:** [June 18, 2020, 7:00pm UTC](https://forum.allencell.org/t/batch-processing-error/217 "2020-06-18T19:00:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo\_Mv](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@Leo\_Mv](https://forum.allencell.org/u/Leo_Mv)\
**Post date:** [June 18, 2020, 7:00pm UTC](https://forum.allencell.org/t/batch-processing-error/217/1 "2020-06-18T19:00:11Z")

</div>

Hi,

I am trying to batch process my images in the segmenter using the provided template and tutorial. I have followed all the instructions, however, when I try to execute the process I keep getting an error (see attached image). I would please like some assistance resolving this issue.

Regards,

Leonard

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/allencell/original/1X/79f65782b7ae239ea76e5bf59614da0750268afb.png)

---

<div class="post-metadata">

**Author:** ![jianxu\_chen](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jianxu\_chen](https://forum.allencell.org/u/jianxu_chen)\
**Post date:** [June 18, 2020, 7:04pm UTC](https://forum.allencell.org/t/batch-processing-error/217/2 "2020-06-18T19:04:43Z")

</div>

Hi Leonard,

Can you try again on a filepath with no space? In general, it would be better to keep your folder names and file names with no space.

Thanks,  
Jianxu

---

<div class="post-metadata">

**Author:** ![Leo\_Mv](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@Leo\_Mv](https://forum.allencell.org/u/Leo_Mv)\
**Post date:** [June 18, 2020, 10:33pm UTC](https://forum.allencell.org/t/batch-processing-error/217/3 "2020-06-18T22:33:40Z")

</div>

Hi Jianxu,

I changed the path names and now when I try to execute the comman it says structure not found.

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/allencell/original/1X/e14b06def37d26418a68795608d13d5b0a8cfedd.png)

Leonard

---

<div class="post-metadata">

**Author:** ![jianxu\_chen](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jianxu\_chen](https://forum.allencell.org/u/jianxu_chen)\
**Post date:** [June 18, 2020, 11:48pm UTC](https://forum.allencell.org/t/batch-processing-error/217/4 "2020-06-18T23:48:19Z")

</div>

great! one problem solved! let’s look at this one.

Right now, my current implementation of the error message is not very mature, which needs to be improved in the next release.

The current message could be the results of two things. i will try to help figure it out.

(1) it looks like you have a new workflow called Actin. So, a file called workflow\_Actin.py is expected in the folder ‘structure\_wrapper’, and a function call Workflow\_Actin is expected in the file. The exact string ‘Actin’ is used as the key to identify all these things, so double-checking the string could help to make the file and the function do exist with the correct name

(2) if the above step shows no error, it could be some error in your workflow\_Actin.py maybe comment out all lines in the function and run that again and see if you still see the error. If the error is gone, it means some line has errors.

Let me know if i can help more.

thanks,  
Jianxu

---

<div class="post-metadata">

**Author:** ![AidanF](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@AidanF](https://forum.allencell.org/u/AidanF)\
**Post date:** [November 20, 2020, 10:39pm UTC](https://forum.allencell.org/t/batch-processing-error/217/5 "2020-11-20T22:39:32Z")

</div>

Hi Jianxu,

I was wondering if there was a fix to this question. I just tried to use the batch processing function and I’ve come across the same error.

 ![StructureNotFound](https://canada1.discourse-cdn.com/flex027/uploads/allencell/original/1X/504f66cae46b5cae6ab9507579bec0fe182826c4.jpeg)

Thanks,  
Aidan

---

<div class="post-metadata">

**Author:** ![jianxu\_chen](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jianxu\_chen](https://forum.allencell.org/u/jianxu_chen)\
**Post date:** [November 20, 2020, 11:42pm UTC](https://forum.allencell.org/t/batch-processing-error/217/6 "2020-11-20T23:42:31Z")

</div>

Hi Aidan,

I would love to help. Yes, we do have a more flexible way to run batch processing on customized wrapper now. Could you do a quick check on the following thing?

In your conda environement, can you do `pip show aicssegmentation` and see what is printed out?

For example, in my case, I have:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/allencell/original/1X/d9f117c72f115e55e20522dc4649426da15c284f.png)

If you installed the package in editable mode (i.e. `pip install -e .[all]`), then you should also see a path, like this.

This is the first step. Let me know what is printed out. Then, I could you show you how to deal with this depending on your specific situation.

Thanks,  
Jianxu

---

<div class="post-metadata">

**Author:** ![AidanF](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@AidanF](https://forum.allencell.org/u/AidanF)\
**Post date:** [November 20, 2020, 11:59pm UTC](https://forum.allencell.org/t/batch-processing-error/217/7 "2020-11-20T23:59:28Z")

</div>

Hi Jianxu,

Thanks for getting back to me! This is what I got after running pip show aicssegmentation

 ![pipshow](https://canada1.discourse-cdn.com/flex027/uploads/allencell/original/1X/6f293f3a0d1b95613dd3a37ffae879a06aea9849.jpeg)

Aidan

---

<div class="post-metadata">

**Author:** ![jianxu\_chen](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jianxu\_chen](https://forum.allencell.org/u/jianxu_chen)\
**Post date:** [November 21, 2020, 12:02am UTC](https://forum.allencell.org/t/batch-processing-error/217/8 "2020-11-21T00:02:09Z")

</div>

Nice! Give me about 20 min. Working on a few code snippets for you.

Jianxu

---

<div class="post-metadata">

**Author:** ![jianxu\_chen](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jianxu\_chen](https://forum.allencell.org/u/jianxu_chen)\
**Post date:** [November 21, 2020, 1:44am UTC](https://forum.allencell.org/t/batch-processing-error/217/9 "2020-11-21T01:44:59Z")

</div>

Hi Aiden, Here is an example:

Suppose I made a new wrapper for structure `foo`. The script is simple:

```auto
import numpy as np

def Workflow_foo(struct_img, rescale_ratio, output_type, output_path, fn, output_func=None):
    a = np.ones(3)
    print("i am here")
    print(a)

```

Now, I save this script called `seg_foo.py` in the directory `c:\projects\demo\wrapper\`.

Then, if I run `batch_processing --workflow_name foo --wrapper_dir c:\projects\demo\wrapper\ --struct_ch 0 --output_dir c:\projects\demo\ per_dir --input_dir c:\projects\demo\data --data_type .tiff`

The wrapper I just created can be correctly loaded. See this

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/allencell/original/1X/00487e77476589a064b2d460018f4619012f9b98.png)

Basically, I just pass in the extra parameter `--wrapper_dir` to let the program know where I save the wrapper, no matter where.

Note: Suppose you structure is called `actin`. Then, you will need to name your wrapper script as `seg_actin.py` and inside `seg_actin.py`, the function name has to be `Workflow_actin`. Then, when pass in the `--workflow_name`, you need to use `actin`.

Let me know if you have more questions. Hopefully, the extra parameter `--wrapper_dir` can make the batch\_processing much easier. In my case, I usually put all my customized wrapper in the centralized place, and always use that directory for `--wrapper_dir` to keep my code organized.

Best,  
Jianxu

---

<div class="post-metadata">

**Author:** ![AidanF](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@AidanF](https://forum.allencell.org/u/AidanF)\
**Post date:** [November 21, 2020, 8:13pm UTC](https://forum.allencell.org/t/batch-processing-error/217/10 "2020-11-21T20:13:03Z")

</div>

Thanks so much, that did the trick! I can now run the code properly.

Cheers,  
Aidan
