I'm trying to open my jupyter notebook with Conda Python3.6. When I try to open it, I'm getting this error
VikMacBook-Pro:~ vik$ /anaconda3/bin/jupyter_mac.command ; exit;
Failed to import the site module
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site.py", line 541, in <module>
main()
File "/anaconda3/lib/python3.6/site.py", line 522, in main
known_paths = addusersitepackages(known_paths)
File "/anaconda3/lib/python3.6/site.py", line 282, in
addusersitepackages
user_site = getusersitepackages()
File "/anaconda3/lib/python3.6/site.py", line 258, in
getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/anaconda3/lib/python3.6/site.py", line 248, in getuserbase
USER_BASE = get_config_var('userbase')
File "/anaconda3/lib/python3.6/sysconfig.py", line 608, in
get_config_var
return get_config_vars().get(name)
File "/anaconda3/lib/python3.6/sysconfig.py", line 587, in
get_config_vars
import _osx_support
File "/anaconda3/lib/python3.6/_osx_support.py", line 4, in <module>
import re
File "/anaconda3/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
And I have attempted to solve by following this endorsed answer, using command
pip uninstall enum34
However, I'm still getting the following error after running this command
Vik-MacBook-Pro:~ vik$ pip uninstall enum34
Skipping enum34 as it is not installed.
I do not have my own code file named enum.py
try using "pip3 uninstall enum34" it worked for me
Related
I installed pyinstaller using pip
pip install pyinstaller
but when I run it I get an error
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 7, in <module>
from PyInstaller.__main__ import run
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__init__.py", line 66, in <module>
__version__ = pkg_resources.get_distribution('PyInstaller').version
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 330, in get_distribution
if isinstance(dist,Requirement): dist = get_provider(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 209, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: PyInstaller
I cannot figure out what the issue is, I have tried reinstalling it. I have googled the error but no results come up that help.
Does anyone know a fix?
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.
I had to uninstall my django==1.6.4 and install 1.5 for a project, but now when I install 1.6.4 with pip and try to start a project with django-admin.py startproject PN I get
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/django-admin.py", line 5, in <module>
pkg_resources.run_script('Django==1.6.4', 'django-admin.py')
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 534, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 1432, in run_script
raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'django-admin.py'
martinssmacbook:bin martinspasov$ pip install django==1.6.4
I tried installing 1.6.5 but then when I try to start a project i get
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/django-admin.py", line 4, in <module>
import pkg_resources
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 2876, in <module>
working_set = WorkingSet._build_master()
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 451, in _build_master
return cls._build_from_requirements(__requires__)
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/Library/Python/2.7/site-packages/pkg_resources.py", line 639, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Django==1.6.4
Any ideas onwhat to do ?
this is because you should delete all 1.6.4 files and then install 1.6.5.
but now there are also 1.6.4 files in your Linux / windows.
in windows,
you should delete the files in python/lib/site-packages/django
to uninstall the main Django files.
nd then delete Django-VERSION-py2.7.egg or fix the VERSION in
it. not just these.
you have to delete following 4 files:
django-admin.exe, django-admin.py,django-admin.exe.manifest,django-admin-script.py
then you can reinstall the django.
(In fact, if you know the file, you can try to edit it with change the version.)
in Linux, you can do like that.
if there 's something wrong, you can try to delete all.
When ever i mistype or do a error into the console the following message come up:
Traceback (most recent call last):
File "/usr/lib/python3.3/site.py", line 629, in <module>
main()
File "/usr/lib/python3.3/site.py", line 614, in main
known_paths = addusersitepackages(known_paths)
File "/usr/lib/python3.3/site.py", line 284, in addusersitepackages
user_site = getusersitepackages()
File "/usr/lib/python3.3/site.py", line 260, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python3.3/site.py", line 250, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/lib/python3.3/sysconfig.py", line 610, in get_config_var
return get_config_vars().get(name)
File "/usr/lib/python3.3/sysconfig.py", line 560, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/lib/python3.3/sysconfig.py", line 432, in _init_posix
from _sysconfigdata import build_time_vars
File "/usr/lib/python3.3/_sysconfigdata.py", line 6, in <module>
from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'
I have both Python 2.7 and 3.3 install with Anaconda. I wonder if this is normal or it was a conflict between python 2.7 and 3.3
Assuming you are using ubuntu, here is the relevant bug report https://bugs.launchpad.net/ubuntu/+source/python3.3/+bug/1192890
You need to patch your /etc/bash.bashrc. See comment #6 for details
Actually, it's possible you have another python3 in your PATH before /usr/bin (most probably in /usr/local/bin) in your system, one which lacks the ubuntu-provided libraries (used by /usr/bin/python3). That happens with hashbangs using #!env python3 and the PATH environment variable.
If this is the case, then temporarily make unavailable (eg renaming them) all such non-/usr/bin/python3* executables, do your system administration stuff and then make them again available.
I'm trying to install GDAL-1.9.0 under Ubuntu 10.04 via buildout and unfortunately get a very strange error.
python setup.py build
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "setup.py", line 75, in <module>
from distutils.command.build_ext import build_ext
File "/usr/lib/python2.6/distutils/command/build_ext.py", line 13, in <module>
from site import USER_BASE, USER_SITE
File "/home/student/geoserv_new/geoportal2/trunk/parts/buildout/site.py", line 601, in <module>
main()
File "/home/student/geoserv_new/geoportal2/trunk/parts/buildout/site.py", line 583, in main
known_paths = addusersitepackages(known_paths)
File "/home/student/geoserv_new/geoportal2/trunk/parts/buildout/site.py", line 271, in addusersitepackages
user_site = getusersitepackages()
File "/home/student/geoserv_new/geoportal2/trunk/parts/buildout/site.py", line 246, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/home/student/geoserv_new/geoportal2/trunk/parts/buildout/site.py", line 235, in getuserbase
from sysconfig import get_config_var
ImportError: No module named sysconfig
make[2]: *** [build] Error 1
make[2]: Leaving directory `/tmp/tmpY7oYvSbuildout-gdal/gdal-1.9.0/swig/python'
make[1]: *** [build] Error 2
make[1]: Leaving directory `/tmp/tmpY7oYvSbuildout-gdal/gdal-1.9.0/swig'
make: *** [swig-modules] Error 2
gdal: cmmi failed: /tmp/tmpY7oYvSbuildout-gdal
While:
Installing gdal.
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/home/student/geoserv_new/geoportal2/trunk/eggs/zc.buildout-1.5.2-py2.7.egg/zc/buildout/buildout.py", line 1805, in main
getattr(buildout, command)(args)
File "/home/student/geoserv_new/geoportal2/trunk/eggs/zc.buildout-1.5.2-py2.7.egg/zc/buildout/buildout.py", line 584, in install
installed_files = self[part]._call(recipe.install)
File "/home/student/geoserv_new/geoportal2/trunk/eggs/zc.buildout-1.5.2-py2.7.egg/zc/buildout/buildout.py", line 1297, in _call
return f()
File "/home/student/geoserv_new/geoportal2/trunk/eggs/zc.recipe.cmmi-1.3.5-py2.7.egg/zc/recipe/cmmi/__init__.py", line 113, in install
self.build()
File "/home/student/geoserv_new/geoportal2/trunk/eggs/zc.recipe.cmmi-1.3.5-py2.7.egg/zc/recipe/cmmi/__init__.py", line 196, in build
self.cmmi(dest)
File "/home/student/geoserv_new/geoportal2/trunk/eggs/zc.recipe.cmmi-1.3.5-py2.7.egg/zc/recipe/cmmi/__init__.py", line 222, in cmmi
system("make")
File "/home/student/geoserv_new/geoportal2/trunk/eggs/zc.recipe.cmmi-1.3.5-py2.7.egg/zc/recipe/cmmi/__init__.py", line 34, in system
raise SystemError("Failed", c)
SystemError: ('Failed', 'make')
Here is my buildout.cfg part of gdal:
[gdal]
recipe = zc.recipe.cmmi
url = http://download.osgeo.org/gdal/gdal-1.9.0.tar.gz
extra_options =
--with-python
--with-geos=${geos:location}/bin/geos-config
Even more strange that when I'm going to python2.7 shell and try import sysconfig. Everything is working fine. Any suggestion about this?
Thanks,
Sergey
You mention that you tested it in the 'python2.7' shell.
This:
File "/usr/lib/python2.6/distutils/command/build_ext.py",
Implies that buildout is running in python 2.6.
Is sysconfig available in your python2.6 environment, or are you running buildout under the wrong version?