Both ipython and ipython3 shows "Python 3.5.2" - ipython

If I invoke ipython and ipython3, both show exactly the same message:
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.
Is not it that ipython shows something like Python 2?
How can I make ipython use Python 2?

IPython 6+ requires Python 3.3+, so that's what it defaults to, and it will not open Python 2.x.
From the 6.x Series page in the IPython docs:
Important
This documentation covers IPython versions 6.0 and higher. Beginning
with version 6.0, IPython stopped supporting compatibility with Python
versions lower than 3.3 including all versions of Python 2.7.
If you are looking for an IPython version compatible with Python 2.7,
please use the IPython 5.x LTS release and refer to its documentation
(LTS is the long term support release).

Related

Installing ipython with python 3.5 using pip?

The Jupyter docs recommend using conda to install jupyter, if the runtime python is version 3.5 or lower. Installation is pretty straightforward with conda.
Follow Anaconda’s instructions for downloading and installing the Python 3.5 version.
$ conda install jupyter
$ pip list | grep ipython
ipython 7.29.0
ipython-genutils 0.2.0
$ ipython notebook --ip=0.0.0.0
This question is to discover if it's possible to install a 3.5 compatible jupyter using only pip, and without conda.
Given the following environment:
$ python --version
Python 3.5.2
$ sudo apt-get install python3-pip
$ pip3 --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
Installing ipython is possible with the following restrictions:
$ python3 -m pip install ipython==7.9 traitlets==4.3.3 jedi==0.17.2
Jupyter, however, doesn't install gracefully.
The following allows for installation:
pip3 install jupyter ipython==7.9 traitlets==4.3.3 jedi==0.17.2 pyzmq==20 argon2-cffi==21.1.0
But at runtime, jupyter crashes:
File "/home/vagrant/.local/lib/python3.5/site-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
File "/home/vagrant/.local/lib/python3.5/site-packages/notebook/__init__.py", line 27, in <module>
from .nbextensions import install_nbextension
File "/home/vagrant/.local/lib/python3.5/site-packages/notebook/nbextensions.py", line 15, in <module>
from jupyter_core.paths import (
File "/home/vagrant/.local/lib/python3.5/site-packages/jupyter_core/__init__.py", line 1, in <module>
from .version import version_info, __version__
File "/home/vagrant/.local/lib/python3.5/site-packages/jupyter_core/version.py", line 21
_suffix_ = f'.dev{version_info.serial}'
Is it possible to install a 3.5 friendly jupyter using pip?
Resources
pyzmq https://github.com/jupyter/notebook/issues/5961
iPython Versions
https://github.com/ipython/ipython/blob/master/README.rst
IPython 7.10+ supports Python 3.6 and above.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Python 3.3 and 3.4 were supported up to IPython 6.x.
Python 3.5 was supported with IPython 7.0 to 7.9.
traitlets vs. python 3.5
Traitlets 5 uses f-strings in code, not compatible with Python 3.5
uninstall the traitlets 5.0.3 version, and install 4.3.3 version
https://githubmemory.com/repo/ipython/traitlets/issues/620
argon2-cffi vs. python 3.5
https://packagegalaxy.com/python/argon2-cffi
It targets Python 3.6 and newer, and PyPy3.
The last version that works with Python 2.7 is 20.1.0, and the last version that works with Python 3.5 is 21.1.0.
jedi vs. python 3.5
https://jedi.readthedocs.io/en/latest/docs/changelog.html
0.17.2 (2020-07-17)
This will be the last release that supports Python 2 and Python 3.5. 0.18.0 will be Python 3.6+.

TensorFlow works in command prompt but doesn't work in spyder( ipython)

My spyder version is 3.3.4 in anaconda( version 3.5), and my Ipython version is 7.4.0. Now my python version is 3.7.3 and I installed tensorflow of 1.13.1 version. When I open spyder and input the commands "import tensorflow as tf ",it is always running and I can not use function of tf. But I can use tensorflow in python through command prompt, I'm just not used to editing function in command prompt. So I want to know what is the reason that tensorflow doesn't work in spyder while running well in command prompt.

Visual Studio Code and pylint not finding module issues

First, I may have more of an issue with correct environment selection. I did a fresh install of Linux Mint 19 and apt dist-upgrade... etc... and then used apt-get and pip to install pymysql, pil.intertk and pylint for both python and python3 from the cli...
All is good from cli:
~$ python3 --version
Python 3.6.5
~$ pylint3 --version
No config file found, using default configuration
pylint3 1.8.3,
astroid 1.6.0
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]
python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymysql
>>> import PIL
>>>
After installing VSC.... the only two selection of python environments are 2.7.12 and 3.5.2 ?
I then modified VSC settings with: "python.pythonPath": "/usr/bin/python3"
Which still shows as Python 3.5.2 64-bit within VSC
But here comes my issue that I have tried many suggestions I have found from searching with no luck...
pylint is not finding any module I install. I assume its due to the mix match of version ? But not sure how to resolve that?
When I try to specify the pylint path : "python.linting.pylintPath": "/usr/bin/pylint3"
I get an invalid path error in VSC.. but its a valid path
~$ which pylint3
/usr/bin/pylint3
Any help would be greatly appreciated....
So after some frustrating trail and error I have fixed the issue by uninstalling the Flatpak version of Visual Studio Code listed in the Linux Mint's Software Center... and installing the deb package from the official site.
After installing the deb package... the proper version of python are showing and pylint is working correctly.

yum command : python version mismatch

I have Red Hat Linux (Red Hat Enterprise Linux Server release 6.5 (Santiago) ) and yum in not working with message
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.8 (default, Nov 7 2014, 11:45:08)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
Current version of python is 2.7.8
Any help is appreciated.
CentOS 6 ships with python 2.6. Someone installed an incompatible version of python system-wide and that has broken things. That should not have been done.
You need to find out how the 2.7 version of python was installed and fix that (by removing the incorrect package or by removing the source-installed python or by fixing the $PATH or whatever else is appropriate).
To help figure out what the problem is exactly we need the output from the following commands (as a start).
What does rpm -qa python\* say?
What does which -a python say?

IPython not available in PyDev console

I would like to use the IPython interpreter in Eclipse/PyDev.
PyDev however does not recognize my IPython installation.
The results I get is the following:
>>> import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
PyDev console: using default backend (IPython not available).
D:\QuantumGIS\apps\Python25\python.exe 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
>>> import IPython
>>>
The "import IPython" command does work.
I'm using
Windows XP 32 bit
Eclipse 3.7.2
PyDev 2.4.0
IPython 0.10.2
Python 2.5 (version that is supplied with QGIS 1.7.3)
How should I set up PyDev so I can use IPython as the interactive interpreter?
Not sure if it's the same issue but from Fabio's blog he said to try in the python console (import IPython worked ok):
from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
which gave me nothing useful and:
from IPython.frontend.prefilterfrontend import PrefilterFrontEnd
Which complained that twisted wasn't installed. I installed twisted 12.0 for Python 2.5 and it's dependency Zope (3.8 for Python 2.5), restarted the IDE and the console now shows ipython. There was something about ipython actually using XMLRPC to communicate with the IDE so I guess twisted is needed for that.
Hope that helps.
Stu.
Windows 7
Aptana studio 3.1.2 (version of eclipse)
PyDev 2.5.0 IPython 0.10
Python 2.5 (needed for some old code I'm working on and haven't
upgraded yet)