omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Error importing numpy

    Pythonista
    numpy
    2
    4
    1657
    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.
    • Flavin
      Flavin last edited by

      I wrote a script in Pythonista that failed on the first line, importing numpy. I tried just running that import line in the console, and it also failed.

      >>> import numpy as np
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/var/containers/Bundle/Application/2D5E7A73-E48B-4CA6-8789-B800F22ADF1D/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/numpy/__init__.py", line 172, in <module>
          from . import random
        File "/var/containers/Bundle/Application/2D5E7A73-E48B-4CA6-8789-B800F22ADF1D/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/numpy/random/__init__.py", line 104, in <module>
          ranf = random = sample = random_sample
      NameError: name 'random_sample' is not defined
      

      Is this a bug? I haven’t installed anything custom and this seems to be attempting to use the packaged numpy installation.

      mikael 1 Reply Last reply Reply Quote 0
      • mikael
        mikael @Flavin last edited by

        @Flavin, have you tried restarting Pythonista?

        Flavin 1 Reply Last reply Reply Quote 0
        • Flavin
          Flavin @mikael last edited by

          @mikael I have now. That seems to have fixed it.

          mikael 1 Reply Last reply Reply Quote 0
          • mikael
            mikael @Flavin last edited by

            @Flavin, excellent. It has been noted here before that numpy is such a large and complex library that it may fail to load properly.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors