OSX 10.13.6 KernelRestarter: restarting kernel

Hi,
I’ve installed Anaconda3-2020.02-MacOSX-x86_64 on OSX 10.13.6, launched Jupyter 6.0.3 from the Anaconda navigator interface, accessed to the web page.
When I type import pandas as pd, the kernel fails, here is the log in the jupyter_mac command

Last login: Sun Apr 12 18:17:37 on ttys000
(base) iMac:~ laurent$ /Users/laurent/opt/anaconda3/bin/jupyter_mac.command ; exit;
[I 18:40:26.241 NotebookApp] JupyterLab extension loaded from /Users/laurent/opt/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 18:40:26.242 NotebookApp] JupyterLab application directory is /Users/laurent/opt/anaconda3/share/jupyter/lab
[I 18:40:26.797 NotebookApp] Serving notebooks from local directory: /Users/laurent
[I 18:40:26.797 NotebookApp] The Jupyter Notebook is running at:
[I 18:40:26.797 NotebookApp] http://localhost:8888/?token=0d0e5fb4379863a9309b95e8f76551438482efe985584d1d
[I 18:40:26.797 NotebookApp]  or http://127.0.0.1:8888/?token=0d0e5fb4379863a9309b95e8f76551438482efe985584d1d
[I 18:40:26.797 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:40:26.833 NotebookApp] 
    To access the notebook, open this file in a browser:
        file:///Users/laurent/Library/Jupyter/runtime/nbserver-19479-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=0d0e5fb4379863a9309b95e8f76551438482efe985584d1d
     or http://127.0.0.1:8888/?token=0d0e5fb4379863a9309b95e8f76551438482efe985584d1d
[I 18:41:35.208 NotebookApp] Kernel started: e727a8dc-4fba-4dc5-b922-a27399dcb8e6
[I 18:41:44.206 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel e727a8dc-4fba-4dc5-b922-a27399dcb8e6 restarted
[I 18:42:06.415 NotebookApp] Saving file at /dev/python/MLPython/First step.ipynb
[I 18:42:11.228 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel e727a8dc-4fba-4dc5-b922-a27399dcb8e6 restarted
[I 18:43:34.848 NotebookApp] Saving file at /dev/python/MLPython/First step.ipynb

I’ve checked in ~/opt/anaconda3/bin

./jupyter kernelspec list
Available kernels:
  python3    /Users/laurent/opt/anaconda3/share/jupyter/kernels/python3

There is no other error, it just crash

It sounds similar to https://github.com/xianyi/OpenBLAS/issues/2306 and related issues - a problem that your CPU is mis-detected by some libraries used by pandas. Maybe you can ask them on github/their preferred channel of communication how to continue? Possibly somebody needs to guide you through several steps until the real issue is found.

Where is the kernel log ? How can I run python3 in a shell with the same environnement than jupyter’s one ?

You could open the terminal in the Jupyter UI and and type “python”. Then you should see the error message like in the issue I commented. I suggest you ask people of the pandas community. I can’t guide you through this.

The information I gave, comes from the console that opened when I launched jupyter from anaconda’UI.

As you can see kernel started and after I typed and executed import pandas as pd in the jupyter UI, there is a kernel restart without any explanation or relevant message. I just discover these tools, but I can investigate if you tell me where is the log file (if any) ?

Is there a way to launch manually the jupyter python environnement : is there a virtual env configuration stored in ~/opt/anaconda3 ?

I’ve opened a question in both anaconda and jupyter-notebook on https://stackoverflow.com/questions/61175158/osx-10-13-6-kernelrestarter-restarting-kernel

I don’t find any terminal in the Jupyter UI : pandas

If you go to the folder view and click on new, there should be the menu button “terminal”, see

From there you can start the interpreter using “python” or “ipython”, somehow like this:

If you enter your command there now, you will get a more detailled error message.

I came back to anaconda and installed an environnement just for pandas (https://docs.anaconda.com/anaconda/navigator/tutorials/pandas/).
I was able to catch the error, opening a terminal that does the following

. ~/opt/anaconda3/bin/activate && conda activate ~/opt/anaconda3/envs/Pandas; 

This time I have the error

python
Python 3.7.7 (default, Mar 26 2020, 10:32:53) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
Illegal instruction: 4

AVX is not supported by my “old” Mac (https://github.com/conda/conda/issues/9678)

(Pandas) iMac:~ laurent$ sysctl -a | grep machdep.cpu.features
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 POPCNT

This seems to be related to numpy version built in

conda list numpy
# packages in environment at /Users/laurent/opt/anaconda3/envs/Pandas:
#
# Name                    Version                   Build  Channel
numpy                     1.18.1           py37h7241aed_0  
numpy-base                1.18.1           py37h6575580_1

Searching now the best way to downgrade numpy to 1.17.4 …

1 Like

I would not be so sure whether it is directly numpy or maybe some third-party library they use. AVX sounds more like openBLAS (but maybe because that was the source for me). Have you tried playing around with the environment variables like in the first link (my first answer)? I only received that hint and I used it. If you are interested where exactly the AVX message is sent off, you can try Python debugger and find out which statement of the pandas import makes it break. It could be great if you share your experience with the community at https://github.com/pandas-dev/pandas so that they know that there is some need to improve.

it is open here too a few days ago : https://github.com/das-developers/condaCDF/issues/1

I’ve opened an issue here : https://github.com/pandas-dev/pandas/issues/33518

2 Likes

Then it is great that we have figured that one out. Too bad that they dropped the support for old Macs but for the meantime at least some kind of solution (downgrading) seems to exist. Those silent failures are even worse and can take ages if nobody else has already reported a similar thing.

Within Anaconda, I was able to change the numpy version to 1.17.4

Capture d’écran 2020-04-13 à 12.56.53

Here is the result :

Last login: Mon Apr 13 12:30:53 on tty??
(base) iMac:~ laurent$ . /Users/laurent/opt/anaconda3/bin/activate && conda activate /Users/laurent/opt/anaconda3/envs/Pandas; 
(Pandas) iMac:~ laurent$ python
Python 3.7.7 (default, Mar 26 2020, 10:32:53) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> 

No more crash … let’s see if it’s working on jupyter now …

1 Like

Drumroll … :star_struck:

7 Likes

Is there a way to launch manually the jupyter python environnement : is there a virtual env configuration stored in ~/opt/anaconda3 ?

Guys please help me? I am still waiting.

TIA.

Maybe you can ask a new question instead of posting your personal question below the answer to another topic? How are the two even related? It is better style to link to other topics in your own question if that seems helpful. And for me your question is by far too short to really understand what you are troubled by.

I get a similar error which seemed to be the result of numpy being optimized for Intel CPUs:

In [1]: import pandas as pd
Intel MKL ERROR: CPU 0 is not supported.

I attempted the solution export MKL_DEBUG_CPU_TYPE=5 found here without success.