Utilization of the Numpy installed on python3.4 in python2.7 - python

I basically use python 3.4 and the numpy 1.3.0 had been installed and launched successfully on my windows machine.
Recently, I've just installed python 2.7, in order to use Brian2 library, but I've an error in traceback as Importing numpy failed: No module named numpy, whereas it has been installed and works well under aegis of python 3.4
Actually, when I switch the interpreter address to python 2.7, the problem will be happened, in which the numpy is totally hidden in view of the python 2.7...
Any help?!
Edit:
I even tried to choose python 2.7 (As it was detected automatically in registry), within the re-installation of numpy... but still there is nothing as the installed package in Python Interpreters -> Python 2.7

Python x.y (on Windows) generally expects to find 3rd party modules and packages in .../pythonxy/Lib/site-packages. If the module or package is pure python code that is compatible with multiple python versions (such as code that works with 2.6 and 2.7, or 3.3 and 3.4, or much more rarely 2.7 and 3.4), then it is possible to access one copy of the package from multiple site-packages directories. (This is done with x.pth files, which is another topic not relevant here.)
However, on Windows, anything compiled from C must be compiled for Windows and a particular version of Python, including 32 versus 64 bits. (This is currently a requirement of Microsoft C, which may change in the future.) To run with 3.4.x, you installed numpy-1.3.0-for-3.4-winxx. To run with 2.7, you must install numpy compiled for 2.7.
By the way, current numpy is 1.8, with 1.9 due soon. You might want to take the opportunity to upgrade. If you have trouble getting Windows binaries for python extensions, gohlke's site is excellent.

Related

Updating Python version that's compiled from source

I run a script on several CentOS machines that compiles Python 2.7.6 from source and installs it. I would now like to update the script so that it updates Python to 2.7.12, and don't really know how to tackle this.
Should I do this exactly the same way, just with source code of higher version, and it will overwrite the old Python version?
Should I first uninstall the old Python version? If so, then how?
Sorry if this is trivial - I tried Googleing and searching through Stack, but did not found anyone with a similar problem.
Replacing 2.7.6 with 2.7.12 would be fine using the procedure you linked.
There should be no real problems with libraries installed with pip easy_install as the version updates are minor.
Worst comes to worst and there is a library conflict it would be because the python library used for compiling may be different and you can always reinstall the library which would recompile against the correct python library if required. This is only problematic if the library being installed is actually compiled against the python library. Pure python packages would not be affected.
If you were doing a major version change this would be okay as well as on CentOS you have to call python with python2.7 and not python, so a new version would call with python2.8

SFrame for Python 3.4

On the project's website it tells me, that there is Python 3.4 support (Readme.md, which is shown as text on that page). However, I fail to see where I could get that Python 3.4 compatible version of SFrame from. It's not on anaconda and not on PyPI, where I only see Python 2.7 versions.
So I wonder, if they simply didn't update their Readme.md to note the fact, that SFrame is not available for Python 3.4 anymore, or if it is somewhere, where I didn't find it. Why should they note that there is no support for Python 3.5.x yet after all, if they didn't have it for 3.4.
I did install it for a Python 3.4.5 anaconda environment before and if I recall correctly, that was from PyPI, so I am thinking they took it down from there for some reason.
Does anyone know how to get a Python 3.4 compatible version of SFrame into an anaconda environment today?

Clean Mac from different python versions

I've started to use python and recently i've bought my first mac.
I saw that Mountain Lion comes with their own python versions, despite i've decided to install a new python 2.7.5, and also Django and MySQL-Python. Everything works fine.
I've decided to try scipy and following the installed steps suggested by the official site with macports It seemed that macports installed another version 2.7.5 of python. Now if i try to run python in my terminal and import numpy it fails.
I saw that when i run python in my terminal, it execute
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
But if I go in
cd /System/Library/Frameworks/Python.framework/Versions/2.7/bin
and run ./python i can import django and numpy modules but not MySQLdb modules.
I'm really confused how I can fix that mess.
I would like to have just one Python version installed in one place with all the modules I need.
Or please suggest something to clean that mess, know and have the control to what modules I have, where they are and how to import them! And also control which version of Python I want to run.
Edit 10/27/2013: i've solved following the link suggested in the comment, deleting all versions in /Library/ and all simlinks in /usr/local/bin, after that i changed to the path i wanted the py interpreter in my bash_profile.
Actually the problems seems to be created by macports that has installed numpy using the py interpreter installed under /System/, so i changed my default py interpreter to that installed under /System/ and installed the rest of packages i need. Now everything works as i want.
Personally, I wouldn't mess around with the built-in version of Python. I had some real issues with my Mac when I did that a few months ago.
You could try Canopy instead. It's a Python development environment which is great for writing and executing code. Any packages you need can be easily added (or removed) using the package manager. https://www.enthought.com/products/canopy/

Different sys.path between pypy and normal python

I'm trying to use pypy compiler to run my python code but the sys.path for pypy is different from normal python compiler so when I tried to import default modules such as
import pygame
it fails in pypy, stating that the module is not found, while it works correctly with the normal python command. Any help is greatly appreciated.
I think you're expecting any module installed for CPython to work with PyPy out of the box. That's not the case. It's the same when you upgrade from CPython 2.6 to CPython 2.7: the modules you have already installed for 2.6 are not automatically available for 2.7, and must be re-installed. Similarly, you must re-install the modules for PyPy.
This said, the standard pygame doesn't work too well with PyPy, but stay tuned; it seems someone is working on a version of pygame based on cffi, which should work very well with PyPy.

Installing Shogun toolbox with MacPorts for Python 2.7

I am having a hard time trying to install the Shogun machine-learning toolbox via MacPorts. It seems that the only version MacPorts has declares Python 2.6 as a dependency and as a result MacPorts downloads and installs Python 2.6, numPy for Python 2.6 etc. The problem is I have Python 2.7 already installed and a host of other packages, including numPy, that I want to use with shogun already installed under Python 2.7.
Has anyone had success using shogun with Python 2.7. I couldn't find any documentation stating it only works with 2.6, so I assume 2.7 should work.
It looks like it needs to be converted to a python Portgroup port where the python version is implied from the current python see py-scipy for an example depending on py-numpy.
Also see the current threads on the macports mailing list for octave.

Categories

Resources