0

There is a bunch of pre-made code I simply have to run. However, the code requires the module NumPy, which for some reason is not installed. I am using Geany for the Python code, and when I click compile, the console states:

"Traceback (most recent call last):

 File "chi2Fit.py", line 1, in <module>

  import numpy as np

ImportError: No module named 'numpy'

I really tried to look it up, and I found the zipped NumPy packages on SourceForge, but I cannot install them. I am using Windows 10 (Virtual Machine is buggy, unfortunately). I usually run my Python programs by compiling them directly and don't use the commands within the console (so honestly I don't know how to open the command line. Yes, I am a beginner). What is the explanation?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
DominikR
  • 59
  • 1
  • 10
  • What does *"Virtual Machine"* refer to? [Virtual PC](https://en.wikipedia.org/wiki/Windows_Virtual_PC)? [virtualenv](http://pypi.python.org/pypi/virtualenv)? [VirtualBox](https://en.wikipedia.org/wiki/VirtualBox)? Something else? – Peter Mortensen Jan 06 '21 at 21:26
  • @PeterMortensen I was referring to VirtualBox, I think. Then again, this is almost 5 years old. I just remember I was having issues with some virtual Linux machine I ran on my Windows computer. – DominikR Jan 07 '21 at 13:03

2 Answers2

1

Geany is just an editor, with the ability to run commands and such from menus and buttons. So you should be able to run this code 'by compiling them directly'. If that works while the 'geany compile' does not, then you need to check the 'compile' command. Is it using the right Python?

'compile' really doesn't make sense with Python code. You are just executing a script.

NumPy is a large package that does include compiled components. So installing it requires more than downloading a ZIP file. On Windows it is usually best to install one of the precompiled packages. Anaconda is popular one.

But we know nothing about this pre-made code, and whether it has included the necessary modules or not. You need to find out from the source of that code what is needed to run it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
hpaulj
  • 221,503
  • 14
  • 230
  • 353
  • Well, the button on top of geany says "compile", so yeah... but it does mean executing a script, after all. It is basically just statistics; I need numpy, math, matplotlib.pyplot, scipy.optimize. I'm installing Anaconda right now. Will that solve the problem? – DominikR Apr 20 '16 at 16:49
  • As the 'completely unhelpful' answer said, you need one of the pre-compiled scientific computing packages. – hpaulj Apr 20 '16 at 16:52
  • So anaconda is fine? – DominikR Apr 20 '16 at 17:04
  • Yes, it is. But it's not an issue of Geany it's an issue of your Python installation. – frlan Apr 21 '16 at 07:35
-1

You need to figure out how to install NumPy. It depends on what OS you are using.

There are pre-compiled packages for Windows. There is plenty of information here on SO (e.g., Installing NumPy on Windows) or you can use Google.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Plamenk
  • 13
  • 6