Pip in nightly build not working

Hi,

for another problem I had I was upgrading my Slicer install to the nightly build version. Unfortunately I have problems running the pip installer in the Python Interactive console. I am running the nightly version on a windows system and get the following error:

The same command works fine with the release version of Slicer. Is there a new way for installing packages?

Thanks!

pip.main was removed in newer versions of pip. For interactive/one-shot use you can run it from the command line in a Slicer-aware shell (look at Slicer --launcher-show-set-environment-commands); for dependency installation as part of a module build, you can shell out from your CMake build.

That’s unfortunate. It makes more cumbersome to install packages from Slicer modules.

Would it make sense to add Slicer launcher application shortcut for pip? Pip could then launched as: Slicer.exe --pip install…

1 Like

Slicer.exe --pip install…

Or SlicerPython --pip ... that way user would have terminal output on windows.

I think Slicer --launch already prefers binaries in Slicer’s PATH, so the other option is to document pip as Slicer --launch pip (only a few more characters).

2 Likes

pip.main can be found in pip._internal

I was able to utilize it in my project as shown:

from pip._internal import main as pipmain
pipmain(['install', 'scipy'])

However, using pip within your program is strongly discouraged.
An alternative method, such as spoken to in this thread, would be extremely helpful.

1 Like

I’ve added a ticket to add pip to Slicer install package: https://issues.slicer.org/view.php?id=4586

1 Like