python: Importing mayavi.mlab produces syntax error












0















Im trying to use mayavi to create 3d plots but when running my python script I get the following error:



 Traceback (most recent call last):
File "test.py", line 1, in <module>
import mayavi.mlab
File "C:Python37libsite-packagesmayavimlab.py", line 15, in <module>
from mayavi.core.common import process_ui_events
File "C:Python37libsite-packagesmayavicorecommon.py", line 16, in <module>
from apptools.persistence.state_pickler import create_instance
File "C:Python37libsite-packagesapptoolspersistencestate_pickler.py", line 1210

^
SyntaxError: invalid syntax


The function i'm trying to test:



  def create_3D(dataset):
#Extract the x, y ,z and von mises data from the numpy dataset and create an array for each.
xs = dataset[:,1]
ys = dataset[:,2]
zs = dataset[:,3]
v = dataset[:,4]

# Define the points in 3D space
# including color code based on value v
pts = mlab.points3d(xs, ys, zs , v)

# Triangulate based on X, Y with Delaunay 2D algorithm.
# Save resulting triangulation.
mesh = mlab.pipeline.delaunay2d(pts)

# Remove the point representation from the plot
pts.remove()

# Draw a surface based on the triangulation
surf = mlab.pipeline.surface(mesh)

# Simple plot.
mlab.xlabel("x")
mlab.ylabel("y")
mlab.zlabel("z")
mlab.show()


Any idea how I could fix this?
I followed the installation procedure suggested here
$ pip install mayavi



$ pip install PyQt5


I am using a 64bit version of python 3.7










share|improve this question













migrated from superuser.com Dec 21 '18 at 18:23


