Installing Additional Python Packages in Sim4Life Environment
-
Hi all,
I have been working with the Sim4Life Visual Studio Code Extension. While some modules like
numpywork perfectly, others give a "ModuleNotFoundError."I believe this is because I am running my script in the Sim4Life environment, and certain packages are not included by default.
My question is: Is there a way to install additional packages within the Sim4Life environment so I can use them in my scripts?
Any suggestions or guidance would be greatly appreciated!

-
A andrea_h marked this topic as a question on
-
yes, you can install additional packages in the Python environment that Sim4Life is running. Simply type this in a console (using e.g. "cmd.exe"):
"C:\Program Files\Sim4Life_xyz\Python\python.exe" -m pip install package_nameadjusting for Sim4Life's version number and your package_name.
You most likely won't even need to restart Sim4Life. -
S Sylvain has marked this topic as solved on
-
yes, you can install additional packages in the Python environment that Sim4Life is running. Simply type this in a console (using e.g. "cmd.exe"):
"C:\Program Files\Sim4Life_xyz\Python\python.exe" -m pip install package_nameadjusting for Sim4Life's version number and your package_name.
You most likely won't even need to restart Sim4Life. -
@Sylvain I would like to add new packages too (e.g., dipy), but I don't have such directory in my computer, is it a problem?
Despite the fact I have not a python.exe, I can run Python script in Sim4Life.
Thanks in advance! -
@gc00 try typing this in Sim4Life's console (View -> Console), it will give you a clue as to the location of the Python directory:
import os print(os.__file__) -
@gc00 try typing this in Sim4Life's console (View -> Console), it will give you a clue as to the location of the Python directory:
import os print(os.__file__) -
then it means that you can find python.exe in this directory:
C:\Program Files\Sim4Life_7.2.3.12730\PythonSo you should be able to run:
"C:\Program Files\Sim4Life_7.2.3.12730\Python\python.exe" -m pip install package_namefrom Windows' console (NOT the Console of Sim4Life)
-
then it means that you can find python.exe in this directory:
C:\Program Files\Sim4Life_7.2.3.12730\PythonSo you should be able to run:
"C:\Program Files\Sim4Life_7.2.3.12730\Python\python.exe" -m pip install package_namefrom Windows' console (NOT the Console of Sim4Life)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login