python-novice-inflammation icon indicating copy to clipboard operation
python-novice-inflammation copied to clipboard

Ep. 11: Issues with numpy

Open dakane1 opened this issue 4 years ago • 4 comments

I was attempting to teach episode 11 and ran into this error with: $ python ../code/readings_04.py --mean inflammation-01.csv and I get:

$python readings_04.py --mean ../data/inflammation-01.csv Traceback (most recent call last): File "readings_04.py", line 2, in import numpy ImportError: No module named numpy

I have googled and read stackoverflow but can't figure out what is going wrong...never seen this before.

dakane1 avatar Nov 15 '19 22:11 dakane1

HI @dakane1 . It looks possible that the version/instance of Python you are running at the commandline does not have numpy installed. Were you able to use import numpy in Jupyter Notebook? It could be the system Python you are using at that prompt is different than the one that Jupyter Notebook is using and does not have numpy installed.

ldko avatar Nov 18 '19 18:11 ldko

Hmm, yes it worked fine in Jupyter Notebook. I will do some testing to see what my command line is set to. Thanks for pointing me in a direction to investigate further :-).

dakane1 avatar Nov 18 '19 18:11 dakane1

I think the second scenario that Lauren described is what is happening here: there is a good chance that you used system's Python when you tried executing the script with python.

I think we should add a callout box the first time we try to execute a Python script. What do you all think?

maxim-belkin avatar Nov 18 '19 18:11 maxim-belkin

@maxim-belkin I think adding a callout box would be helpful to many users.

ldko avatar Nov 18 '19 18:11 ldko