installing IPython with two versions of Python (Windows) - python

Is it possible to have IPython (0.12) installed on the same
system with two different versions of Python (v 2.7 and 3.2)? Currently I have both versions of Python running happily on my system.
I am using two machines, one with Windows 7 64-bit, the other XP SP2 32-bit, and both have Python 2.7.2 and 3.2 installed. I have been using IPython with Python 2.7 w/o any problems for a while on both.
Now I would like to have 3.2 available too with IPython, but when I try to run the binary windows IPython installer I get this error toward the end of the install:
*** run_installscript: internal error 0xFFFFFFFF ***
and no shortcuts/entries into Start Menu etc are created.
(I ran the install as adminstrator under Win 7) I am running into the same problem with XP and Win 7.
After poking around the net and SO for a while I saw references for
getting setuptools. Unfortunately, there's no version for Python 3.x
but it was suggested to use distribute.py instead which I ran and
installed. I am not sure how to proceed next. And I'm not even sure it
is possible to do this (though I think it is :)
Any suggestions?
UPDATE: There was a problem with import readline not working with Python 3.2.3, but I was able to fix it by downloading pyreadline-2.0-dev1.win32.exe which works with Python 3.2.3 .. the above problem remains unfortunately.

Ok, here's my solution to get IPython 0.12.1 to work with both Python ver
2.7.x and 3.2.x on the same system (ie. under Windows 7 64 bit and XP SP2 32 bit). It's not
perfect, but works, and hopefully will help others. Where I am showing directories they refer to XP (but should be adjusted accordingly for Windows 7)
Steps for both:
Install both versions of Python via the binary windows installer provided at
Python.org
Install this version of pyreadline pyreadline-2.0-dev1.win32.exe which works
for both versions of Python (I could not get the widely available version 1.7 to work with Python 3.2.x)
I am not sure if distribute.py is necessary, I'd skip it on the
first try.
Download ipython-0.12.1.zip file and extract it. Place it under your Programs directory and cd into it (I'll call this the ipython_dir) [I tried the binary installer numerous times without success]
For Python 3.2 (easier)
In the ipython_dir:
c:\python32\pyton.exe setup.py install
will create ipython3.exe in c:\python32\Scripts that can be used to
fire up iPython
For Python 2.7 (a bit odd)
The above method failed. However, it is possible to start IPython from the ipython_dir with
c:\python27\python.exe ipython.py
I can't explain why this is so, but since I use Console2 I can hide
these two ways of starting IPython.
Summary:
To start IPython with v 2.7.x of Python:
c:\python27\python.exe "C:\Program Files..\ipython_dir\ipython.py"
To start IPython with v 3.2.x of Python:
c:\python32\Scripts\python3.exe
That was a lot of work and took most of the day, so I hope posting the steps above
will save someone else a lot of time (and help me remember what I have to do next time I struggle with this)
Thanks everyone for their suggestions.
Addendum: None of the above resulted in shortcuts or entries in the Start/Program Menus. Shortcuts can be created manually, or in my case aren't necessary since I'm using a special shell (Console2) to run IPython.

The first question in the iPython FAQ titled "Running IPython against multiple versions of Python" may help.

Related

The same program written in Jupyter notebook with Pyhon 3.7 doesn't work somewhere else

Imagine the situation like below. There must be simple explanation.
I have a program written in Jupyter notebook and use Python 3.7. There is no errors while executing the program and works on two PC computers. As I remember there where just only Python 3.7 (and adds like matplotlib etc. all what is needed).
Then on the others computers where is Python 3.8 the same programs gives me an error. Why?
I took another two PC removed all Python installation and install 3.7 3.8 3.9 3.10 Python (tried every of them) and I can't execute the programs without error. Why is like that? All extensions like matplotlib, numpy , scipy which is needed every time are install in proper way by pip etc...Path in Windows are always correct.
It seems to me that on those two computer where program work fine was only Python 3.7 (but I am not sure in 100% that there hadn't been installed previous version of the Python) the programs works. Any other installation or refreshment of the Python makes that teh program gives me errors.
The only one what I should to do is 100% reset Windows and do fresh and the newest one Python instillation (Jupyther etc.) and check whether the error exist or not. But I would like to know what makes the problem and not to refresh all my Windows installation every time.
The problem is even more interesting when I am taking the same program
and put them to the virtual Jupyther using the Internet and browser they always work fine without any errors and there is for sure the news Python engine I guess not 3.7.
Did you try to execute "pip freeze" or "conda list" on these computers (with Ananconda Powershell for ex.) to verify that all the libraries' versions you are using are the same?
Looking at the error on the screenshot, I would bet that the problem does not come from your Python version but more from a higher version on matplotlib installed on the first two PCs, which makes that the third one (with potentially an older version of matplotlib) does not support the arguments given.
Just try executing:
(base) PS C:\XXX\Python> conda list matplotlib
and should get the version of matplotlib installed on each PC, like this:
# packages in environment at C:\XXX\Miniconda3:
#
# Name Version Build Channel
matplotlib 3.4.2 pypi_0 pypi
matplotlib-inline 0.1.2 pypi_0 pypi
If they are different, this might be where the issue comes from.

Trying to run python 2 and python 3 on the same machine, having problems with 2.7 tkinter

I had python 2.7 on my machine running just fine. I decided to install python 3.3 on my computer and changed my environment variable path to C:\Python33 instead, intending that to be my main one. Running IDLE on python 3.3 works just fine, but for some reason, IDLE (and Tkinter) in python 2.7 no longer works. When I run the following command in the command prompt:
PS C:\python27\lib\idlelib> C:\python27\python.exe idle.py
** IDLE can't import Tkinter. Your python may not be configured for Tk. **
Clearly I'm doing something wrong, or my installation of 3.3 messed something up. Can anyone help?
This is just a idea but python 2.7 and 3.3 versions have minor differences on coding ex - input and raw input difference. So i think the version developers make a exception if you run your 2.7 code on 3.3 compiler.
My suggestion better have 2 environment variables for both versions because as i told before syntax are different from 2.7 to 3.3 minor way .
My memory isn't perfect...but for encountering this question much later and wondering, I ended up fixing my problem by uninstalling both versions (a pain, I know) and reinstalling with Python 3.3 first and Python 2.7 second. For some reason, after this I was able to run both versions of IDLE (in their respective folders) with no problem.

MySQLdb installation on Windows 7

I am running python 2.7 in windows 7. I'd like to link up to mysql and found MySQLdb. I have tried easy_install mysql-python and found the /Z1 error. Although I downloaded the source, I'd like to avoid having to make all the changes to avoid the Z1 error (due to the source expecting the VC compiler that i don't have). i downloaded the 1.2.4 binary and installed. however, when i start up python and try "import MySQLdb", it does not find it.
i have looked at many pages. i am sure that i am overlooking something obvious, but i am new to python and i've run around in circles at so many pages.
please help.
edit: the installation actually worked. the problem is that i must have installed a 32 bit version. it works fine in IDLE which is using python 2.7.3 32 bit. but i was trying to use ipython and spyder, both were set up as 64.
i tried to install "unofficial version" from http://www.lfd.uci.edu/~gohlke/pythonlibs/ which i got from Python: How to install mysqldb on windows 7 x64?. it claims python 2.7 is not in registry. any help here would be welcome.
I did not solve the /Z1 issue. However, i did determine what i did wrong with the binary install. i had included /python27/LIB/site-packages/MySQLdb only. once i also added /python27/LIB/site-packages/MySQL_python.1.2.4b4-py2.7.egg-info it worked. i did not verify whether i need both in the pythonpath or not. but having both does work.

How do I 'down grade' to python2.7

Being quite cavalier I went for the latest version of Python (3.2.2)
Unfortunately it lacks the matplotlib that I desperately need.
I have downloaded python 2.7.
My simple question is weather I have to uninstall python3.2 or can I leave it on my windows 64 system?
you can keep the python 3.2 installation, but you will have to be carefull about which version you launch (by making the call explicit). you can always check the python version in a script by doing:
import sys
print sys.version
If you have no particular use of python 3.2, I recommend uninstalling it.
I'm not sure if there's a difference on python in windows but on mac and linux I simply call older versions using
python2.6 or python2.7
It seems to keep all the versions I previously had before. Maybe try running the above command and seeing if it works on windows and if it does just change the symbolic link 'python' is pointing to.

Python Not Enabled In Vim

I am trying to get the Xdebug vim plugin to work which depends on python. Here is my environment: Windows 7 Professional 64bit, Vim 7.3. I got everything set up for this plugin, but when I hit F5 nothing happens. I found some blogs describing some additional steps to get this working on Windows. All of them stressed making sure the correct version of Python is installed correctly. I looked at the plugin code in the debugger.vim file and close to the top it checks to see if python is available and exits if it is not. I inserted an echo command to tell me if python is not installed, and sure enough a message box pops up informing me of such. Here is the modified code:
if !has("python")
echo 'python NOT loaded'
finish
endif
According to this blog http://phphints.wordpress.com/2008/08/20/add-debug-support-to-vim/ I need to install the version of python that includes the dll vim is looking for when I run the version command from vim. Mine reports:
-DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DDYNAMIC_PYTHON3_DLL=\"python31.dll\"
So I installed the 64 bit version of python 2.7.1. Same result even though python27.dll is in the System 32 folder. I also tried adding the location of python.exe to the PATH, but this did not help. I also tried installing the 64 bit version of python 3.1.3 but this did not help. Any ideas?
I made the following changes, and now python is working (The conditional echo statement is never reached). I uninstalled Vim and re-installed it. I uninstalled the 64 bit versions of Python 2.7.1 and 3.1.3. I installed the 32 bit version of python 2.7.1.
I am guessing the change that made the difference is using the 32 bit version of Python 2.7.1 since I am using the 32 bit version of Vim. What do you think(leave a comment)?
This may not be the direct solution to your problem, but you need to make sure the vim executable compiled with Python support.
You can check what options are compiled by running :version in the vim command line.
Also, as far as I know, python3 support only added after vim7.3. If you have vim7.2, your best bet is to get python 2 working.

Categories

Resources