# Error when pip installing in Slicer's python console

**URL:** <https://discourse.slicer.org/t/error-when-pip-installing-in-slicers-python-console/26669>\
**Category:** Development\
**Tags:** python, pip\
**Created:** [December 9, 2022, 9:22pm UTC](https://discourse.slicer.org/t/error-when-pip-installing-in-slicers-python-console/26669 "2022-12-09T21:22:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drouin-simon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drouin-simon/32/258_2.png) [@drouin-simon](https://discourse.slicer.org/u/drouin-simon)\
**Post date:** [December 9, 2022, 9:22pm UTC](https://discourse.slicer.org/t/error-when-pip-installing-in-slicers-python-console/26669/1 "2022-12-09T21:22:27Z")

</div>

Hi everyone,

I’m trying to pip install packages from the Python console in Slicer using the following commands:

```auto
import pip
pip.main(['install','pandas'])

```

This works perfectly well on macOS, but on Windows I get the following error (on both 10 and 11, on different machines and with different versions of Slicer: 4.11, 4.13 and 5.2.1):

```auto
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
--- Logging error ---
...

```

Does anyone else have the same problem?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [December 9, 2022, 9:56pm UTC](https://discourse.slicer.org/t/error-when-pip-installing-in-slicers-python-console/26669/2 "2022-12-09T21:56:49Z")

</div>

`pip.main()` is indeed old and deprecated within `pip`.

To install python packages using the python console in Slicer you should use `pip_install`. See the following resources below for examples and more details.

[https://slicer.readthedocs.io/en/latest/developer\_guide/slicer.html#slicer.util.pip\_install](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.util.pip_install)

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#install-a-python-package](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#install-a-python-package)

---

<div class="post-metadata">

**Author:** ![drouin-simon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drouin-simon/32/258_2.png) [@drouin-simon](https://discourse.slicer.org/u/drouin-simon)\
**Post date:** [December 12, 2022, 9:46pm UTC](https://discourse.slicer.org/t/error-when-pip-installing-in-slicers-python-console/26669/3 "2022-12-12T21:46:01Z")

</div>

Thanks a lot James, It solved my problem!
