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 numpy

    Pythonista
    3
    4
    2183
    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.
    • Danil Dmitriev
      Danil Dmitriev last edited by

      Hello, I bought a pythonista program and ran into a problem. When I try to import the numpy: import numpy as np library, the program throws the following error: name 'random_sample' is not defined. How to solve this problem? Thanks.

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        Did you try to a numpy update ? That causes problems since you cannot update numpy.

        The other problem people have is that since numpy can take a while to load, if you can cancel a script, it might be only partially imported. Try force quitting the app and try again.

        If that doesn't work, push the Print Traceback button, and paste the full Traceback to the forum.

        1 Reply Last reply Reply Quote 0
        • jgoalby
          jgoalby last edited by

          I haven’t used numpy in Pythonista and I don’t have your code to work from so could be completely off the mark here, but if you do import numpy as np, wouldn’t the random_sample need to be referenced as np.random_sample?

          A quick test got this to work:

          import numpy as np
          
          print(np.random.random_sample())
          
          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            he is getting an error during import.

            This was previously discussed on the forum, and in that case it was a failed import, fixed by a force quit of pythonista

            https://forum.omz-software.com/topic/1372/import-numpy-fails/3

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