0

Recently I installed Mac OS X 10.11. I am involved in the development of scientific applications (mainly in Fortran and C++) and I use MacPorts to install different utilities (GCC compiler, MPI libraries, ...). Immediately after the installation of the new OS, I followed the migration instructions for MacPorts (https://trac.macports.org/wiki/Migration), i.e. I uninstalled all my packages and reinstalled them again with the new OS.

Unfortunately, Python does not seem to work anymore. The first hint is that the terminal is never released, i.e. the function exit() or the combination C+d do not stop the interpreter properly and the terminal is no more usable.

The second (and bigger) problem is that numpy is not found:

>>> import numpy as np
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'

I tried to reinstall numpy using pip (Can I force pip to reinstall the current version?), without success.

I have this computer (MacBook Pro) from many years and I have installed Python many times. This is the result of the auto-completion:

python             python3            python3.4m         python3m
python-config      python3-32         python3.4m-config  python3m-config
python2.6          python3-config     python3.6          pythontex
python2.6-config   python3.4          python3.6-config   pythonw
python2.7          python3.4-32       python3.6m         pythonw2.6
python2.7-config   python3.4-config   python3.6m-config  pythonw2.7

Anyone had a similar problem? Any idea how to get Python work normally?

Community
  • 1
  • 1
  • Dumb question, but are you sure you are using same python version in both your command line and pip? – fpietka Aug 15 '16 at 21:26
  • 1
    Make sure your pip & python versions match; try the `--version` flag with them. To make sure you're using the right pip run `python -m pip install numpy` with python binary you're using. – jacob Aug 15 '16 at 21:26
  • @AlbertoGarcia-Raboso I don't think his problem is related to macport at all. – fpietka Aug 15 '16 at 21:30
  • @fpietka I'm not saying it is: I'm just saying I have had a very good experience with something other than MacPorts that provides a very similar thing. – Alicia Garcia-Raboso Aug 15 '16 at 21:36
  • @fpietka pip3 and python3.4 seems to match, but this still does not work. I think the problem is related to the number of different installations. In fact when I uninstalled MacPorts there should have been only the standart Python distribution on MacOS X (2.7 I believe), but all the other versions were still in autocompletion. –  Aug 15 '16 at 21:44
  • @AlbertoGarcia-Raboso I already tried Homebrew but I prefer MacPorts (I found more packages...). Maybe this problem can also come from a clash between Brew and Port? –  Aug 15 '16 at 21:45
  • @R.M. what path does `pip3 show numpy` give you? – fpietka Aug 15 '16 at 21:47
  • If you've installed both, you may have conflicts between them. Try `which python`, `which python3`,... , `which pip`,... That may give you an indication of where the problem is. – Alicia Garcia-Raboso Aug 15 '16 at 21:49

1 Answers1

0

You should have seen a note when you installed Python that, if you will be using it from the terminal, to please install pyNN-readline to fix the current issue with libedit (terminal not being properly handled.) NN=26 for python 2.6, for example.

For numpy, you should be able to 'sudo port install pyNN-numpy'. After doing that, make sure that the python you want (2.6, 2.7, etc is selected with 'sudo port select python ...' (Check the port man page for details) and that /opt/local/bin (assuming default install) is at the head of PATH.

You can skip the select step if you call python2.7 explicitly, FWIW.

eborisch
  • 646
  • 5
  • 3