Why am getting this error in jupyter lab? "AssertionError: wrong color format 'ansiyellow'" - jupyter-lab

I know there is a "." missing while reading csv file in the end. That I have done knowingly just to show you what extra error am getting everytime. The problem is whenever I do any mistake in coding I get this assertionError : wrong color format everytime . can you help me with this ?

It might be that you are using a recent IPython version (8.0) but do not have the required (recent) pygments version (as per https://github.com/ipython/ipython/issues/13441). An explicit requirement of pygments>=2.4.0 was added in IPython 8.1. The options are:
if you have 8.0: either upgrade to the latest IPython or upgrade pygments
if you have newer IPython: check pygments version and try to upgrade if below 2.4.0

Related

Cannot import torch Error loading ..\caffe2_nvrtc.dll" or one of its dependencies

I am on a Windows 10 64 bit system.
Pytorch for cuda has been working successfully for some time.
Today I tried to upgrade to the latest version of Pytorch (1.13) using
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Now I cannot import torch. I get the error:
OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\alan\anaconda3\lib\site-packages\torch\lib\caffe2_nvrtc.dll" or one of its dependencies.
I have tried both in a Jupyter notebook and in the Spyder IDE.
I have tried completely removing Anaconda and reinstalling afresh and then reinstalling Pytorch with no success.
I do not believe I have any other versions of python installed.
The offending dll (caffe2_nvrtc.dll) does seem to be in the file location specified.
I have found various similar problems reported but they all date back to 2020 or earlier and none of them seemed to have a satisfactory solution.
Can anyone point me in the correct direction
I still do not understand why using conda did not work but I tried again using pip
and that did work
I experienced the same problem as yours today.
It turns out that when I use the anaconda prompt then the problem disappears.
Anaconda prompt could do it
Then I speculated that the only difference between these two scenarios is that when I use the anaconda prompt, I use the base anaconda environment, probably somehow the conda environment in spyder is not activated.
So the solution is to open the spyder in anaconda prompt like this:
Then it works.
This picture will tell you the cause for the problem.
problem...

ShimWarning on running `help("modules")`

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!

Python interpeter uses previous version of numpy despite updated version being installed - how to fix?

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.

Jupyter kernel keeps crashing -- "No module named prompt_toolkit.formatted_text"

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.

Anaconda3 libhdf5.so.9: cannot open shared object file [works fine on py2.7 but not on py3.4]

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.

Resources