Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    How to install pip and numpy for Cinema 4D 2024 on MacOS?

    Cinema 4D SDK
    python macos
    4
    6
    1.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      Jweffrey
      last edited by

      I am using Cinema 4D 2024 and I have downloaded get-pip.py. I entered the Cinema 4D 2024 folder and then typed 'c4dpy -m get-pip.py' in terminal but it returns 'command not found: c4dpy'. How can I solve this? I have to install numpy for ePMV.

      1 Reply Last reply Reply Quote 0
      • C
        cybor09
        last edited by

        Hi!

        Maybe this video can help you:

        https://lesterbanks.com/2019/10/how-to-install-a-3rd-party-python-library-in-cinema-4d/

        1 Reply Last reply Reply Quote 0
        • M
          m_adam
          last edited by

          Hi @Jweffrey to access the executable of any packaged application on mac you need to do:

          1. Right-click on c4dpy.app and select Show Package Contents.
          2. Navigate to the Contents/MacOS directory.
          3. Drag the c4dpy file into the Terminal window and press enter.
          4. c4dpy should run without error and ask your MyMaxon account. Next start you will not need to login again.

          Once you have done that you can do again step 1, 2, 3 but instead of pressing enter, either type c4dpy.app/Contents/MacOs/c4dpy get-pip.py to execute a file or the command line c4dpy.app/Contents/MacOs/c4dpy -m ensurepip.
          Then you will need to run the command c4dpy.app/Contents/MacOs/c4dpy -m pip install numpy.

          With that's said we do not provide support for 3rd party libraries, so if it work, that's nice if it does not, Maxon Support stop here.
          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          G 1 Reply Last reply Reply Quote 0
          • G
            gupon @m_adam
            last edited by ferdinand

            @m_adam Hi Maxime.
            Sorry for cutting in. I followed these instructions, and c4dpy authentication seems OK.
            But "c4dpy -m ensure pip" always give me errors, and I can't import numpy.
            Is there anything I can do after this?

            /Applications/Maxon\ Cinema\ 4D\ 2024/c4dpy.app/Contents/MacOS/c4dpy -m ensurepip
            sysctl: No such file or directory
            sysctl: No such file or directory
            /Applications/Maxon Cinema 4D 2024/c4dpy.app/Contents/MacOS/c4dpy: can't open file 'ignore::DeprecationWarning': no such file or directory (file:///Applications/Maxon Cinema 4D 2024/resource/modules/volumes/libs/macOS_universal/ignore::DeprecationWarning)
            (null)Traceback (most recent call last):
            (null)  File "<frozen runpy>", line 198, in _run_module_as_main
            (null)  File "<frozen runpy>", line 88, in _run_code
            (null)  File "/Applications/Maxon Cinema 4D 2024/resource/modules/python/libs/python311.macos.framework/lib/python3.11/ensurepip/__main__.py", line 5, in <module>
            (null)    sys.exit(ensurepip._main())
            (null)             ^^^^^^^^^^^^^^^^^
            (null)  File "/Applications/Maxon Cinema 4D 2024/resource/modules/python/libs/python311.macos.framework/lib/python3.11/ensurepip/__init__.py", line 286, in _main
            (null)    return _bootstrap(
            (null)           ^^^^^^^^^^^
            (null)  File "/Applications/Maxon Cinema 4D 2024/resource/modules/python/libs/python311.macos.framework/lib/python3.11/ensurepip/__init__.py", line 202, in _bootstrap
            (null)    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
            (null)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            (null)  File "/Applications/Maxon Cinema 4D 2024/resource/modules/python/libs/python311.macos.framework/lib/python3.11/ensurepip/__init__.py", line 103, in _run_pip
            (null)    return subprocess.run(cmd, check=True).returncode
            (null)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            (null)  File "/Applications/Maxon Cinema 4D 2024/resource/modules/python/libs/python311.macos.framework/lib/python3.11/subprocess.py", line 571, in run
            (null)    raise CalledProcessError(retcode, process.args,
            (null)subprocess.CalledProcessError: Command '['/Applications/Maxon Cinema 4D 2024/c4dpy.app/Contents/MacOS/c4dpy', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/var/folders/wg/w0xrgt954qz99qpz4tg69bf40000gn/T/tmplj1265bd/setuptools-65.5.0-py3-none-any.whl\', \'/var/folders/wg/w0xrgt954qz99qpz4tg69bf40000gn/T/tmplj1265bd/pip-23.1.2-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/var/folders/wg/w0xrgt954qz99qpz4tg69bf40000gn/T/tmplj1265bd\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 2.
            
            
            G 1 Reply Last reply Reply Quote 0
            • G
              gupon @gupon
              last edited by gupon

              I made a little progress and succeeded installing pip, by setting permissions with chmod to /Applications/Maxon Cinema 4D 2024/resource/modules and c4dpy itself, and using downloaded "get-pip.py" instead.
              But I can't still install numpy yet...

              c4dpy -m pip install numpy
              sysctl: No such file or directory
              Collecting numpy
                Using cached numpy-1.26.2-cp311-cp311-macosx_11_0_arm64.whl.metadata (115 kB)
              Using cached numpy-1.26.2-cp311-cp311-macosx_11_0_arm64.whl (14.0 MB)
              Installing collected packages: numpy
              ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: 'lib'
              Check the permissions.
              

              I wish I could run the command with "sudo", but c4dpy Authentication Error appears...

              sudo c4dpy -m pip install numpy
              Error running authentication: Please sign into the Maxon App [license_maxonapp.cpp(689)]
              Open the ApplicationManager to assign a license: mxapp://localhost/open/v1?source=net.maxon.cinema4d.cmdline&version=2024.000
              Please fix the license in the MaxonApp, press return to try again:
              

              I think c4dpy is already authenticated, and the license is assigned to C4D 2024 in Maxon App, which is opened from the link.

              Is there anything I can try in this situation?
              Thank you.

              1 Reply Last reply Reply Quote 0
              • G
                gupon
                last edited by gupon

                I apologize for posting repeatedly. I think I succeeded in installing numpy and other libraries as well.
                In case for someone in same situation, I would like to share my own case resolution.

                After installing pip, not from c4dpy, but using the python below worked:
                /Applications/Maxon Cinema 4D 2024/resource/modules/python/libs/python311.macos.framework/python

                and executed the command like python -m pip install numpy normally.
                And worked inside C4D properly.

                If there are any inaccuracies or clear errors, I would appreciate it if you could point them out. Thank you in advance.

                1 Reply Last reply Reply Quote 3
                • i_mazlovI i_mazlov referenced this topic on
                • First post
                  Last post