Hy,
Sorry if this question was asked before, but I really couldnt find any helpful answer.
Running any python script in cygwin-terminal that uses modules that werent installed using cygwin-setup will just quit the python script without any output. Whats wrong?
Example:
import websocket
print "Done";
gives me a blank line and returns to the shell. Whereas
#import websocket
print "Done";
prints
Done
python scripts using i.e.
import hmac, base64, hashlib, urllib, urllib2, time, gzip, json, io, types, datetime, os
work fine.
I have:
-Cygwin64 on Win7-64bit using the mintty-terminal
-installed all python27 packages i found useful using setup.exe -> python is working
-i did run ez_setup.py under cygwin:
Installed /usr/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg
Processing dependencies for setuptools==2.1
Finished processing dependencies for setuptools==2.1
-did run get-pip.py:
Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages/pip-1.5-py2.7.egg
Cleaning up...
I have a copy of python27 on c:\python27 too. not using cygwin, but windows-cmd and using that python executable the above script works.
I need cygwin because i want to use curses and ansi codes etc but not use a virtual ubuntu or stuff.
I have:
$ ls -l python*
lrwxrwxrwx 1 Administrator None 13 18. Jan 11:12 python -> python2.7.exe
lrwxrwxrwx 1 Administrator None 13 18. Jan 11:12 python2 -> python2.7.exe
-rwxr-xr-x 1 Administrator None 7187 3. Okt 05:39 python2.7.exe
-rwxr-xr-x 1 Administrator None 1669 3. Okt 05:39 python2.7-config
lrwxrwxrwx 1 Administrator None 16 18. Jan 11:12 python2-config -> python2.7-config
lrwxrwxrwx 1 Administrator None 16 18. Jan 11:12 python-config -> python2.7-config
also running
pip
gives me a blank line and back comes the shell. whereas running pip in windows-cmd under c:\python27\scripts\ gives me:
Usage:
....
but running easy_install works:
$ easy_install
error: No urls, filenames, or requirements specified (see --help)
Thanks!
I had exactly the same problem. pip and pip2 run in the same way : no answer, even with only --version or --help option. pip3 does a core dump.
I found a hugly work around : remove cygwin64 and go back to cygwin.
If it could be helpful....
And it seems it has something to do with this issue https://github.com/pypa/pip/issues/1448
Related
My ultimate goal is to download and install awscli
http://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html
Seems python and pip are required in order to accomplish my goal.
Installing python via yum isn't working for me, so I downloaded and installed python3 manually as follows:
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
tar xf Python-3.6.1.tar.xz
cd Python-3.6.1.tar.xz
./configure
make
sudo make altinstall
When I do
pip3.6 --version
I get this:
Traceback (most recent call last):
File "/usr/local/bin/pip3.6", line 7, in <module>
from pip import main
ImportError: cannot import name 'main'
Environment:
RHEL 6.6
Accessed via ssh
What is going on? How to install pip and python3.6 correctly on my linux box?
Edit:
When trying to install via yum it fails so I am trying to avoid using yum:
[asemani#rcdc9pfda5r Python-3.6.1]$ sudo yum -y install python-pip
[sudo] password for asemeani:
Loaded plugins: security
Setting up Install Process
No package python-pip available.
Error: Nothing to do
Another Edit:
After importing sys and then called sys.path this is what I get:
[asemani#rcdc9pfda5r Python-3.6.1]$ python3.6
Python 3.6.1 (default, Apr 28 2017, 11:03:27)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib/python36.zip', '/usr/local/lib/python3.6', '/usr/local/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/site-packages']
>>> quit()
[asemani#rcdc9pfda5r Python-3.6.1]$ ls -l /usr/local/lib/python3.6/site-packages
total 32
-rw------- 1 root root 126 Apr 27 23:45 easy_install.py
drwx------ 11 root root 4096 Apr 27 23:45 pip
drwx------ 2 root root 4096 Apr 27 23:45 pip-9.0.1.dist-info
drwx------ 5 root root 4096 Apr 27 23:45 pkg_resources
drwx------ 2 root root 4096 Apr 27 23:45 __pycache__
-rw-r--r-- 1 root root 119 Apr 27 23:45 README.txt
drwx------ 5 root root 4096 Apr 27 23:45 setuptools
drwx------ 2 root root 4096 Apr 27 23:45 setuptools-28.8.0.dist-info
You need to edit the pip3 file like so (your path could be different):
nano /Library/Frameworks/Python.framework/Versions/3.6/bin/pip3
And change the import main line so it says:
from pip._internal import main
After this change, my pip3 started to work and I am on macOS. If you are using Linux, your path could be something like /usr/bin/pip3
I found this tip and more information from this thread:
https://github.com/pypa/pip/issues/5240
Don't invoke pip/pip3 directly, which are shortcuts at different locations for different user and they are not well maintained when you upgrade pip (check 'which pip' and 'sudo which pip').
$ sudo python -m pip install xxx #for python2
$ sudo python3 -m pip install xxx #for python3
These commands do not take shortcuts and directly invoke pip module, which is maintained very well (also works on Windows)
My OS is Linux Mint 18
sudo nano /usr/bin/pip3
Change
from pip import main
To
from pip._internal import main
sudo chmod -R a+rx /usr/local/lib/python3.6/site-packages
You can see the problem right there in your ls -l /usr/local/lib/python3.6/site-packages output that your pip directory is only readable by the owner, which is root.
Do a cd /usr/bin
Then sudo nano pip so as to edit the pip file
Change from pip import main to from pip._internal import main
This will resolve the issue
try the following as a way around the issue until it got solved
sudo python -m pip --version
>> pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
sudo python -m pip install numpy --upgrade
>> Requirement already up-to-date: numpy in /usr/local/lib/python2.7/site-packages (1.14.2)
I don't exactly know the answer, but: that error indicates that the script can find some package called pip, but not the right one. Probably, an old version of pip, from back before they created a main method (you can check pip.__version__ from the python shell).
I'm willing to bet that you still have another, older version of python installed which has its own version of pip. For some reason your pythonpath is loading that one instead of the one that goes with py3.6.
Some possibilities to look into:
I don't know anything about redhat, but is there some redhat-specific way of choosing the "default python" to be used?
Is the shebang line at the top of the pip script something like #!/usr/bin/env python instead of #!/usr/bin/python3.6 like it should be?
Is it possible to modify your shell's PATH so that the downloaded python is used?
Is it possible to change your PYTHONPATH (i think it gets added to the default value of sys.path inside python; look it up) so that it loads the new pip instead of the old pip?
My OS was Mac sierra and I had to change the following line
from pip import main
into
from pip._internal import main
Seems the get pip script was missing the fact that more than 1 version of python could reside on a machine. So I added the following lines:
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
For some reason it was missing this. Anyway this worked for me. Thanks for your help guys.
Do the following steps to solve the problem --(Ubuntu-Debian)
step 1 - Go to directory
cd usr/bin/
and open pip3 file using gedit or nano(via terminal) .
Step 2- change from pip import main into from pip._internal import main
P.S - If you donot have permission to change use command - sudo chmod 777 pip3 and save this file.
Hope this helps!!
I'm having a strange problem with a virtualenv I've created for python 3. I went through the usual steps:
$ virtualenv --python=/opt/local/bin/python3.3 .py3
$ source .py3/bin/activate
The problem I'm having is that when I call python --version, it is still reporting 2.7.5, even though the paths all appear to be set up correctly. My virtualenv was created in /Users/barry.flinn/projects/.py3/bin, and I get thes results when I run which python:
$ which python
/Users/barry.flinn/projects/.py3/bin/python
The bin folder has the following python executables:
lrwxr-xr-x 1 barry.flinn obfuscated\Domain Users 9 Sep 23 19:39 python -> python3.3
lrwxr-xr-x 1 barry.flinn obfuscated\Domain Users 9 Sep 23 19:39 python3 -> python3.3
-rwxr-xr-x 1 barry.flinn obfuscated\Domain Users 9100 Sep 23 19:39 python3.3
Clearly, invoking python should give me python 3.3, and yet it still seems to revert to the system python, which is 2.7.5. My $PATH when the virtualenv is active is:
/Users/barry.flinn/projects/.py3/bin:/usr/local/mysql/bin:/opt/local/lib/postgresql92/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin:/usr/local/munki
Since all of this seems correct, I'm stumped as to what is going on here.
Update:
This reports correctly:
$ env python --version
Python 3.3.2
Which, to me, is slightly more baffling.
If you have a shell alias defined for the python interpreter, it will override the python chosen for your virtualenv. For example:
user#x790:~/temp$ alias python=/usr/bin/python
user#x790:~/temp$ python --version
Python 2.7.4
user#x790:~/temp$ virtualenv --python=/usr/bin/python3 foo
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in foo/bin/python3
Also creating executable in foo/bin/python
Installing distribute.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................done.
Installing pip................done.
user#x790:~/temp$ . foo/bin/activate
(foo)user#x790:~/temp$ python --version
Python 2.7.4
Note that the python version reported was 2.7.4, even though python3 was selected for the virtualenv. Using the env command circumvents the alias:
(foo)user#x790:~/temp$ env python --version
Python 3.3.1
Lastly, you can get around this issue by either temporarily disabling the python alias for a single command or permanently undefining it:
(foo)user#x790:~/temp$ \python --version
Python 3.3.1
(foo)user#x790:~/temp$ unalias python
(foo)user#x790:~/temp$ python --version
Python 3.3.1
I am new to linux (Ubuntu) and python (Django). By default there is python 2.6.6 in my linux, I installed python 2.7. In the command prompt when I type python it goes to python 2.6.6, I want to change my default python to 2.7.
Ubuntu might have a Python2.7 package. If so, install that then use that to create a virtualenv and put Django inside that.
I recommend to use pythonbrew which can install and switch between multi Python interpreters in your $HOME without touch your system directories.
BTW, when install python, use the command
pythonbrew install --no-test 2.7.2
to skip unitest could speed up the installation a lot.
It's all about the links, I tell ya. Look at the links. Check the inode's link count for python2.5, python2.6, python2.7, python3.2, etc. Notice those are greater than one.
Just hunt down the duped link to "python", fix by unlink, and relink it. It may be a real link, or just a sym link. unlink with extreme prejudice.
-rwxr-xr-x 2 root admin 12392 Oct 4 2009 /opt/local/bin/python2.5*
-rwxr-xr-x 2 root wheel 12392 Jul 23 17:14 /opt/local/bin/python2.6*
lrwxr-xr-x 1 root wheel 72 Nov 7 2008 /usr/bin/python# -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
-rwxrwxr-x 1 root admin 41476 Jul 3 2010 /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7*
-rwxr-xr-x 3 root wheel 2072216 Jul 27 19:34 /usr/local/bin/python3.2*
The easiest way would be to modify your path and make sure the path to Python 2.7 is before Python 2.6. This is what I have done on my Mac to achieve similar things.
EDIT
I agree with Noufal Ibrahim in the fact about using virtualenv. I would also suggest looking into virutalenv wrapper. However, you still might have trouble using Python 2.7 is your path is not configured correctly, using an Ubuntu package for the install should take care of the path for you. Otherwise to install virtualenv from the bash shell, you can do something along the lines.
$ path/to/python27/python easy_install virutalenv
$ pip install virtualenvwrapper
I believe when installing virtualenv, it will set your PATH for you. You can confirm this by doing:
$which python
This should now show Python 2.7.
I have copied my home folder from a Mac OSX 10.5 to a new Mac OSX 10.6. This broke east_intall for binary packages. For example if I use Python 2.5:
> easy_install celery
Searching for celery
Reading http://pypi.python.org/simple/celery/
Reading http://github.com/ask/celery/
Reading http://celeryproject.org
Best match: celery 2.2.7
Downloading http://pypi.python.org/packages/source/c/celery/celery-2.2.7.tar.gz#md5=5826cf891eaa6175cc7aab67818094fe
Processing celery-2.2.7.tar.gz
Running celery-2.2.7/setup.py -q bdist_egg --dist-dir /var/folders/TK/TKwwrl0JEyKrCVteN9D+Jk+++TI/-Tmp-/easy_install-RSjVZt/celery-2.2.7/egg-dist-tmp-w4bMT_
...
In file included from Modules/_multiprocessing/multiprocessing.h:6,
from Modules/_multiprocessing/multiprocessing.c:9:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:18:20: error: limits.h: No such file or directory
...
... millions of errors
...
error: Setup script exited with error: command 'gcc' failed with exit status 1
If I use Python 2.6
> easy_install-2.6 celery
Searching for celery
Reading http://pypi.python.org/simple/celery/
Reading http://github.com/ask/celery/
Reading http://celeryproject.org
Best match: celery 2.2.7
Downloading http://pypi.python.org/packages/source/c/celery/celery-2.2.7.tar.gz#md5=5826cf891eaa6175cc7aab67818094fe
Processing celery-2.2.7.tar.gz
Running celery-2.2.7/setup.py -q bdist_egg --dist-dir /var/folders/TK/TKwwrl0JEyKrCVteN9D+Jk+++TI/-Tmp-/easy_install-dCVly4/celery-2.2.7/egg-dist-tmp-PqOUyI
error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: Setup script exited with error: /var/folders/TK/TKwwrl0JEyKrCVteN9D+Jk+++TI/-Tmp-/easy_install-dCVly4/celery-2.2.7/temp/easy_install-61UKvH/PasteDeploy-1.5.0/temp/easy_install-ExR4d0/Paste-1.7.5.1/temp/easy_install-OJw80Y/PasteDeploy-1.5.0/temp/easy_install-Zg0wGJ/Paste-1.7.5.1/temp/easy_install-aWn8hm/PasteDeploy-1.5.0/temp/easy_install-1TOXq2/Paste-1.7.5.1/temp/easy_install-r97tJG/PasteDeploy-1.5.0/temp/easy_install-CNdClq/Paste-1.7.5.1/temp/easy_install-XUejp4/PasteDeploy-1.5.0/temp/easy_install-xN6Jd6/Paste-1.7.5.1/temp/easy_install-zFbJOI/PasteDeploy-1.5.0/temp/easy_install-fc2q_2/Paste-1.7.5.1/temp/easy_install-1rTVrG/PasteDeploy-1.5.0/temp/easy_install-rii66v/Paste-1.7.5.1/temp/easy_install-cZBf5J/PasteDeploy-1.5.0/temp/easy_install-ICPv8M/Paste-1.7.5.1/temp/easy_install-RwRQIz/PasteDeploy-1.5.0/temp/easy_install-x74lHT/Paste-1.7.5.1/temp/easy_install-Yf8l74/PasteDeploy-1.5.0/temp/easy_install-fnl5Wt/Paste-1.7.5.1/temp/easy_install-OwWNt9/PasteDeploy-1.5.0/temp/easy_install-WkOs3d/Paste-1.7.5.1/docs/include/reference_header.txt: File name too long
This is not a celery specific question. I get similar errors with lxml, matplotlib, scipy, etc. The problem occurs with all binary packages, not pure python packages. What am I doing wrong?
> which easy_install
/Library/Frameworks/Python.framework/Versions/Current/bin/easy_install
> which easy_install-2.6
/usr/bin/easy_install-2.6
It is difficult to tell for sure with the abbreviated tracebacks you included. One possibility is that the separate Python 2.5 you had installed on Mac OS X 10.5, most likely using a python.org installer, did not get copied over. If so, you either need to install a similar Python 2.5 there or move /Library/Frameworks/Python.frameworks from the old installation. Or you should update to using a newer Python, either a system one or one from python.org or one of the third-party open source distributors for Mac OS X, like MacPorts or homebrew or Fink or ActiveState.
Another possibility is that you need to install the optional MacOSX 10.4u SDK from the Xcode 3 installer for Mac OS X 10.6. If that is the case, you should be seeing error messages that include either 10.3 or 10.4 in them.
Update: So it seems you do have an easy_install installed for the extra python.org or at least for whatever version of Python is pointed to by /Library/Frameworks/Python.framework/Versions/Current. You seem to have to have two separate problems here (with the Python 2.5 and another with the system Python 2.6). At this point, it is difficult for me to guess what either of the problems is without getting a lot more information. It is probably best to clean up and start over.
If you want to remove the old Python 2.5 carried over from your old system, you can follow the instructions here on how to remove a python.org installed Python. If you want to, you can make a copy of it first or rename it instead with something like:
cd /Library/Frameworks/Python.framework/Versions
sudo mv 2.5 2.5-OLD
Consider doing the same for any other Python version there. DO NOT delete or modify any files in /System/Library/Frameworks or /usr/bin. Those directories are part of OS X.
Make sure you clean up your shell profile files, .bash_profile etc, to ensure that your PATH no longer includes this Python. Make you don't have any unexpected PYTHONPATH environment variables defined.
Make sure you don't have any outdated Distutils configurations files in your home directory. Look for and rename or remove things like .pydistutils.cfg.
cd ~
ls -al
Also make sure you don't have any unexpected private packages installed in local directories.
ls -al ~/Library/Python
ls -al ~/.local
Inspect and, if necessary, delete anything in the site-packages directories for the Apple-supplied Pythons:
cd /Library/Python/2.6/site-packages
ls -al
cd /Library/Python/2.5/site-packages
ls -al
Start a new terminal session and verify that all is well.
Decide what versions of Python you want to use with 10.6. If you are OK with using the Apple-suppled 2.6.1 or 2.5.4 versions, then use them. They both come with their own versions of easy_install in /usr/bin.
$ ls -l /usr/bin/python*
-rwxr-xr-x 2 root wheel 86000 Jun 24 2010 /usr/bin/python*
-rwxr-xr-x 5 root wheel 925 Jul 7 2009 /usr/bin/python-config*
lrwxr-xr-x 1 root wheel 75 Nov 7 2010 /usr/bin/python2.5# -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
lrwxr-xr-x 1 root wheel 82 Nov 7 2010 /usr/bin/python2.5-config# -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
lrwxr-xr-x 1 root wheel 75 Nov 7 2010 /usr/bin/python2.6# -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x 1 root wheel 82 Nov 7 2010 /usr/bin/python2.6-config# -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
-rwxr-xr-x 2 root wheel 86000 Jun 24 2010 /usr/bin/pythonw*
lrwxr-xr-x 1 root wheel 76 Nov 7 2010 /usr/bin/pythonw2.5# -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5
lrwxr-xr-x 1 root wheel 76 Nov 7 2010 /usr/bin/pythonw2.6# -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
$ ls -l /usr/bin/easy*
-rwxr-xr-x 2 root wheel 925 Jun 30 2009 /usr/bin/easy_install*
-rwxr-xr-x 1 root wheel 421 Jun 30 2009 /usr/bin/easy_install-2.5*
-rwxr-xr-x 1 root wheel 421 Jun 30 2009 /usr/bin/easy_install-2.6*
If you want more recent and up-to-date versions of Python, consider installing the latest Pythons (Python 2.7.2 is the current version of Python 2) from python.org or homebrew, MacPorts, Fink, ActiveState etc. Update your shell PATH as necessary. (For example, the python.org installers by default modify your shell profiles appropriately.)
If the installation doesn't already come with an easy_install (python.org doesn't, some of the others have an optional package to do so), install the Distribute package which will provide an easy_install for it.
Have you installed XCode? It looks like you haven't.
I am running Snow Leapord 10.6 and trying to install the following python modules:
numpy
scipy
matplotlib
I am running into problems because OSX contains two version of Python:
/Library/Python/
/System/Library/Frameworks/Python.framework/
It appears that when I execute the following command:
sudo easy_install -U {module}, the modules are being installed to the site-packages directory here:
bash-3.2$ ls -al /Library/Python/2.6/site-packages/
total 688
drwxrwxr-x 12 root admin 408 Aug 24 23:26 .
drwxrwxr-x 3 root admin 102 Feb 11 2010 ..
-rw-rw-r-- 1 root admin 119 Feb 11 2010 README
-rw-r--r-- 1 root admin 267 Aug 24 19:03 easy-install.pth
drwxr-xr-x 5 root admin 170 Aug 24 10:42 nose-0.11.4-py2.6.egg
drwxr-xr-x 38 root admin 1292 Aug 24 15:35 numpy
-rw-r--r-- 1 root admin 1618 Aug 24 15:35 numpy-2.0.0.dev8661-py2.6.egg-info
drwxr-xr-x 16 root admin 544 Aug 24 19:07 numscons
drwxr-xr-x 4 root admin 136 Aug 24 19:03 numscons-0.10.1-py2.6.egg
-rw-r--r-- 1 root admin 265 Aug 24 19:07 numscons-0.12.0dev-py2.6.egg-info
-rw-r--r-- 1 root admin 333959 Aug 23 11:51 setuptools-0.6c11-py2.6.egg
-rw-r--r-- 1 root admin 30 Aug 23 11:51 setuptools.pth
But, when I try to install scipy, I see the following error:
config = setup_module.configuration(*args)
File "scipy/setup.py", line 20, in configuration
config.add_subpackage('special')
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/distutils/misc_util.py", line 851, in add_subpackage
caller_level = 2)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/distutils/misc_util.py", line 834, in get_subpackage
caller_level = caller_level + 1)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/distutils/misc_util.py", line 766, in _get_configuration_from_setup_py
('.py', 'U', 1))
File "scipy/special/setup.py", line 14, in <module>
(numpy.__version__, numpy.__file__))
ValueError: numpy >= 1.4 is required (detected 1.2.1 from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/__init__.pyc)
So it appears that it is looking for an older version of numpy in my frameworks directory. I used import to see which version of numpy python was finding:
python -c 'import numpy;print numpy.__version__'
1.2.1
And sure enough, it is looking in the frameworks directory even though I have a new version sitting in:
/Library/Python/2.6/site-packages/
I know import searches your local directory first, and then goes into PYTHONPATH, and then finally looks at sys.path. So I checked these out and I do not have PYTHONPATH set right now, and here is my sys.path:
/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg
/Library/Python/2.6/site-packages/nose-0.11.4-py2.6.egg
/Library/Python/2.6/site-packages/numscons-0.10.1-py2.6.egg
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload
/Library/Python/2.6/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode
If I change PYTHONPATH to /Library/Python/2.6/site-packages and then check the numpy revision I get the correct version:
bash-3.2$ python -c 'import numpy; print numpy.__version__'
2.0.0.dev8661
But when I run sudo python setup.py build/install scipy cannot find the right numpy, even though PYTHONPATH has been set.
Can anyone please help me out here?
Found this link that looks like it fixes my problem, but I cant seem to get it to work:
http://andreasjacobsen.com/2008/10/10/using-python-setuptools-on-the-mac/
I think the easiest way would be to use MacPorts to install scipy. Here's an intro, though you probably want py26-scipy.
Have you tried installing with pip? Also, try installing scitools, which should pull those you needed.
The issue is that the easy_install you are calling is the one for the Apple install with the frameworks in /System and the python is /usr/bin/python
To see what python gets installed view the easy_install script and see what the #! line says which python to use.
To get the correct easy_install you will need to install distibute or setuptools for the python in /Library (I would guess this is a python.org one with /usr/local/bin/python ). Then use that easy_install
I would note however that I do use #boocs solution of using Macports althogh if just after scipy etc and no other C libraries then other solutions show here will work, also see Enthought
Can you not just move the old numpy out of the way, temporarily ?
cd /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python
sudo mv numpy numpy-1.2.1 # mv back if need be
The solution I came up with is the following.
1) Do not use the version of Python that comes pre-installed with OSX. Apple has apparently made some modifications to this and not everything builds. So, you need to install a development version of Python. Right now - I would suggest installing Python 2.7. Here is a blog post about how to do it:
https://medium.com/cs-math/a3eb146ebfb5
2) Once you have installed Python, you need to install the fortran libraries for the Scipy/Numpy installation. Use homebrew to do that (Do people really still use MacPorts ???)
http://brew.sh/
3) After you have home brew installed, install fortran
brew install gfortran
4) Now you can install scipy/numpy successfully with pip (Warning - it takes a while)
pip install -U numpy
pip install -U scipy
DONE
I had kind of similar problem, just to same some time of the people with the same issue, if you have two pythons in your system (say python2 and python3) and you wish to install say numpy for the new version (python3) go through these steps:
1- download numpy
2-unzip it
3- in terminal go to the unzipped folder
4-python3 setup.py install