# When I add module path, unexpected errors have occured - "No module named \*\*\*\*"

**URL:** <https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999>\
**Category:** Development\
**Tags:** extensions-manager\
**Created:** [September 4, 2017, 12:21pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999 "2017-09-04T12:21:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![shenziheng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shenziheng/32/476_2.png) [@shenziheng](https://discourse.slicer.org/u/shenziheng)\
**Post date:** [September 4, 2017, 12:21pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/1 "2017-09-04T12:21:27Z")

</div>

Hello,  
I use ExtensionWizard to create a loadable module, and then use Cmake & Visual Studio to build it.  
Lastly, I add its path to Additional module paths in Slicer Setting.  
But, when I restart 3DSlcier,there are some errors in Python Interactor,like:

> > No module named vtkSlicerIGS\_dev1ModuleLogicPython  
> > No module named qSlicerIGS\_dev1ModuleWidgetsPythonQt  
> > I really don’t know why.  
> > I’d appreciate it if anyone can help me solve the problem.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 4, 2017, 12:22pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/2 "2017-09-04T12:22:25Z")

</div>

File name must exactly match the module class name.

---

<div class="post-metadata">

**Author:** ![shenziheng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shenziheng/32/476_2.png) [@shenziheng](https://discourse.slicer.org/u/shenziheng)\
**Post date:** [September 4, 2017, 2:57pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/3 "2017-09-04T14:57:56Z")

</div>

I’m sure the file name exactly matches with the module classname.  
They are all named by ‘IGS\_dev1’.  
I also make another try, and test a scripted module. It is OK.  
So, I really don’t know why this error just occures in loadable module.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 4, 2017, 4:50pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/4 "2017-09-04T16:50:13Z")

</div>

What directories have you added to the additional module paths?

---

<div class="post-metadata">

**Author:** ![shenziheng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shenziheng/32/476_2.png) [@shenziheng](https://discourse.slicer.org/u/shenziheng)\
**Post date:** [September 5, 2017, 9:30am UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/5 "2017-09-05T09:30:24Z")

</div>

lassoan, it’s really kind of you.  
Here, I introduce more detailed information about the error.  
Looking forward to your reply.

 ![AdditionModulePath](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/5/d50699b3731ab2ac0bb27b37a65037b54f7de3cb.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 5, 2017, 4:11pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/6 "2017-09-05T16:11:40Z")

</div>

Which Slicer version did you build?  
Did you try to load the module into the Slicer version that you built?  
Why your module build tree is inside a Slicer-build tree? (D:\Slicer4D\Slicer-build)  
Do you have any errors when you build your module?  
Do you have module logic and widget classes?  
If you build an existing extension (such as [https://github.com/SlicerHeart/SlicerHeart](https://github.com/SlicerHeart/SlicerHeart)) do you get similar errors?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [September 5, 2017, 4:59pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/7 "2017-09-05T16:59:58Z")

</div>

On windows, simply adding module path is not enough to have the environment updated.

Waiting we address issue [#4183](https://issues.slicer.org/view.php?id=4183), I think possible way around are to:

- create an extension package and install it as explained in [Installing an extension without network connection](https://www.slicer.org/wiki/Documentation/4.6/SlicerApplication/ExtensionsManager#Installing_an_extension_without_network_connection)

or

- update `PATH` and `PYTHONPATH` before starting Slicer

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 5, 2017, 7:25pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/8 "2017-09-05T19:25:49Z")

</div>

On Windows we always just add the Debug/Release directory to the additional module paths in Slicer application settings. I don’t recall ever seeing this error. Is updating Python paths a new requirement?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [September 5, 2017, 7:30pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/9 "2017-09-05T19:30:05Z")

</div>

> [@lassoan](#):
>
> I don’t recall ever seeing this error. Is updating Python paths a new requirement?

No. This was a general remarks about paths.

Since the extension we are talking about doesn’t have any dependencies (beside of Slicer), you are right it should just work.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 5, 2017, 7:49pm UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/10 "2017-09-05T19:49:41Z")

</div>

I see, thanks.

For extensions that depend on other extensions, the generated “additional launcher settings” ini file takes care of all Python paths (it recursively collects all necessary paths and puts it into the ini file). I’ve implemented this 1-2 months ago.

---

<div class="post-metadata">

**Author:** ![shenziheng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shenziheng/32/476_2.png) [@shenziheng](https://discourse.slicer.org/u/shenziheng)\
**Post date:** [September 6, 2017, 3:53am UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/11 "2017-09-06T03:53:42Z")

</div>

@lassoan@jcfr  
Thank you very much.  
I have solved the problem in another way.  
I adjusted my file path of MyExtension from D:/Slicer4D/Slicer-build/MyExtension to D:/MyExtension.  
Luckily,the extension/module worked.  
Though I don’t know why it works, I guess there maybe a limited length for file path in windows OS.

---

<div class="post-metadata">

**Author:** ![shenziheng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shenziheng/32/476_2.png) [@shenziheng](https://discourse.slicer.org/u/shenziheng)\
**Post date:** [September 6, 2017, 4:06am UTC](https://discourse.slicer.org/t/when-i-add-module-path-unexpected-errors-have-occured-no-module-named/999/12 "2017-09-06T04:06:57Z")

</div>

Slicer 4.7.0  
yes, I haved tried.  
I am sorry that I didn’t obey the suggestion that official manual give.  
No, the building process of Cmake and Visual Studio is OK.  
yes, I’m sure I have logic and widget classes.  
I ever built an extension - Slicer-IGT, but no errors occured.
