How do I install Python 2.7 modules on Windows 64-Bit? - python

I've been looking around the internet for days now and cannot find a solution to my problem. I've learned all the basics to programming in Python 2.7 and I want to add Pip to my copy of 2.7. I found the link to download the unoffical 64-Bit installer (www.lfd.uci.edu/~gohlke/pythonlibs/), but when I downloaded it and ran it, it said I needed to have Python 2.7 (which I do) and it couldn't find it in the registry. I went to Pip's website and downloaded the official Windows installer and unpacked it using WinRAR.
I then tried opening Command Prompt and changed the directory to where the get-pip.py is located and running get-pip.py install but it says it failed to install.
I am completely lost and really need detailed and clear help. Please answer!

It doesn't matter what kind of machine you have. You can run 32-bit Windows on a 64-bit machine. And you can run 32-bit Python on 64-bit Windows.
If you have 32-bit Python, you need to install 32-bit pip. (Or you need to switch to 64-bit Python.)
From your description, you most likely have 32-bit Python on 64-bit Windows, and tried to use a 64-bit pip.
PS, if you want to install it manually instead of using Gohlke's installer, nobody can help you debug your problem based on "it says it failed to install". It produces a lot more output than that, and without that output, it's impossible to know which of the billion things that could possibly go wrong actually did.
PPS, just installing pip is sufficient to install any pure-Python packages. But if you want to install packages that include C extensions, you will need to set up a compiler (either MSVC, or MinGW/gcc), as explained in the pip documentation.

Related

Install Python 3.6.2 on Windows without admin rights

I am trying to install Python 3.6.2 on a windows vps I have but I need admin rights to do it.
I tried a various different methods but none of them worked.
There is no MSI version for python 3 so that does not work either.
Any ideas?
I know this might get me in trouble for suggesting thirdparty solutions, but Anaconda saved my bacon so many times in your situation, it's not even funny.
https://docs.continuum.io/anaconda/install/windows
I found that i couldn't install the latest version for the same reasons you stated but if you select a previous version it will install fine.
https://www.python.org/downloads/windows/
(assuming you are on windows)
This doesn't answer the question of how to install that version, but if you are happy with a previous version then, this could work.
You could try the embeddable version (Really a zipped portable version), but I'm not sure about dependencies management (i.e. pip) and path variables and whatnot.

Python Windows 7 - Installation Fail 0x80240017

