Ask Your Question
0

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

asked 2022-03-15 19:45:26 +0200

LouP gravatar image

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

edit retag flag offensive close merge delete

Comments

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?

John Palmieri gravatar imageJohn Palmieri ( 2022-03-15 23:57:57 +0200 )edit

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

LouP gravatar imageLouP ( 2022-03-16 16:27:09 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-03-16 16:15:46 +0200

LouP gravatar image

I've found the answer to my question about not importing numpy or scipy. A Python 3.7 version of either library did not exist at the time 3.7 was released. I downloaded Sage 9.4 which has Python 3.9 and numpy and scipy for that version of Python.

However, when I try to run the script I have another problem with a binary_pkg that can't be found to run Python 3.9 in the Sage package. I will ask about this in another post on this forum. Thanks.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-03-15 19:45:26 +0200

Seen: 59 times

Last updated: Mar 16