# Where is numpy, scipy, etc. for Python 3.7 ??

I have Sagemath installed on my Mac with Python versions 2.7 and 3.7 in the package.

I'm running sage/python as scripts. For Python 2.7 I use the shebang,

#!/Applications/SageMath/local/bin/python2.7

And the code executes correctly including an "import numpy as NP" line.

When I switch to Python 3.7 I use the shebang

#!/Applications/SageMath/local/bin/python3.7

This works for 2to3.py and importing python libs like subprocess and sys, but when I add

import numpy as NP

I get the error,

File "/Users/louispecora/Code_py/PyConversion2to3/testfordivops/DIVchk2to3.2.7.py", line 4, in <module> import numpy as NP ModuleNotFoundError: No module named 'numpy'

I see numpy folder in the pkgs/ at the path

/Applications/SageMath/build/pkgs/numpy

Anyone have an idea why 3.7 can't find numpy, scipy, etc., but 2.7 can?

Thanks for any help.

-- Lou Pecora

It looks like you're using Mac OS X. Is that correct? What version of Sage are you using? Recent versions of Sage should not include any version of Python 2 at all, just Python 3. Did you download a binary file or did you build Sage yourself?

Hi, Mr. Palmieri. Yes, I am using Mac OS X. (see my answer to why no numpy was in my older Sage package in this post). However, I updated my Sage package: After posting my question I downloaded sage-9.4-OSX_11.2.3-x86_64.tar.bz2 from Sage Downloads, extracted, and put it in my Applications folder. This had numpy, etc. But when I try to run my script by using the shebang to point to Python3.9 in the Sage 9.4 package, I get an error stating that

dyld: Library not loaded: /Users/buildbot-sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeqip0oidmas3/local/lib/libpython3.9.dylib

I have no idea what this means. Previous scripts using Python2.7 (when it was in Sage) ran without this type of error. Please let me know if you understand this. Thank you. -- Lou