I tried installing Python 3.5.0 on my laptop, running Windows 7, and it would keep returning with a "Setup failed" with 0x80240017 - Unspecified Error.
I've tried running as admin and with the three different installers on the site.
Here is the log file: http://pastebin.com/9yuXv1qK
I have faced the same issue -unspecified error during installation
Package: python-3.6.0-amd64.exe
Platform: Windows Embedded standard, 64-bit.
Solution that worked for me:
Uninstall the corrupted Python installation.
Install KB2999226.
Install Python as Administrator.
It is throwing that error because it is trying to install that KB (2999.. something) and failing. If you try to install that KB yourself, it might fail too, as it has some minimum OS requirements. In my case, it was Service Pack 1 for Windows 7. After installing Service Pack 1 I was able to install Python 3.5.x fine.
I collected the required update packages to install python on win 8.1
This topc is related to the following one as well:
Python install failed windows 8.1- Error 0x80240017: Failed to execute MSU package
the packages (I did not check the subset of packages, but if you install the all, python can be installed. There are some packages that requires another one before install, the required one is listed here as well.
So if the install says "this upgrade is not suitable for this machine" just go on, install other packages, and when you finished, install the remaining packages that you were not able to install before.
clearcompressionflag.exe
Windows8.1-KB2887595-v2-x64.msu
Windows8.1-KB2898514-x64.msu
Windows8.1-KB2901101-x64.msu
Windows8.1-KB2906956-x64.msu
Windows8.1-KB2908174-x64.msu
Windows8.1-KB2919355-x64.msu
Windows8.1-KB2919442-x64.msu
Windows8.1-KB2932046-x64.msu
Windows8.1-KB2934018-x64.msu
Windows8.1-KB2937592-x64.msu
Windows8.1-KB2938439-x64.msu
Windows8.1-KB2959977-x64.msu
Windows8.1-KB2999226-x64.msu
As it can be seen I used win 8.1 x64. The total size of these packages is about 1 GB. These all are downloadable from microsoft update center.
BR,
George
I am also using win 7 home premium SP1 and encountered this problem, I solved it by:
Go the Windows Update in the Control Panel
Search for the installed update named KB2999226
Uninstall that update
And DONE!!!
Honestly, use this method at your own risk as I am just a newbie in programming and have no idea what that Windows Update was for. But I did it anyways.
I was trying to install Python 3.6.0 on Windows 7 64x laptop and kept getting stuck on installing KB2999226. So, I read what others did on this forum(Fabio Consultant). A previous post mentioned Visual Studio. So, I went to Programs and Features (where you Uninstall a Program), right clicked on the most recent install of Visual Studio, selected "Change" and did a "repair". Once that completed, I installed Python as an Administrator (right click on the .exe file and "run as Administrator") and Python installed without a problem. I didn't see that the install tried to install KB2999226.
Details on KB2999226 (https://support.microsoft.com/en-us/kb/2999226). It looks like repairing Visual Studio corrects issues with CRT. Someone correct me if Im wrong.
Hope this helps.
Just in case are facing it with Windows 7 for PCs:
Very simple, reinstall Windows Service Pack and repair the Visual C++ Redistributable and bingo, the error disappears.
In case of difficulties, uninstall all the software involved (Visual C++, etc.) and reinstall as the proper sequence.
In my case, I have an application installed in my computer which has python installation in it. I was not able to search it from normal PC search. Just try installing "everything" software if you have complex installation of software like me.
Once you get the path for python installation, add this path to environment (System's) variable and you are good to go.
Go to https://www.microsoft.com/en-us/download/details.aspx?id=5842
Click Download button and Scroll down to see all files
Select windows6.1-KB976932-X86.exe (32-bit) or windows6.1-KB976932-X64.exe (64-bit).
Click Next
Install this and then install Python
Happy Coding :)

How can I install multiple copies of Python 2.7 on the same machine?

I want to install Python 2.7 in two places at once on my Windows machine. For example, one in c:\python27 and another in c:\myproduct\python27. The official installer refuses to let me do this. If there is already an installation when I run the installer, it prompts me and asks if I want to Change, Repair or Remove the existing installation.
The TARGETDIR trick mentioned elsewhere on Stackoverflow doesn't work either - I get the same result if I type the following into a cmd window:
msiexec /i python-2.7.8.msi TARGETDIR=c:\myproduct\python27
So, is there anyway to install Python 2.7 twice on my Windows machine?
Reasons I want to do this are:
My product requires a 32-bit version of Python 2.7 to be installed because it uses ctypes to load a 32-bit DLL. If the user already has a 64-bit version of 2.7 installed, I don't think it is safe to install the 32-bit version over the top.
Relying on the users pre-installed Python 2.7 is bad because they might uninstall it later. That would stop my product from working.
It reduces the complexity of testing my product if I can make its installer always install a known version of Python. I can rely on it being in a known state.
I'd like to add the pyreadline module to the Python install that is part of my product. I suspect most users would rather that I did not mess around with their Python install.
When a user uninstalls my product, the Python it installed should also be removed. If I installed Python in the standard place the user might come to use it for other purposes and be surprised when it goes missing when they uninstall my product.
It appears that you should be able to install the 32 bit version of Python 2.7 in another folder when the 64-bit version is already installed. See How do I install Python 2.7.3 32 bit and 64 bit on Windows side by side for a description. However it may be tricky to automate this, you might have to get users to install it themselves.
I would suggest you ask your users to install Python 2.7 32-bit, and give them instructions on how to do it if they already have a conflicting 64-bit version. Then in your installation you:
Ensure that virtualenv is installed (and install it if it is not).
Create a virtualenv in your application folder.
That addresses everything except the second item on your list and I think you simply have to accept that no matter what you do, if someone removes a component that you need your application will fail. If they do that they can use the 'repair' option on your installer from which you can either reinstall the missing Python or tell them that's what they need to do.
To install virtualenv I would first install pip (see https://pip.pypa.io/en/latest/installing.html for instructions, you need to download get_pip.py and run it with the Python 2.7 interpreter), then just run pip install virtualenv.

Installing a package to Canopy

I'm really new to coding, programming, Python, and just computers in general, so I need some help with Canopy. I've been having pretty consistent troubles installing any packages to Canopy; some stuff is in the internal package manager,but whenever it isn't, it's really confusing. I guess I'll list a specific installation.
I'm trying to install "pywcs" (link provided below) to my Win7 64-bit machine. I have Cygwin if that helps at all. I do not know how to go about this; the stuff I found online is pretty confusing, and Cygwin easy_install (filename) never seems to work. Any step-by-step solutions?
The way I installed astropy is as follows.
Open Windows Terminal
Change Directory to C:\Users\<USER NAME>\AppData\Local\Enthought\Canopy32\User\Scripts
Type easy_install.exe astropy
Wait until the download completes, and restart Enthought.
sometimes installing packages can be hard for enthought canopy . You could install all python packages using pip install mrjob command on the its own canopy command prompt
Go to tools tab on the canopy editor ,
Left click on the canopy command prompt ,
Finally pip install <package name> and hit Enter key
The key point is that in order to install a package into any Python distribution (including Canopy Python), you should use that Python to perform the installation. You refer to Cygwin's "easy_install", but you should instead use Canopy's easy_install.
As described in this article, the easiest way to be sure that you are running Canopy's Python (and Canopy's easy_install) is to have Canopy Python on your PATH. This is done by default during Canopy installation, but if you uncheck this option then, or if your Cygwin installation doesn't use your Windows PATH, then you will need to adjust your Cygwin PATH accordingly.
Doing as Sukrit suggests, and running the installation from the Canopy Python Scripts directory, is also a reasonable approach.
Alternatively, depending on its compiler dependencies, you may be able to install astropy from a Windows Command Prompt rather than from Cygwin (of course Canopy must be on the PATH here too, as it would be by default.)
In Linux you can do it as follows.
1) Make sure you are using the Canopy version of Python - check out https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-User-Python-from-the-command-line
2) At the command prompt use easy_install, for example:
$ easy_install pp==1.5.7
to install version 1.5.7 of pp
Just for information, Astropy is now included by default in Enthought Canopy:
https://www.enthought.com/products/canopy/package-index/