This question came from our site for computer enthusiasts and power users.




















    0















    Im trying to use mayavi to create 3d plots but when running my python script I get the following error:



     Traceback (most recent call last):
    File "test.py", line 1, in <module>
    import mayavi.mlab
    File "C:Python37libsite-packagesmayavimlab.py", line 15, in <module>
    from mayavi.core.common import process_ui_events
    File "C:Python37libsite-packagesmayavicorecommon.py", line 16, in <module>
    from apptools.persistence.state_pickler import create_instance
    File "C:Python37libsite-packagesapptoolspersistencestate_pickler.py", line 1210

    ^
    SyntaxError: invalid syntax


    The function i'm trying to test:



      def create_3D(dataset):
    #Extract the x, y ,z and von mises data from the numpy dataset and create an array for each.
    xs = dataset[:,1]
    ys = dataset[:,2]
    zs = dataset[:,3]
    v = dataset[:,4]

    # Define the points in 3D space
    # including color code based on value v
    pts = mlab.points3d(xs, ys, zs , v)

    # Triangulate based on X, Y with Delaunay 2D algorithm.
    # Save resulting triangulation.
    mesh = mlab.pipeline.delaunay2d(pts)

    # Remove the point representation from the plot
    pts.remove()

    # Draw a surface based on the triangulation
    surf = mlab.pipeline.surface(mesh)

    # Simple plot.
    mlab.xlabel("x")
    mlab.ylabel("y")
    mlab.zlabel("z")
    mlab.show()


    Any idea how I could fix this?
    I followed the installation procedure suggested here
    $ pip install mayavi



    $ pip install PyQt5


    I am using a 64bit version of python 3.7










    share|improve this question













    migrated from superuser.com Dec 21 '18 at 18:23


    This question came from our site for computer enthusiasts and power users.


















      0












      0








      0








      Im trying to use mayavi to create 3d plots but when running my python script I get the following error:



       Traceback (most recent call last):
      File "test.py", line 1, in <module>
      import mayavi.mlab
      File "C:Python37libsite-packagesmayavimlab.py", line 15, in <module>
      from mayavi.core.common import process_ui_events
      File "C:Python37libsite-packagesmayavicorecommon.py", line 16, in <module>
      from apptools.persistence.state_pickler import create_instance
      File "C:Python37libsite-packagesapptoolspersistencestate_pickler.py", line 1210

      ^
      SyntaxError: invalid syntax


      The function i'm trying to test:



        def create_3D(dataset):
      #Extract the x, y ,z and von mises data from the numpy dataset and create an array for each.
      xs = dataset[:,1]
      ys = dataset[:,2]
      zs = dataset[:,3]
      v = dataset[:,4]

      # Define the points in 3D space
      # including color code based on value v
      pts = mlab.points3d(xs, ys, zs , v)

      # Triangulate based on X, Y with Delaunay 2D algorithm.
      # Save resulting triangulation.
      mesh = mlab.pipeline.delaunay2d(pts)

      # Remove the point representation from the plot
      pts.remove()

      # Draw a surface based on the triangulation
      surf = mlab.pipeline.surface(mesh)

      # Simple plot.
      mlab.xlabel("x")
      mlab.ylabel("y")
      mlab.zlabel("z")
      mlab.show()


      Any idea how I could fix this?
      I followed the installation procedure suggested here
      $ pip install mayavi



      $ pip install PyQt5


      I am using a 64bit version of python 3.7










      share|improve this question














      Im trying to use mayavi to create 3d plots but when running my python script I get the following error:



       Traceback (most recent call last):
      File "test.py", line 1, in <module>
      import mayavi.mlab
      File "C:Python37libsite-packagesmayavimlab.py", line 15, in <module>
      from mayavi.core.common import process_ui_events
      File "C:Python37libsite-packagesmayavicorecommon.py", line 16, in <module>
      from apptools.persistence.state_pickler import create_instance
      File "C:Python37libsite-packagesapptoolspersistencestate_pickler.py", line 1210

      ^
      SyntaxError: invalid syntax


      The function i'm trying to test:



        def create_3D(dataset):
      #Extract the x, y ,z and von mises data from the numpy dataset and create an array for each.
      xs = dataset[:,1]
      ys = dataset[:,2]
      zs = dataset[:,3]
      v = dataset[:,4]

      # Define the points in 3D space
      # including color code based on value v
      pts = mlab.points3d(xs, ys, zs , v)

      # Triangulate based on X, Y with Delaunay 2D algorithm.
      # Save resulting triangulation.
      mesh = mlab.pipeline.delaunay2d(pts)

      # Remove the point representation from the plot
      pts.remove()

      # Draw a surface based on the triangulation
      surf = mlab.pipeline.surface(mesh)

      # Simple plot.
      mlab.xlabel("x")
      mlab.ylabel("y")
      mlab.zlabel("z")
      mlab.show()


      Any idea how I could fix this?
      I followed the installation procedure suggested here
      $ pip install mayavi



      $ pip install PyQt5


      I am using a 64bit version of python 3.7







      python pip






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 21 '18 at 16:56









      KrisHKrisH

      51




      51




      migrated from superuser.com Dec 21 '18 at 18:23


      This question came from our site for computer enthusiasts and power users.






      migrated from superuser.com Dec 21 '18 at 18:23


      This question came from our site for computer enthusiasts and power users.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          state_pickler.py is only 1022 lines long, it doesn't have line 1210.



          Remove the directory C:Python37libsite-packagesapptoolspersistence__pycache__ and try again.



          Try to reinstall apptools:



          pip install -U apptools





          share|improve this answer
























          • I've tried both but the same error is still occuring. I looked at the state_pickler.py file and the one the error is referencing is 2046 lines long.

            – KrisH
            Dec 22 '18 at 12:40











          • I just tried to install apptools for Python 2.7 and 3.5 — both brought state_pickler.py of 1022 lines. Looks like the file is already corrupted at your disk. Uninstall: pip uninstall apptools, delete directories: xdel C:Python37libsite-packagesapptools*, reinstall: pip install -U apptools.

            – phd
            Dec 22 '18 at 15:42











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53889284%2fpython-importing-mayavi-mlab-produces-syntax-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          state_pickler.py is only 1022 lines long, it doesn't have line 1210.



          Remove the directory C:Python37libsite-packagesapptoolspersistence__pycache__ and try again.



          Try to reinstall apptools:



          pip install -U apptools





          share|improve this answer
























          • I've tried both but the same error is still occuring. I looked at the state_pickler.py file and the one the error is referencing is 2046 lines long.

            – KrisH
            Dec 22 '18 at 12:40











          • I just tried to install apptools for Python 2.7 and 3.5 — both brought state_pickler.py of 1022 lines. Looks like the file is already corrupted at your disk. Uninstall: pip uninstall apptools, delete directories: xdel C:Python37libsite-packagesapptools*, reinstall: pip install -U apptools.

            – phd
            Dec 22 '18 at 15:42
















          0














          state_pickler.py is only 1022 lines long, it doesn't have line 1210.



          Remove the directory C:Python37libsite-packagesapptoolspersistence__pycache__ and try again.



          Try to reinstall apptools:



          pip install -U apptools





          share|improve this answer
























          • I've tried both but the same error is still occuring. I looked at the state_pickler.py file and the one the error is referencing is 2046 lines long.

            – KrisH
            Dec 22 '18 at 12:40











          • I just tried to install apptools for Python 2.7 and 3.5 — both brought state_pickler.py of 1022 lines. Looks like the file is already corrupted at your disk. Uninstall: pip uninstall apptools, delete directories: xdel C:Python37libsite-packagesapptools*, reinstall: pip install -U apptools.

            – phd
            Dec 22 '18 at 15:42














          0












          0








          0







          state_pickler.py is only 1022 lines long, it doesn't have line 1210.



          Remove the directory C:Python37libsite-packagesapptoolspersistence__pycache__ and try again.



          Try to reinstall apptools:



          pip install -U apptools





          share|improve this answer













          state_pickler.py is only 1022 lines long, it doesn't have line 1210.



          Remove the directory C:Python37libsite-packagesapptoolspersistence__pycache__ and try again.



          Try to reinstall apptools:



          pip install -U apptools






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 21 '18 at 19:00









          phdphd

          21.3k52442




          21.3k52442













          • I've tried both but the same error is still occuring. I looked at the state_pickler.py file and the one the error is referencing is 2046 lines long.

            – KrisH
            Dec 22 '18 at 12:40











          • I just tried to install apptools for Python 2.7 and 3.5 — both brought state_pickler.py of 1022 lines. Looks like the file is already corrupted at your disk. Uninstall: pip uninstall apptools, delete directories: xdel C:Python37libsite-packagesapptools*, reinstall: pip install -U apptools.

            – phd
            Dec 22 '18 at 15:42



















          • I've tried both but the same error is still occuring. I looked at the state_pickler.py file and the one the error is referencing is 2046 lines long.

            – KrisH
            Dec 22 '18 at 12:40











          • I just tried to install apptools for Python 2.7 and 3.5 — both brought state_pickler.py of 1022 lines. Looks like the file is already corrupted at your disk. Uninstall: pip uninstall apptools, delete directories: xdel C:Python37libsite-packagesapptools*, reinstall: pip install -U apptools.

            – phd
            Dec 22 '18 at 15:42

















          I've tried both but the same error is still occuring. I looked at the state_pickler.py file and the one the error is referencing is 2046 lines long.

          – KrisH
          Dec 22 '18 at 12:40





          I've tried both but the same error is still occuring. I looked at the state_pickler.py file and the one the error is referencing is 2046 lines long.

          – KrisH
          Dec 22 '18 at 12:40













          I just tried to install apptools for Python 2.7 and 3.5 — both brought state_pickler.py of 1022 lines. Looks like the file is already corrupted at your disk. Uninstall: pip uninstall apptools, delete directories: xdel C:Python37libsite-packagesapptools*, reinstall: pip install -U apptools.

          – phd
          Dec 22 '18 at 15:42





          I just tried to install apptools for Python 2.7 and 3.5 — both brought state_pickler.py of 1022 lines. Looks like the file is already corrupted at your disk. Uninstall: pip uninstall apptools, delete directories: xdel C:Python37libsite-packagesapptools*, reinstall: pip install -U apptools.

          – phd
          Dec 22 '18 at 15:42


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53889284%2fpython-importing-mayavi-mlab-produces-syntax-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Cáceres

          Lexus RX

          Plaza Victoria