[MacPorts] #51655: Could not import numpy into python 2.7
#51655: Could not import numpy into python 2.7 ------------------------------+-------------------------------- Reporter: mahajan.smriti@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Keywords: numpy, python | Port: py-numpy, python ------------------------------+-------------------------------- Following https://astrofrog.github.io/macports-python/ I installed Python, numpy, scipy and matplotlib and configured as directed in the link. But when I try to import numpy as a module I get the error "ImportError: No module named numpy". Instead if I try using py27-numpy, then I get a syntax error. While "which python returns "/Library/Frameworks/Python.framework/Versions/2.7/bin/python", "which numpy" and "which py27-numpy" give no output. I am new to python and would greatly appreciate any help with this installation. I am using OSX 10.9.8. Macports seems to have installed py27-numpy @1.9.0_0, py27-numpy @1.11.0_0+gfortran (active), python2_select @0.0_1 (active), python27 @2.7.8_1, python27 @2.7.11_2 (active), python34 @3.4.4_1 (active) among others. -- Ticket URL: <https://trac.macports.org/ticket/51655> MacPorts <https://www.macports.org/> Ports system for OS X
#51655: py-numpy: Could not import numpy into python 2.7 -------------------------------+------------------- Reporter: mahajan.smriti@… | Owner: dh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: py-numpy | -------------------------------+------------------- Changes (by ryandesign@…): * owner: macports-tickets@… => dh@… * cc: michaelld@… (added) * port: py-numpy, python => py-numpy * keywords: numpy, python => Comment: Replying to [ticket:51655 mahajan.smriti@…]:
Following https://astrofrog.github.io/macports-python/ I installed
Python, numpy, scipy and matplotlib and configured as directed in the link.
But when I try to import numpy as a module I get the error "ImportError: No module named numpy". Instead if I try using py27-numpy, then I get a syntax error. While "which python returns "/Library/Frameworks/Python.framework/Versions/2.7/bin/python", "which numpy" and "which py27-numpy" give no output.
It is normal that `which numpy` and `which py27-numpy` would return no output, because there are no executables by those names. numpy is a python module, not an executable program. /Library/Frameworks/Python.framework/Versions/2.7/bin/python is not MacPorts python; it's some other python you have installed outside of MacPorts. It will have no knowledge of python modules you install with MacPorts. To use MacPorts python modules, you must use MacPorts python, which is /opt/local/bin/python2.7. You can either run it by that absolute path, or if you want to be able to run it by just typing "python", then you can first run `sudo port select python python27` and then close and reopen your terminal window. -- Ticket URL: <https://trac.macports.org/ticket/51655#comment:1> MacPorts <https://www.macports.org/> Ports system for OS X
#51655: py-numpy: Could not import numpy into python 2.7 -------------------------------+------------------- Reporter: mahajan.smriti@… | Owner: dh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: py-numpy | -------------------------------+------------------- Comment (by mahajan.smriti@…): Replying to [comment:1 ryandesign@…]:
Replying to [ticket:51655 mahajan.smriti@…]:
Following https://astrofrog.github.io/macports-python/ I installed
Python, numpy, scipy and matplotlib and configured as directed in the link.
But when I try to import numpy as a module I get the error "ImportError: No module named numpy". Instead if I try using py27-numpy, then I get a syntax error. While "which python returns "/Library/Frameworks/Python.framework/Versions/2.7/bin/python", "which numpy" and "which py27-numpy" give no output.
It is normal that `which numpy` and `which py27-numpy` would return no output, because there are no executables by those names. numpy is a python module, not an executable program.
/Library/Frameworks/Python.framework/Versions/2.7/bin/python is not MacPorts python; it's some other python you have installed outside of MacPorts. It will have no knowledge of python modules you install with MacPorts. To use MacPorts python modules, you must use MacPorts python, which is /opt/local/bin/python2.7. You can either run it by that absolute path, or if you want to be able to run it by just typing "python", then you can first run `sudo port select python python27` and then close and reopen your terminal window.
Thank you! That has got it working. However, the sudo command did not work for me and I instead had to add an alias in my .profile file to use the correct file path to run "python". -- Ticket URL: <https://trac.macports.org/ticket/51655#comment:2> MacPorts <https://www.macports.org/> Ports system for OS X
#51655: py-numpy: Could not import numpy into python 2.7 -------------------------------+-------------------- Reporter: mahajan.smriti@… | Owner: dh@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: invalid | Keywords: Port: py-numpy | -------------------------------+-------------------- Changes (by mf2k@…): * status: new => closed * resolution: => invalid -- Ticket URL: <https://trac.macports.org/ticket/51655#comment:3> MacPorts <https://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts