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
    • Login

    Installing numpy

    PYTHON Development
    0
    27
    17.0k
    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.
    • H
      Helper
      last edited by

      On 22/01/2016 at 08:34, xxxxxxxx wrote:

      Hey Niklas,

      Thanks for the explanation.
      Ok, so local import is not the best option.

      What is the best way not to use a local import?

      -Pim

      PS I do not see 1.4.11 in the Google Drive.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 22/01/2016 at 09:15, xxxxxxxx wrote:

        Hey Pim,

        well the only alternative you go is to actually install the package to the Cinema 4D python package
        location in the preferences folder  Cinema 4D R17_BlablaPreferences/library/python/packages/win64/
        or update your PYTHONPATH  environment variable.

        If you're going to distribute your plugin, you'll have to tell users to download and install the numpy
        package to the preferences folder so the plugin can import it.

        Originally posted by xxxxxxxx

        PS I do not see 1.4.11 in the Google Drive.

        localimport is on GitHub, not Google Drive. 🙂

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 22/01/2016 at 11:48, xxxxxxxx wrote:

          Great, it is working now.

          And sorry, I did not read your post correctly.
          It is indeed on GitHub.

          Could you tell something on how to compile the numpy source, so it can be used by cinema 4d.
          And I know I am asking very much, but can you do something similar for the opencv library?

          -Pim

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 22/01/2016 at 19:33, xxxxxxxx wrote:

            Hello Niklas
            Thanks for works.

            Can i ask, are you using of craftr or build instructions at http://www.scipy.org/scipylib/building/windows.html

            Pim, take to look at main pages of py modules how to build them
            You are asking about opencv - http://docs.opencv.org/master/d5/de5/tutorial_py_setup_in_windows.html#gsc.tab=0

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 23/01/2016 at 01:01, xxxxxxxx wrote:

              @Pim I wrote myself a little blog entry to not forget how to compile that stuff in the future.
              See https://niklasrosenstein.com/2016/01/compile-python-c-extensions-for-cinema-4d-r17-windows/
              Maybe you can just follow the instructions for OpenCV.

              @Ilya I'm not using Craftr to compile the Python modules, just the setup.py  that is delivered with
              Python package. I wasn't able to compile SciPy on Windows the last time though.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 23/01/2016 at 10:03, xxxxxxxx wrote:

                Great, I am going to try it.

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  On 25/01/2016 at 04:18, xxxxxxxx wrote:

                  Some questions:
                  1- do I need a python environment for the setuptools and for building?
                  2- where in this process do I use visual studio?
                  3- I have vs express 2012. I guess I must upgrade at least to 2013 for r17?
                  4- I guess for a dll, a .h files is also needed, or some sort of file to indicate what is in the dll?

                  Questions, questions, questions.
                  I hope that you can help and that I can do something in return.

                  -Pim

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 25/01/2016 at 05:10, xxxxxxxx wrote:

                    Progress:

                    Step 1. Install Setuptools
                    I installed it using Powershell and the correct link to python:

                    (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | c:\python27\python -
                    

                    Looking at step 2, I now realize that cinema 4d has already a complete python environment.
                    So, I have to install Setuptools, now using the cinema 4d python environment.

                    I now understand better the sub steps in your blog:

                    > set PY=C:\maxon\Cinema 4D R17\resources\modules\python\Python.win64.framework\python.exe
                    > cd setuptools-19.4\
                    > call "%PY%" setup.py install
                    
                    
                    I change 1.1 to my own correct folder and executed it in windows cmd.
                    I copied setuptools-19.6 (for me it is -6 and not -4) to the cinema python folder.
                    
                    
                    I did step 1.2 so now the current folder is the setuptools-19.6 folder.
                    I executed step 1.3 call "%PY%" setup.py install and there is goes wrong:
                    The filename, directory name, or volume label syntax is incorrect.
                    
                    What am I doing wrong?
                    -Pim
                    
                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      On 26/01/2016 at 03:30, xxxxxxxx wrote:

                      Progress 2.

                      I added python to the windows path.
                      Started up cmd, went to to the folder C:\Program Files\MAXON\CINEMA 4D R17\resource\modules\python\Python.win64.framework\setuptools-19.6
                      and gave the command:
                      > python setup.py install

                      "Finished processing dependencies for setuptools == 19.6"
                      So everything seems ok.

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

                        On 26/01/2016 at 04:19, xxxxxxxx wrote:

                        Progress 3.

                        Step 2. Modify your Python include and libs folder
                        The include and libs each contain a python27 subdirectory. 
                        You need to move the contents of this directory one level up so they files are directly in the include/libs folder.

                        Which folder should be moved one level up.
                        libs to include or include to libs.

                        Skip this one and I proceed to Step 3.

                        Step 3. Build the Python Extension
                        This example uses NumPy.  
                        First, download the source code from GitHub or another mirror and unpack it. 
                        After the package is built, a binary distribute will be created as a ZIP file.

                        I downloaded Numpy and unzipped it to 😄 emp
                        The I gave the command:
                        😄 emp\numpy-master\python setup.py install

                        This gave the error message:
                        RuntimeError: Running cythonize failed!

                        Awaiting an answer, I go back to plan B: Install the binary.

                        1 Reply Last reply Reply Quote 0
                        • H
                          Helper
                          last edited by

                          On 26/01/2016 at 05:47, xxxxxxxx wrote:

                          Progress 3.

                          Installing the binary.
                          - I downloaded pip and installed it using the get-pip.py script

                          - from http://www.lfd.uci.edu/~gohlke/pythonlibs/
                          I downloaded numpy-1.10.4+mkl-cp27-none-win_amd64.whl 
                          Note: cp27 indicates it is for python 2.7

                          Went to the folder where pip.exe is located and gave the command:
                          pip install 😄 emp\numpy-1.10.4+mkl-cp27-none-win_amd64.whl

                          Result: Successfully installed numpy-1.10.4

                          - started python and said import numpy

                          This gave the same result as described in this post.
                          So, I need to recompile numpy.
                          Back to square 1.

                          -Pim

                          1 Reply Last reply Reply Quote 0
                          • H
                            Helper
                            last edited by

                            On 26/01/2016 at 06:31, xxxxxxxx wrote:

                            I did step 1.2 so now the current folder is the setuptools-19.6 folder.
                            I executed step 1.3 call "%PY%" setup.py install and there is goes wrong:
                            The filename, directory name, or volume label syntax is incorrec

                            You actually need to omit the quotes, I'll correct that in my blog post. Just call %PY%

                            I downloaded Numpy and unzipped it to 😄 emp
                            The I gave the command:
                            😄 emp\numpy-master\python setup.py install

                            This gave the error message:
                            RuntimeError: Running cythonize failed!

                            Are you sure just plain "python" is the right Python installation (the on in the Cinema 4D framework)?
                            What's more to the error message? I didn't get a "cythonized failed" error.

                            [quote]Installing the binary.
                            - I downloaded pip and installed it using the get-pip.py script

                            - from http://www.lfd.uci.edu/~gohlke/pythonlibs/
                            I downloaded numpy-1.10.4+mkl-cp27-none-win_amd64.whl 
                            Note: cp27 indicates it is for python 2.7

                            Went to the folder where pip.exe is located and gave the command:
                            pip install 😄 emp\numpy-1.10.4+mkl-cp27-none-win_amd64.whl

                            Result: Successfully installed numpy-1.10.4

                            - started python and said import numpy

                            This gave the same result as described in this post.
                            So, I need to recompile numpy.
                            Back to square 1.

                            Might be coming from the fact that its not compiled with the right Visual Studio version.
                            I just read in the post you linked that Andreas said it must be VS2012 SP4, interestingly it
                            worked with VS2008 here too.

                            1 Reply Last reply Reply Quote 0
                            • H
                              Helper
                              last edited by

                              On 26/01/2016 at 09:15, xxxxxxxx wrote:

                              See below the full error messages.

                              Python links to the cinema 4d python environment / folders:
                              C:\Program Files\MAXON\CINEMA 4D R17\resource\modules\python\Python.win64.framework\python.exe

                              The big question is: how to compiled with the right Visual Studio version?

                              1 Reply Last reply Reply Quote 0
                              • H
                                Helper
                                last edited by

                                On 26/01/2016 at 09:50, xxxxxxxx wrote:

                                FYI. I tried to reply to your PM pgrooff. But your inbox is full.

                                I personally don't bother to compile these things myself.
                                I use many of the common Python libraries via Anaconda.
                                And the precompiled version of opencv3.1.exe installs both the C++ and Python libraries.

                                The quick and simple way to install this stuff:
                                -Install Anaconda(or python 2.7 if you prefer) and install opencv.exe with their installers
                                -Then put the opencv cv2.pyd file in the Anaconda site-packages folder
                                -Then copy the entire Anaconada folder to the C4D folder where Python.win64.framework is
                                -Rename Python.win64.framework to: Python.win64.framework_original
                                -Rename the copied Anaconda folder to:Python.win64.framework
                                -Boom...Done
                                No fuss...no muss...no cocoanuts.😉
                                I only compile things myself when I have absolutely no other choice.

                                *** Public Service Announcement Here ***
                                It might be frowned upon by Maxon to replace their python installation with another python installation.
                                But it's the easiest way to do it. And so far I've never seen any problems doing it.

                                -ScottA

                                1 Reply Last reply Reply Quote 0
                                • H
                                  Helper
                                  last edited by

                                  On 29/01/2016 at 09:33, xxxxxxxx wrote:

                                  Sorry, my fault (although 5 is a bit small!).

                                  Thanks for the information. I will try it and let you know!

                                  -Pim

                                  1 Reply Last reply Reply Quote 0
                                  • H
                                    Helper
                                    last edited by

                                    On 29/05/2016 at 01:56, xxxxxxxx wrote:

                                    Niklas,

                                    Thanks for all this.
                                    There is one more thing missing....isn't there always!
                                    Are you going to put up a numpy for R17 (2.7) on a mac?
                                    I don't see it.

                                    1 Reply Last reply Reply Quote 0
                                    • H
                                      Helper
                                      last edited by

                                      On 30/05/2016 at 16:00, xxxxxxxx wrote:

                                      Just added numpy-1.11.0 for Python 2.7 (Mac) here: https://public.niklasrosenstein.com/PythonBinaries/numpy-1.11.0/

                                      1 Reply Last reply Reply Quote 0
                                      • H
                                        Helper
                                        last edited by

                                        On 03/06/2016 at 00:22, xxxxxxxx wrote:

                                        Niklas,

                                        Thanks for all you do here!

                                        Chris

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post