No module named 'tokenize' - anaconda

Trouble with anaconda:
Error message below.
Reason why I think this is happening:
Accidentally deleted some files
I tried to uninstall Anaconda, and reinstall, however, when reinstalling - installer says Anaconda already installed, hence, not able to get Anaconda working.
Scanned through the net and stackoverflow, but unable to find an answer. Error message below:
"
Traceback (most recent call last):
File "/miniconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/miniconda3/lib/python3.7/site-packages/conda/cli/main.py", line 149, in main
from ..exceptions import conda_exception_handler
File "/miniconda3/lib/python3.7/site-packages/conda/exceptions.py", line 10, in <module>
from logging import getLogger
File "/miniconda3/lib/python3.7/logging/__init__.py", line 26, in <module>
import sys, os, time, io, traceback, warnings, weakref, collections.abc
File "/miniconda3/lib/python3.7/traceback.py", line 5, in <module>
import linecache
File "/miniconda3/lib/python3.7/linecache.py", line 11, in <module>
import tokenize
ModuleNotFoundError: No module named 'tokenize' "

Related

Pip not working; from 'ImportError: No module named urllib3' to non-admin windows user

I am facing some problems with pip. The original error message in my command prompt (windows, Python 2.7.14 and this is the version I must keep) when typing for instance pip was
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\python27\lib\site-packages\pip\__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "c:\python27\lib\site-packages\pip\_vendor\requests\__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "c:\python27\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 29, in <module>
import urllib3
ImportError: No module named urllib3
My journey to solve/explore the problem:
This happend no matter which of the following prompt commands I was trying
pip
pip --version
pip list
pip freeze
pip install --upgrade requests
pip install urllib3
Other commands might have change the error message a little bit in terms of the files listed like
python -m pip install --upgrade pip
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "C:\Python27\lib\runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "C:\Python27\lib\site-packages\pip\__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "C:\Python27\lib\site-packages\pip\_vendor\requests\__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "C:\Python27\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 29, in <module>
import urllib3
ImportError: No module named urllib3
I have checked the following (according to several suggestions I found in related questions on stackoverflow)
a pip application can be found in C:\Python27\Scripts
dont have something called PYTHONPATH in system variables only Path
C:\Python27\Scripts is listed in system variables>Path
anaconda was installed by the user before me. I uninstalled as apparently this could cause troubles and deleted all remaining .condarc files,./conda & conda folders as well as the system variable>Path listing.
I have tried the solution which was voted for here by downloading and running python get-pip.py. This is the error message:
>python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 23974, in <module>
main()
File "get-pip.py", line 188, in main
tmpdir = tempfile.mkdtemp()
File "C:\Python27\lib\tempfile.py", line 331, in mkdtemp
dir = gettempdir()
File "C:\Python27\lib\tempfile.py", line 275, in gettempdir
tempdir = _get_default_tempdir()
File "C:\Python27\lib\tempfile.py", line 200, in _get_default_tempdir
with _io.open(fd, 'wb', closefd=False) as fp:
AttributeError: 'module' object has no attribute 'open'
I was told there were some problems noticed before: The computer has 2 users, an administrator and an additional user with '(user)' in its name. I was told that it was not possible to install anaconda for that user - it was installed by the administrator for all users but in the end spyder for instance and the anaconda prompt could only be ran as administrator, too. So I am not sure if there is a problem in general with the user setup?!
I ran the command prompt as administrator and pip --version worked
pip 9.0.1 from c:\python27\lib\site-packages (python 2.7)
So I ran python -m pip install --upgrade pip as administrator, opened the command prompt again (not as administrator and now the new error is
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\python27\lib\site-packages\pip\_internal\cli\main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "c:\python27\lib\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "c:\python27\lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "c:\python27\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 25, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "c:\python27\lib\site-packages\pip\_internal\cli\progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "c:\python27\lib\site-packages\pip\_internal\utils\logging.py", line 18, in <module>
from pip._internal.utils.misc import ensure_dir
File "c:\python27\lib\site-packages\pip\_internal\utils\misc.py", line 21, in <module>
from pip._vendor import pkg_resources
File "c:\python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 26, in <module>
import zipfile
File "c:\python27\lib\zipfile.py", line 501, in <module>
class ZipExtFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'
Tried step 3 again, same outcome
Now I am frustrated and I am hoping for help because I am not super experienced and I don't want to mess up things even more (probably already did by uninstalling anaconda).
Thank you for helping!
PS: I can not exclude that I did not miss the correct solution for this problem, as several topics are addressing pip and urllib3 already, however I have tried my best to cover all suggestions. I apologize if there is already a similar topic solving this problem out there.

Unable to run anaconda neither anaconda-prompt on Windows

I have a following problem. I am not able to run anaconda navigator, neither anaconda-prompt after anaconda3 installation.
Nothing happens when I click on anaconda-navigator.exe as saved in C:\Users\misak\anaconda3\Scripts. When I check environmental variables paths I have there C:\Users\misak\anaconda3\Scripts.
When I try to run anaconda navigator from cmd I get this error:
C:\Users\misak>anaconda-navigator
Traceback (most recent call last):
File "C:\Users\misak\anaconda3\lib\site-packages\qtpy\__init__.py", line 204, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\misak\anaconda3\Scripts\anaconda-navigator-script.py", line 6, in <module>
from anaconda_navigator.app.main import main
File "C:\Users\misak\anaconda3\lib\site-packages\anaconda_navigator\app\main.py", line 22, in <module>
from anaconda_navigator.utils.conda import is_conda_available
File "C:\Users\misak\anaconda3\lib\site-packages\anaconda_navigator\utils\__init__.py", line 15, in <module>
from qtpy.QtGui import QIcon
File "C:\Users\misak\anaconda3\lib\site-packages\qtpy\__init__.py", line 210, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
I tried to reinstall Anaconda many times, co the problem seems to be somewhere else. Can you help my please?

Theano error after pip install

I have been trying to get Theano as backend for Keras on my 32-bit Windows 10. I have installed a bunch of different things, such as CUDA and Python 3.5 (I have 3.6.5 as my default) and even installed with Anaconda. The Anaconda download wasn't there when I used pip freeze in my terminal, and my code didn't recognize it after the conda install, so I simply pip installed Theano, which always gives me this error when I run it. I normally use Atom, not Anaconda, so I'm not sure if a conda install doesn't work for Atom. I am also unsure of how to switch my code in Atom to Python 3.5, as I know Theano only works up to 3.5, or if it's even necessary. I had previously installed my g++ gcc compiler through MinGW, which I have a suspicion might be the culprit for this error as well, as similar errors on StackOverflow questions had to do with this. The error is listed below. This has been a nightmare installation process, so I apologize for all the info about everything I've been doing. Help would be much appreciated.
Also, when I import Keras in my terminal with python 3.5, it says there is no such module.
Something is horribly wrong.
The error:
Using Theano backend.
You can find the C code in this temporary file: C:\Users\AARONM~1\AppData\Local\Temp\theano_compilation_error_9whx6ow7
Traceback (most recent call last):
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Aaron Mazie\Desktop\tradingbots\testntrain6.py", line 11, in <module>
from keras.layers.core import Dense, Activation, Dropout
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\backend\__init__.py", line 81, in <module>
from .theano_backend import *
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\backend\theano_backend.py", line 7, in <module>
import theano
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\__init__.py", line 110, in <module>
from theano.compile import (
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
from theano.compile.mode import *
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\vm.py", line 673, in <module>
from . import lazylinker_c
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
preargs=args)
File "C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\cmodule.py", line 2359, in compile_str
(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\math.h:36:0,
. from C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\include/pyport.h:194,
. from C:\Users\Aaron Mazie\AppData\Local\Programs\Python\Python36-32\include/Python.h:53,
. from C:\Users\Aaron Mazie\AppData\Local\Theano\compiledir_Windows-10-10.0.16299-SP0-Intel64_Family_6_Model_142_Stepping_9_GenuineIntel-3.6.5-32\lazylinker_ext\mod.cpp:1:
. c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cmath:1157:11: error: '::hypot' has not been declared
. using ::hypot;
. ^~~~~
.
For anyone wondering, I uninstalled everything, including the Theano cache files manually, and watched this vid: https://www.youtube.com/watch?v=J70j6q7aOi4&t=131s&index=1&list=LLwpbw2KREgJdXEC0gLRTy4g

Anaconda (latest version) not launching with python 3.6 on windows 10

I had Python 2.7 anaconda running perfectly fine, but when I uninstalled it and installed anaconda for 3.6 python on windows 10, it's not launching, neither Spyder is opening.
the following traceback I got from anaconda prompt.
I have deleted .lock files suggested in some earlier posts.
Traceback (most recent call last):
File "C:\Users\Being_Rohit\Anaconda3\Scripts\conda-script.py", line 3, in
<module>
import conda.cli
File "C:\Users\Being_Rohit\Anaconda3\lib\site-
packages\conda\cli\__init__.py", line 8, in <module>
from .main import main # NOQA
File "C:\Users\Being_Rohit\Anaconda3\lib\site-packages\conda\cli\main.py",
line 42, in <module>
from argparse import SUPPRESS
File "C:\Users\Being_Rohit\Anaconda3\lib\argparse.py", line 89, in <module>
import re as _re
File "C:\Users\Being_Rohit\Anaconda3\lib\re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

anaconda macOS ImportError: cannot import name 'MappingProxyType'

I just installed anaconda with python 3 on my mac (macOS Sierra 10.12.2), and many packages give off errors when importing. It seems this has to do with the typing package, but I can't figure out what's going on.
If I do
python -c 'import sklearn'
(python being Python 3.5.2 :: Anaconda 4.2.0 (x86_64))
I get this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/geromepistre/anaconda3/lib/python3.5/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "/Users/geromepistre/anaconda3/lib/python3.5/site-packages/sklearn/base.py", line 6, in <module>
import copy
File "/Users/geromepistre/anaconda3/lib/python3.5/copy.py", line 51, in <module>
import types
File "/Users/geromepistre/types.py", line 1, in <module>
import typing
File "/Users/geromepistre/anaconda3/lib/python3.5/typing.py", line 4, in <module>
import contextlib
File "/Users/geromepistre/anaconda3/lib/python3.5/contextlib.py", line 5, in <module>
from functools import wraps
File "/Users/geromepistre/anaconda3/lib/python3.5/functools.py", line 22, in <module>
from types import MappingProxyType
ImportError: cannot import name 'MappingProxyType'
I tried to dig into the packages mentioned in the error, but it gets more confusing.
import types gives the same error, as well as import contextlib. But if I import contextlib first (and get an error), then import types gets me no error. And I get a brand new error on import sklearn:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/geromepistre/anaconda3/lib/python3.5/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone
File "/Users/geromepistre/anaconda3/lib/python3.5/site-packages/sklearn/base.py", line 6, in <module>
import copy
File "/Users/geromepistre/anaconda3/lib/python3.5/copy.py", line 114, in <module>
types.BuiltinFunctionType, type(Ellipsis),
AttributeError: module 'types' has no attribute 'BuiltinFunctionType'
You appear to be running Python from your home directory, which according to the first traceback contains a file named types.py. Since the current directory (. in Unix/Linux parlance) is the first entry in sys.path, Anaconda searches for modules/files there before the standard lib or site-packages.
Try at all costs to avoid naming files for modules in either the standard lib or site-packages, for just this reason. Renaming your file types.py to my_types.py or something should solve the issue.

Resources