1

My problem is that i can't import numpy into my processing.py project. When I try to import it i get the error "No module named numpy". What can I do?

15
  • Python 2 or Python 3? Make sure numpy is installed for whatever Python you are using (2 or 3). Commented May 8, 2019 at 12:23
  • have you installed numpy? pip install numpy Commented May 8, 2019 at 12:23
  • Have you installed the package in your virtual envronment(if using one) or your system through pip? Commented May 8, 2019 at 12:24
  • 1
    It's just impossible to help you with this few details. Just check numpy's getting started Commented May 8, 2019 at 12:30
  • 1
    @HurjuiIonut After seeing John Coleman's answer I realise you meant the Processing Python mode, which indeed uses Jython. If it's only rendering you need with using Processing like functions in Python consider trying pyprocessing or p5.py at this point in time. Commented May 8, 2019 at 14:39

1 Answer 1

6

Processing is built on top of the JVM so the Python mode of Processing uses Jython rather than CPython. Unfortunately, numpy doesn't support Jython. Thus, you are trying to do something which is impossible. From the SciPy FAQ:

Q: Does NumpPy/SciPy work with Jython or C#/.Net?

A: No, neither are supported. Jython never worked, because it runs on top of the Java Virtual Machine and has no way to interface with extensions written in C for the standard Python (CPython) interpreter."

This question discusses some alternatives to numpy which can be used from Jython. The official Jython FAQ recommends JNumeric.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.