What is the best way to install python 2 on OS X?

A colleague of mine wants to use my python 2 code on his OS X (10.6) machine. My code imports several built-in python packages, including Tkinter and shelve, and also uses third-party packages, including numpy, scipy, matplotlib, and ipython.
I've encountered a few problems with OS X's built-in python. (IDLE doesn't work, for example*). I suspect I should install a more recent version of python, and a different version of Tk.
My questions:
Will having two different versions of python/Tk on the same machine cause problems?
I would like to associate the terminal commands 'python', 'ipython', and 'easy_install' with the more recent version of python. How should I do this?
When I install third-party packages like numpy using a .dmg file, how do I control which version of python numpy installs into?
Is there a better way to do this?
If this process goes well, I'd consider adding OS X instructions to my code's documentation, so I'd like to boil down this process to the simplest, most general approach.
*EDIT: Also, this
EDIT: Thank you everyone for the useful answers. My colleague tried MacPorts, which seems to work well, but has a few speedbumps. First we had to install Xcode from the system install disk. This is not a fast or lightweight install (several GB). Luckily we still had the disk! Once Xcode was installed, MacPorts was easy to install. Python and the python subpackages we needed were also easy to install, but he told me this installation took several hours. Presumably this delay is due to compilation? He had an easy time setting the MacPorts python as default. However, I think we have to change the 'Python Launcher' application by hand, this seems to still default to the system python.
Even though he has a working system now, I'm tempted to ask him to try one of the other solutions. I'm not sure all of my code's potential users will tolerate a multi-hour, multi-gigabyte installation.
I use brew to install all my libraries/compilers/interpreters.
To install python try this:
brew install python
Then add Python's binaries directory to your $PATH in your ~/.profile:
export PATH=`brew --prefix python`/bin:$PATH
I'd recommend you to install pip, virtualenv and virtualenvwrapper to have better control over your environment too.
Have you tried ActivePython?
It includes a package manager (PyPM) that, by default, installs into your home directory (eg: ~/Library/Python/2.7). Main scripts get symlinked in /usr/local/bin; use the included pythonselect to set the active Python version.
You don't have to bother installing .dmg packages, as PyPM is a binary package manager ... therefore you can install non-pure Python packages like NumPy without having to compile things yourself.
ActivePython can use Apple's Tcl/Tk or, if installed, ActiveTcl.
A "simplest, most general approach" in your documentation could be:
Install ActivePython 2.7
Open Terminal and type pypm-2.7 install matplotlib ipython
Using MacPorts, you can install python 2.6, 2.7, 3.1 and 3.2 at the same time, with their own packages, without ever touching the built-in python.
numpy, scipy, matplotlib, and ipython are also available as ports for most of those python versions.
Moreover, if you install the python_select port, you'll be able:
to choose which one of those (plus the built-in python) is the "default" python;
to install python packages through easy_install/pip for the "selected" python, if they're not available as ports.
Add virtualenv to the mix, and you'll have a very, very flexible Python development environment.
As for your questions:
Q1: with MacPorts, no. while not a frequent user, I've installed and used matplotlib in 2.6 and 2.7, switching between the two using python_select.
Q2: easy_install, pip, ipython will be "linked" to the python they were installed by. (but see tip 1)
Q3: it's easier to install one of the py{26,27,xx}-numpy ports, or pip install numpy under your python_select'ed python.
Q4: well, MacPorts is the best thing I know after APT on Debian/Ubuntu... :-)
Now, two tips if you try MacPorts:
MacPorts cleanly installs ports separately from the OS X installation, in an /opt/local directory, and each python version is installed in a /opt/local/Library/Frameworks/Python.framework/Versions/{2.5,2.6,2.7,...} directory. Using python_select cleanly switch the "python" command using links. BUT... the Versions/{2.5,2.6,2.7,...}/bin directory, where python scripts are installed, is not added to the PATH. Just adding: export PATH=/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH to your ~/.profile will always give you direct access to the scripts installed for the selected python.
to avoid bad surprises, I've added a echo Selected python is \"$(python_select -s)\" line to my ~/.profile, so I always know which is my currently selected python when opening a session... :-)
Regards,
Georges
In almost all cases, the best python to use is the one from http://python.org/. It sets up the paths correctly and doesn't overwrite anything. DMG package installs usually work automatically, as does python setup.py install, and it's not too hard to get setuptools to work. If you want per-user installs, it is easy to set up .pydistutils.cfg and python automatically recognizes the path install_lib = ~/Library/Python/$py_version_short/site-packages
An addendum regarding the usage of brew:
Since some time, brew install python will install python3.
If you intend to install python2, you want to use
brew install python#2
It is perfectly fine to install both python and python3 using brew!
Here is an old post that answers your questions too.
In general it is not a problem at all to have more than one python installation on your machine. You just have to watch out which one you are calling on the command line.
>> which python
... helps to identify where your python binary is located. The original Mac OS X python is usually at "/usr/bin/python"
I personally use the MacPorts python installation. It also supports you with the installation of modules. (see link above)
I have 4 versions of python on my MacBook Pro. 2 from the original install of OS X 10.6 and a subsequent update, then self installed copies of python 2.7 and 3.2. You can update the python command to point at any of the versions. They all install in separate directories and cause no problems with each other.
I'm not sure what will happen when you install from a .dmg file. I believe it will simply use whatever version python points to.
This post on superuser.com answers your questions on changing default paths.

Categories

Resources