When running help("modules") in python 3.8 (both inside of Jupyter Notebook and in regular python terminal), the following warning appears:
/opt/conda/lib/python3.8/site-packages/IPython/kernel/__init__.py:12:
ShimWarning: The `IPython.kernel` package has been deprecated since IPython 4.0.
You should import from ipykernel or jupyter_client instead.
warn("The `IPython.kernel` package has been deprecated since IPython 4.0.")
Is there some package or library I need to update in order to resolve this warning? What does it mean to import from ipykernel or jupyter_client?
I noticed in the replies to another thread that someone else has run into this exact issue, but no answers. Thanks in advance!
Related
When I run pip freeze in the command line, I see: numpy==1.16.3. I am trying to run numpy.isin(...) (documented here), but I get the error
AttributeError: 'module' object has no attribute 'isin'.
So I check the version of python being run in the python script as:
import numpy as np
print(np.__version__)
This outputs:
1.8.0rc1
And since the function was introduced in version 1.13.0, I need to figure out why the older version of numpy is being used instead of the up-to-date version. I usually upgrade with pip in the command line. How can I fix this problem?
Just in case somebody else has a similar problem, I followed the steps in this tutorial to familiarize myself with pipvirtualenv. I installed the updated version of numpy in the pipvirtualenvwhile in the same directory as my python script(s). While there, I entered the virtual env shell and then ran the command - it worked. I then used exit (as opposed to deactivate) to deactivate the shell, and tried the script while outside the shell - it worked again.
I cannot get Jupyter Notebook running -- it keeps restarting the kernel and giving the error message,
ImportError: No module named 'prompt_toolkit.formatted_text'
A few threads online say it is an issue with ipython versioning which can be fixed by a rollback, but that hasn't worked for me.
Here are my current versions of relevant packages:
conda==4.5.11
ipykernel==4.10.0
ipython==6.5.0
ipython-genutils==0.2.0
ipywidgets==7.4.2
jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==4.1.1
jupyter-core==4.4.0
jupyter-kernel-gateway==2.1.0
jupyterlab==0.34.12
jupyterlab-launcher==0.13.1
notebook==5.7.0
prompt-toolkit==1.0.15
Any help you can provide would be great. Thanks!
I did have the same issue with Jupyter Notebook. Point is that ipython requirement specific version of prompt-toolkit. In my case, I have ipython 7.2.0 which required prompt-toolkit <2.1.0,>=2.0.0
I just added prompt-toolkit<2.1.0,>=2.0.0 to my requirements.txt to solve this problem.
Try to run pip install prompt_toolkit and see which version of prompt_toolkit need in your project.
I just tried to use pd.HDFStore in IPython Notebook with a Python 3 kernel (Anaconda 2&3 on Ubuntu 14.04)
import pandas as pd
store = pd.HDFStore('/home/Jian/Downloads/test.h5')
but it throws the following error
ImportError: HDFStore requires PyTables, "libhdf5.so.9: cannot open shared object file: No such file or directory" problem importing
I initially thought it's because pytables is somehow missing, but when I check $source activate py34 and $conda list, pytables 3.2.0 is already installed under anaconda python3 environment.
Also, if I switch to Python 2, for example, $source activate py27 and start ipython notebook, it works properly and no import error is thrown.
I guess that I must miss something for configuring pytables under anaconda python 3 env, but I cannot figure it out. Any help is highly appreciated.
Update:
I just tried on a fresh install of Anaconda3-2.3.0-Linux-x86_64 from official website and it ends up with the same error. When I try $locate libhdf5.so.9 in command line, nothing shows up.
This is a known issue that we are working on. When it is fixed, conda update --all will update the libraries and fix the issue.
I am using Anaconda with python 3.4 and I am not able to get all the pillow packages I need I am afraid on Windows 8.1.
I installed pillow via the Anaconda console with:
pip install pillow
which lead to:
The following packages will be UPDATED:
conda: 3.10.0-py34_0 --> 3.10.1-py34_0
conda-env: 2.1.3-py34_0 --> 2.1.4-py34_0
pillow: 2.7.0-py34_0 --> 2.8.1-py34_0
pip: 6.0.8-py34_0 --> 6.1.1-py34_0
setuptools: 14.3-py34_0 --> 15.0-py34_0
Now, in the spyder IPython console I start with: import tkinter, from PIL import ImageTk I have no errors here, but when executing ImageTk.PhotoImage(file='a.jpg') I receive an error, telling me: ImportError: cannot import name '_imagingtk'
What did I miss?
I know this is not a complete answer, but I have had the same problem and spent a day trying to figure it out...
Here is a small subset of things I tried yesterday to the best of my weak memory...
-Tried upgrating to the latest Python environment using anaconda (tip: you can create one using
conda update conda
conda update anaconda
(I think that's it, but may have tried to make sure for key packages explicitly etc.)
-Tried using Python 3.3 environment using anaconda (tip: you can create one using
conda update conda
conda create -n py33 python=3.3 anaconda
activate py33
-Tried using PythonWin instead of anaconda (that one took some time, had to install packets like numpy manually...)
-Tried updating / downgrading / installing/ uninstalling all kinds of different variations of Pillow, PIL, etc....
-Tried using opencv instead of PIL, though did not try to write my own components...
-Tried manually copying Tcl/tk and a few others to the lib directory as suggested by some posts
-Tried using import tkinter instead of Tkinter, using import Image vs. form PIL import Image (and in general taking Image from PIL, or opencv, or Tkinter) and a lot of other similar changes to the point it fell I was doing silly things
-...
At the end, I googled a few pages about GUIs in python, and now I am using wx... I had to run
conda install wxpython
and that was it. I have to say that after all this, I am presently surprised by how easy it was to make it work, here is a code example...
You need tcl/tk library.
Install them using apt-get
Do sudo apt-get install tk8.6-dev tcl8.6-dev
--Reference.
I'm trying to run my code and I don't know what specific package I need in order to get my import statement to work. Below is my header and I keep getting an error saying ImportError no module named statistics. I have looked at a bunch of different pages to see where I can download a solution, but I am trapped. I know my code works because I ran it on my schools lab. If anyone can help, that' be great!
Just note I am a beginner and am using Linux on my virtual machine with Python 2.7
import sys
import requests
import matplotlib.pyplot as plt
import statistics as stat
Statistics "A Python 2.* port of 3.4 Statistics Module" (PyPI).
If you use 2.7.9, you will have pip installed, and pip install statistics within the 2.7 directory should install the module for 2.7 (I am not a pip or virtual machine expert, so might be slightly off.)
It comes pre-installed in python --Version 3. To import in python version 2 in Ubuntu, open Terminal and type
sudo pip install statistics
Enter your password and it will get installed.
Ps: you need to have pip already installed.
You need to be using python 3.4 to import statistics. Upgrade to the current version and you should have no problems.