Please help with installing Pandas into Slicer Python

I ran the following from the PythonSlicer console:

from slicer.util import pip_install
pip_install("pandas>2")

and received the following error:

Traceback (most recent call last):
 File "<console>", line 1, in <module>
 File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3571, in pip_install
   _executePythonModule('pip', args)
 File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3533, in _executePythonModule
   logProcessOutput(proc)
 File "/Applications/Slicer.app/Contents/bin/Python/slicer/util.py", line 3502, 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', 'pandas>2']' returned non-zero exit status 1.

Does anyone more experienced than I am know what might be going on? Thanks!

Hi @Misterkim,

pandas usually installs fine for 3D Slicer.
What you can test is opening the command prompt and run the pip install command manually to get more information on what went wrong.

In your case something like :

/Applications/Slicer.app/Contents/bin/PythonSlicer -m pip install pandas>2

CalledProcessError Traceback (most recent call last)
Cell In[36], line 1
----> 1 ut.pip_install(‘nibabel’)

File /Applications/Slicer.app/Contents/bin/Python/slicer/util.py:3887, in pip_install(requirements)
3884 else:
3885 raise ValueError(“pip_install requirement input must be string or list”)
→ 3887 _executePythonModule(“pip”, args)

File /Applications/Slicer.app/Contents/bin/Python/slicer/util.py:3848, in _executePythonModule(module, args)
3846 commandLine = [pythonSlicerExecutablePath, “-m”, module, *args]
3847 proc = launchConsoleProcess(commandLine, useStartupEnvironment=False)
→ 3848 logProcessOutput(proc)

File /Applications/Slicer.app/Contents/bin/Python/slicer/util.py:3814, in logProcessOutput(proc)
3812 retcode = proc.returncode
3813 if retcode != 0:
→ 3814 raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)

CalledProcessError: Command ‘[’/Applications/Slicer.app/Contents/bin/…/bin/PythonSlicer’, ‘-m’, ‘pip’, ‘install’, ‘nibabel’]’ returned non-zero exit status 1.

I also encountered the same problem…
我也遇到了同样的问题