ERROR: ipykernel requires Python version 3.4 or above - python

I am using Ubuntu 16.04 lts. My default python binary is python2.7. When I am trying to install ipykernel for hydrogen in atom editor, with the following command
python -m pip install ipykernel
It is giving the following errors
ERROR: ipykernel requires Python version 3.4 or above.
I am trying to install ipykernel for python2. I have already installed python3.7. Also ipython and jupyter notebook is installed.

Starting with version 5.0 of the kernel, and version 6.0 of IPython, compatibility with Python 2 was dropped.
As far as I know, the only solution is to install an earlier release.
In order to have Python 2.7 available in the Jupyter Notebook I installed IPython 5.7, and ipykernel 4.10. If you want to install earlier releases of IPython or ipykernel you can do the following:
Uninstall IPython
pip uninstall ipython
Reinstall IPython
python2 -m pip install ipython==5.7 --user
Install ipykernel
python2 -m pip install ipykernel==4.10 --user

Try using Anaconda
You can learn how to install Anaconda from here
After that, try creating a virtual environment via:
conda create -n yourenvname python=2.7 anaconda
And activate it via:
source activate yourenvname
After that, try installing:
pip install ipython
pip intall ipykernel

Related

Can't install installed python packages

I am using Jupyter Notebook to install packages with the command: !pip install.
I just used this command to install the Options package, but it's still not showing up. I checked the default python Environment as well as the conda environment.
list of Python environments
To install packages into jupyter notebook you have to use conda instead of pip. Just find the conda install instruction for the package you are trying to install.
For example, the command to install numpy on conda is:
conda install -c anaconda numpy
instead of the regular pip version which would've been:
pip install numpy
You can search for yours by googling: conda install <package-name-you-want-to-install>.

If Anaconda comes with pip, why do instructions suggest installing it?

I have just installed Anaconda with Python3.7 on my Ubuntu 18.04. Ubuntu 18.04 comes with Python3.6 by default (but not pip).
After installing Anaconda and reading its documentation, I can see that Anaconda comes with both conda and pip. This is the case, as I can see:
$ which pip
# Output: /home/user-name/anaconda3/bin/pip
$ pip --version
# Output:
pip 10.0.1 from /home/user-name/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
However, I am confused when reading the instructions from this link:
https://conda.io/docs/user-guide/tasks/manage-pkgs.html#installing-non-conda-packages
On one hand it says: " Both pip and conda are included in Anaconda and Miniconda, so you do not need to install them separately." => That's the pip I can see in my commands above.
But on the other hand it says: " It is possible to have pip installed outside a conda environment or inside a conda environment. To gain the benefits of conda integration, be sure to install pip inside the currently active conda environment, and then install packages with that instance of pip. The command conda list shows packages installed this way, with a label showing that they were installed with pip.
So I'm confused:
I clearly got a version of pip when installing Anaconda and I can see in /home/user-name/anaconda3/bin
But if I want to use pip to install a package, I need to install pip in my environment using $ conda install pip and then $ pip install package (all of this in my normal Ubuntu terminal).
I don't understand how this makes sense..
Many thanks!

How to install package using pip when you have 2 Python versions

I have 2 anaconda in my system: one with python 2.7 & and another with python 3.5.
My command prompt is showing python version as 2.7.
I need to install one package for Python 3.5 using pip only,not conda install. I installed it using pip. It's showing installed successfully, but I'm not able to import it in Anaconda with Python 3.5.
My python 2.7 path is given in path environmental variable. Can you suggest me how to install it using pip install for python 3.5?
I don't have python 3 installed in my system. I think I have anaconda 3.5 environment in my system. Please refer the screen shot. Also I can't able to install python 3.5 in my system
To install a package in specific version, try this:
A specific version of python:
$ python-3.5 -m pip install <pkg-name>
Assuming you mean that you have two conda environments, go to a Anaconda command prompt and activate the Python 3.5 environment. Then, if pip is not installed, do:
conda install pip
Then, you should be able to run
pip install <package>
to install in to Python 3.5 provided that you are in the Python 3.5 environment.
If you don't have a Python 3.5 environment yet, simply do
conda create --name py35 python=3.5
followed by
activate py35 (Windows)
source activate py35 (Linux or macOS)
You can use:
pip install --install-option="--prefix=$PATH_PREFIX" <package_name>
or
pip install -t <direct directory> <package_name>

How do I use newer pip after the upgrade? (10 --> 18)

I'm using Python 3.6 on Pycharm venv (virtual environment provided by IDE)
Terminal kept telling me to upgrade my pip from old 10.0.1 to newer 18:
You are using pip version 10.0.1, however version 18.0 is available
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
So I upgraded my pip with the suggested command.
However, when I check my pip version by pip --version, it's still on 10.0.1 and pip keeps telling me to upgrade.
pip 10.0.1 from
h:\pycharmprojects\my_project\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip
(python 3.6)
I'm sure it's already up-to-date by checking IDE's interpreter settings.
I know it doesn't really matter but it bothers me pretty much.
I already tried closing and opening new terminal but that clearly doesn't work.
How do I use my newly installed pip? Is it just Pycharm's problem?
When you are using a virtual environment in pycharm, you update the version of pip inside that virtual environment.
If you want to upgrade pip outside of the venv, type
python -m pip install pip -U
Where python is how you start python from the terminal,
which may be python3 or py -3.6 depending on your operating system.
To install inside the virtual environment, you can activate
that inside the terminal and then type the above command.
If you run this command in your PyCharm terminal, it will resolve the warning about pip:
python -m pip install -U --force-reinstall pip
Here are some comments on the JetBrains community page

Installed Anaconda 4.3.1 (64-bit) which contains Python 3.6 but pip3 missing, cannot install tensorflow

I downloaded the latest stable Anaconda install off the Continuum website which turned out to be Anaconda 4.3.1 (64-bit) and comes with Python 3.6.0. I am in a Windows 10 environment.
However pip3 is missing and I cannot install any Python 3.x packages via pip3.
What am I doing wrong?
If you do not have another environment installed python 3+ will default to just pip I believe since pip3 is just an alias for pip.
pip install --upgrade pip
or You can do it with the associated Python binary too; if it executable as python3, then use that:
python3 -m pip install --upgrade pip
after that check:
pip --version
otherwise just try pip-3.6
for tensorflow on conda:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-win_amd64.whl
for python 3.6 due to conda providing the 3.5 one: from
pip install https://testpypi.python.org/packages/db/d2/876b5eedda1f81d5b5734277a155fa0894d394a7f55efa9946a818ad1190/tensorflow-0.12.1-cp36-cp36m-win_amd64.whl
Since this wheel had a version that is undesirable we could instead install
the wheel directly from gohlke's windows binaries repository :
download the wheel for python 3.6 from here and then install the wheel:
cd to the directory containing .whl file:
pip install some-package.whl
easy_install pip
I used it, for the problem of pip installation in miniconda.
sometimes the pip is not properly installed but it claims yes
Solution:- (Note:- This will surely work for all!!)
Step 1:- conda search python
Step 2:- conda install python=3.5.2
Step 3:- pip install tensorflow
Step 4:- import tensorflow as tf
I have Windows10, 64bit, Anaconda4.3 with Python 3.6.
Karthik' soluton worked for me. Before that I tried everything including "conda create -n tensorflow python=3.5", but it did not work (although "python --version" gave 3.5.3).
you should be able to install tensorflow using
$ conda install -c conda-forge tensorflow

Categories