1

I am trying to start a Jupyter notebook with a python 3.6.7 kernel. I am using a conda environment with my packages installed. When I use python from the command line, it shows python 3.6.7 and there are no errors. When I try to open a notebook and use python 3 kernel, I get the following:

[I 11:04:47.372 NotebookApp] KernelRestarter: restarting kernel (2/5)
Failed to import the site module
Traceback (most recent call last):
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 550, in <module>
main()
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 531, in main
known_paths = addusersitepackages(known_paths)
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 282, in addusersitepackages
user_site = getusersitepackages()
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 258, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 248, in getuserbase
USER_BASE = get_config_var('userbase')
  File "/anaconda3/envs/cacheopt/lib/python3.6/sysconfig.py", line 609, in get_config_var
return get_config_vars().get(name)
  File "/anaconda3/envs/cacheopt/lib/python3.6/sysconfig.py", line 588, in get_config_vars
import _osx_support
  File "/anaconda3/envs/cacheopt/lib/python3.6/_osx_support.py", line 4, in <module>
import re
  File "/anaconda3/envs/cacheopt/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

There are no errors when I switch to using a python2 kernel. I have tried what is listed in this post to no avail.

I ran the following after creating my python3 conda environment:

python -m ipykernel install --user --name=myenv

Confused because everything works fine from the command line, I only get this error in the notebook.

ARomano
  • 45
  • 5

0 Answers0