# Error while enumerating installed pacages when trying to remote attach from VS code

**URL:** <https://discourse.slicer.org/t/error-while-enumerating-installed-pacages-when-trying-to-remote-attach-from-vs-code/31711>\
**Category:** Development\
**Tags:** python\
**Created:** [September 14, 2023, 1:36pm UTC](https://discourse.slicer.org/t/error-while-enumerating-installed-pacages-when-trying-to-remote-attach-from-vs-code/31711 "2023-09-14T13:36:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Cheng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/samuel_cheng/32/18355_2.png) [@Samuel\_Cheng](https://discourse.slicer.org/u/Samuel_Cheng)\
**Post date:** [September 14, 2023, 1:36pm UTC](https://discourse.slicer.org/t/error-while-enumerating-installed-pacages-when-trying-to-remote-attach-from-vs-code/31711/1 "2023-09-14T13:36:37Z")

</div>

I am a newbie to Slicer extension development and tried to set up python debugging with vs code following the github [instruction](https://github.com/SlicerRt/SlicerDebuggingTools). But I got the error as shown below in the Slicer Python Console. I tested it on Ubuntu 20.04, Slicer 5.4.0 r31938 / 311cb26, and VS code 1.82.1.

Thanks on advance

> Python 3.9.10 (main, Aug 19 2023, 11:01:17)  
> [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux2
> 
> > > >
> 
> E+00008.717: Error while enumerating installed packages.
> 
> ```
> Traceback (most recent call last):
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/debugpy/common/log.py", line 361, in get_environment_description
> report(" {0}=={1}\n", pkg.name, pkg.version)
> AttributeError: 'PathDistribution' object has no attribute 'name'
>          
> Stack where logged:
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/slicer.org/Extensions-31938/DebuggingTools/lib/Slicer-5.4/qt-scripted-modules/PyDevRemoteDebug.py", line 248, in onConnect
> self.logic.connect()
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/slicer.org/Extensions-31938/DebuggingTools/lib/Slicer-5.4/qt-scripted-modules/PyDevRemoteDebug.py", line 578, in connect
> debugpy.listen(self.getPortNumber())
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/debugpy/public_api.py", line 31, in wrapper
> return wrapped(*args, **kwargs)
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/debugpy/server/api.py", line 122, in debug
> ensure_logging()
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/debugpy/server/api.py", line 61, in ensure_logging
> log.describe_environment("Initial environment:")
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/debugpy/common/log.py", line 369, in describe_environment
> info("{0}", get_environment_description(header))
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/debugpy/common/log.py", line 363, in get_environment_description
> swallow_exception("Error while enumerating installed packages.")
> File "/home/phsamuel/Downloads/Slicer-5.4.0-linux-amd64/lib/Python/lib/python3.9/site-packages/debugpy/common/log.py", line 215, in swallow_exception
> _exception(format_string, *args, **kwargs)
> 
> ```

---

<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 18, 2023, 12:53pm UTC](https://discourse.slicer.org/t/error-while-enumerating-installed-pacages-when-trying-to-remote-attach-from-vs-code/31711/2 "2023-09-18T12:53:55Z")

</div>

> [@Samuel\_Cheng](#):
>
> `swallow_exception("Error while enumerating installed packages.")`

It seems that debugpy developers [messed up something last week or the week before](https://github.com/microsoft/debugpy/issues/1379), so there were some broken versions. I’ve just tested the debugger in VS Code and everything works (with debugpy latest version 1.8.0).

You already have debugpy installed in Slicer’s Python environment, so if you want to get the latest version then you can run `pip_install('debugpy --upgrade')` in the Slicer Python console.
