# How to install a package

**URL:** <https://discourse.slicer.org/t/how-to-install-a-package/38410>\
**Category:** Support\
**Tags:** python\
**Created:** [September 17, 2024, 12:50pm UTC](https://discourse.slicer.org/t/how-to-install-a-package/38410 "2024-09-17T12:50:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [September 17, 2024, 12:50pm UTC](https://discourse.slicer.org/t/how-to-install-a-package/38410/1 "2024-09-17T12:50:17Z")

</div>

I am trying to install a package named spatial\_correlation-sampler, but the installation is not going through “error: legacy-install-failure”

I ran PythonSlicer.exe -m pip install spatial\_correlation-sampler

ModuleNotFoundError: No module named ‘spatial\_correlation\_sampler’

I tried installing but facing issue

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/a/2ab75fb29a9dbbc81e7f5c74ab2d11a3ee7ba087.png)

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [September 17, 2024, 2:53pm UTC](https://discourse.slicer.org/t/how-to-install-a-package/38410/2 "2024-09-17T14:53:35Z")

</div>

in that python window try  
`pip_install("spatial_correlation_sampler")`

and you will probbaly see the actual error why it is not installed?

---

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [September 18, 2024, 5:04am UTC](https://discourse.slicer.org/t/how-to-install-a-package/38410/3 "2024-09-18T05:04:20Z")

</div>

> [@muratmaga](#):
>
> pip\_install(“spatial\_correlation\_sampler”)

Hi @muratmaga I am still facing the same issue as mentioned first

“OSError: CUDA\_HOME environment variable is not set. Please set it to your CUDA install root.”

But I have set this as env variable

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [September 18, 2024, 3:00pm UTC](https://discourse.slicer.org/t/how-to-install-a-package/38410/4 "2024-09-18T15:00:37Z")

</div>

> [@muratmaga](#):
>
> pip\_install(“spatial\_correlation\_sampler”)

This is on my mac. It looks like this pywheel requires building from scratch, and it is not finding some of the build packages as far as I can tell. You will need to to dig deeper into the package to find what those are and why they are failing under slicer (or not being installed).

````auto
>>> pip_install("spatial_correlation_sampler")
Collecting spatial_correlation_sampler
  Downloading spatial_correlation_sampler-0.5.0.tar.gz (9.8 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Gettin
>>> g requirements to build wheel: finished with status 'error'
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3887, in pip_install
    _executePythonModule("pip", args)
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3848, in _executePythonModule
    logProcessOutput(proc)
  File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3814, in logProcessOutput
    raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command '['/Applications/Slicer.app/Contents/bin/../bin/PythonSlicer', '-m', 'pip', 'install', 'spatial_correlation_sampler']' returned non-zero exit status 1.```
````

---

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [September 19, 2024, 4:08am UTC](https://discourse.slicer.org/t/how-to-install-a-package/38410/5 "2024-09-19T04:08:17Z")

</div>

Currently I tried installing this package in windows , where the issue is coming, but when I install the same package where I have deployed slicer in ubuntu machine, there the installation didnt have any issue
