Import NumPy?
-
Hey guys,
Context: I'm completely new to scripting in Cinema4D and I've just spent the last 30 minutes searching this forum for "numpy" and unfortunately it seems like I was never able to get a clear answer. Apologies in advance if you feel like the topic has already been covered extensively.
Goal: I would like to import the NumPy module in C4D 2024.0.1 and use the full extent of its methods and functions. Is there a way of doing so? If not, does the fact that I won't be redistributing my script help, as in making it more of a possibility?... as in, a more "hack-ey" way to go about it.
Thank you very much for your time and assistance! I really appreciate it
-
Hi @justinleduc with c4dpy this is pretty straightforward. Run it once to get a license assigned to it, then once it's licensed run the next commands:
c4dpy -m ensurepip
to install pip and thenc4dpy -m pip install numpy
.Then you can start Cinema 4D and you will be able to use numpy within Cinema 4D.
Final note as said in Python Libraries Manual.MAXON cannot provide support for third party libraries written for CPython and their compatibility with the Python interpreters shipped with Cinema 4D. While our Python interpreters are derived from the respective CPython builds, they are not identical to them. Popular Python libraries as for example numpy might not work at all or only with a reduced feature set. The Cinema 4D Python interpreters are provided as-is and not meant to be fully CPython compliant.
Cheers,
Maxime. -
@m_adam Ah! Wonderful! Thank you so very much Maxime! I really appreciate it.
-
Hi, I'm also trying to install numpy, but after registering c4dpy I'm getting a syntax error after running "c4dpy -m ensurepip" command.
c4dpy -m ensurepip
(null) File "<stdin>", line 1
c4dpy -m ensurepip
^^^^^^^^^
(null)SyntaxError: invalid syntax