Can not import matplotlib - python

I get the error NotImplementedError: Implement enable_gui in a subclass when trying to import matplotlib in vscode. Below is the full traceback. I am not sure what is the problem.
Traceback (most recent call last):
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
cli.main()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
run()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/josecordova/Desktop/Michigan/sociallearning/dominance.py", line 11, in <module>
for filename in os.listdir('/Users/josecordova/Desktop/Michigan/sociallearning/LRPM_LR'):
File "/Users/josecordova/Desktop/Michigan/sociallearning/dominance.py", line 11, in <module>
for filename in os.listdir('/Users/josecordova/Desktop/Michigan/sociallearning/LRPM_LR'):
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py", line 945, in trace_dispatch
self.do_wait_suspend(thread, frame, event, arg)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py", line 164, in do_wait_suspend
self._args[0].do_wait_suspend(*args, **kwargs)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1949, in do_wait_suspend
keep_suspended = self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1971, in _do_wait_suspend
self._activate_mpl_if_needed()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1516, in _activate_mpl_if_needed
activate_function()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1505, in <lambda>
self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py", line 95, in activate_matplotlib
gui, backend = find_gui_and_backend()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py", line 47, in find_gui_and_backend
backend = matplotlib.rcParams['backend']
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/site-packages/matplotlib/__init__.py", line 831, in __getitem__
from matplotlib import pyplot as plt
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2362, in <module>
install_repl_displayhook()
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/site-packages/matplotlib/pyplot.py", line 126, in install_repl_displayhook
ip.enable_gui(ipython_gui_name)
File "/Users/josecordova/.local/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3470, in enable_gui
raise NotImplementedError('Implement enable_gui in a subclass')
NotImplementedError: Implement enable_gui in a subclass

Related

pyinstaller cannot open 'EndUpdateResourceW'

I tried to compile my app after updating pyinstaller, and it seems to run into this weird error:
Traceback (most recent call last):
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
yield
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource
_resource._EndUpdateResource(handle, discard)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\core\ctypes\_util.py", line 64, in check_false
raise make_error(function, function_name)
OSError: [WinError 110] The system cannot open the device or file specified.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\users\\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\users\\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 178, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 59, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 842, in main
build(specfile, distpath, workpath, clean_build)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 764, in build
exec(code, spec_namespace)
File "app.spec", line 30, in <module>
exe = EXE(
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 524, in __init__
self.__postinit__()
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
self.assemble()
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 692, in assemble
self.manifest.update_resources(build_name, [1])
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 904, in update_resources
UpdateManifestResourcesFromXML(dstpath, self.toprettyxml().encode("UTF-8"), names, languages)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 992, in UpdateManifestResourcesFromXML
winresource.UpdateResources(dstpath, xmlstr, RT_MANIFEST, names or [name], languages or [0, "*"])
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 189, in UpdateResources
win32api.EndUpdateResource(hdst, 0)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource
_resource._EndUpdateResource(handle, discard)
File "C:\users\\appdata\local\programs\python\python39\lib\contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (110, 'EndUpdateResourceW', 'The system cannot open the device or file specified.')
Anyone ran into similar problems? I updated pyinstaller because I was running into issues with the google core hook, now that worked but this became an issue.

Cant install any python packages

Im trying to install python packages
I tried "pip install" in my cmd
Then i tried PyCharm settings but it always give me message "
FileNotFoundError: [WinError 2] The specified file cannot be found" and the following Error
Traceback (most recent call last):
File "D:\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\packaging_tool.py", line
114, in main
do_install(pkgs)
File "D:\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\packaging_tool.py", line
59, in do_install
run_pip(['install'] + pkgs)
File "D:\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\packaging_tool.py", line
73, in run_pip
runpy.run_module(module_name, run_name='__main__', alter_sys=True)
File "D:\python\lib\runpy.py", line 210, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "D:\python\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "D:\python\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\__main__.py", line 31, in <module>
sys.exit(_main())
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\cli\main.py", line 56, in
main
cmd_name, cmd_args = parse_command(args)
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\cli\main_parser.py", line
60, in parse_command
general_options, args_else = parser.parse_args(args)
File "D:\python\lib\optparse.py", line 1371, in parse_args
values = self.get_default_values()
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\cli\parser.py", line 289,
in get_default_values
self.config.load()
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\configuration.py", line
134, in load
self._load_config_files()
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\configuration.py", line
256, in _load_config_files
config_files = dict(self.iter_config_files())
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\configuration.py", line
359, in iter_config_files
config_files = get_configuration_files()
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\configuration.py", line
75, in get_configuration_files
for path in appdirs.site_config_dirs('pip')
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_internal\utils\appdirs.py", line
34, in site_config_dirs
dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True)
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_vendor\appdirs.py", line 243, in
site_config_dir
path = site_data_dir(appname, appauthor)
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_vendor\appdirs.py", line 138, in
site_data_dir
path = os.path.normpath(_get_win_folder("CSIDL_COMMON_APPDATA"))
File "D:\PyProj\pythonProject1\venv\lib\site-packages\pip\_vendor\appdirs.py", line 486, in
_get_win_folder_from_registry
dir, type = _winreg.QueryValueEx(key, shell_folder_name)
FileNotFoundError: [WinError 2] The specified file cannot be found

AttributeError after running pipenv commands

There is an error occured during running pipenv command:
Traceback (most recent call last):
File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python37\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\cli\command.py", line 390, in shell
pypi_mirror=state.pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 2156, in do_shell
three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 574, in ensure_project
pypi_mirror=pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 494, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "c:\python37\lib\site-packages\pipenv\core.py", line 397, in ensure_python
path_to_python = find_a_system_python(python)
File "c:\python37\lib\site-packages\pipenv\core.py", line 360, in find_a_system_python
python_entry = finder.find_python_version(line)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 108, in find_python_version
match = self.windows_finder.find_python_version(
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 63, in windows_finder
self._windows_finder = WindowsFinder()
File "<attrs generated init 4868f44fa19b631f0a86b928e7558f26948d224e>", line 13, in __init__
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 92, in get_versions
py_version = PythonVersion.from_windows_launcher(version_object)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 417, in from_windows_launcher
creation_dict = cls.parse(launcher_entry.info.version)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py", line 75, in __getattr__
raise AttributeError(attr)
AttributeError: version
Pipenv version: 2018.11.26
Python version: 3.7.2
What should I do to fix it?

Winrm error in while restarting the celeryd service

The module winrm is installed with all its dependencies, but still the celeryd service is not able to run. Here is the error trace:
worker1#man11idm01.stman00.isyntax.net: DOWN /usr/lib64/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6 DeprecationWarning Traceback (most recent call last): File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name) File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals File "/usr/lib/python2.6/site-packages/celery/__main__.py", line 54, in <module>
main() File "/usr/lib/python2.6/site-packages/celery/__main__.py", line 30, in main
main() File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 81, in main
cmd.execute_from_commandline(argv) File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 769, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv))) File "/usr/lib/python2.6/site-packages/celery/bin/base.py", line 311, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:]) File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 761, in handle_argv
return self.execute(command, argv) File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 693, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0]) File "/usr/lib/python2.6/site-packages/celery/bin/worker.py", line 179, in run_from_argv
return self(*args, **options) File "/usr/lib/python2.6/site-packages/celery/bin/base.py", line 274, in
__call__
ret = self.run(*args, **kwargs) File "/usr/lib/python2.6/site-packages/celery/bin/worker.py", line 212, in run
state_db=self.node_format(state_db, hostname), **kwargs File "/usr/lib/python2.6/site-packages/celery/worker/__init__.py", line 95, in __init__
self.app.loader.init_worker() File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 128, in init_worker
self.import_default_modules() File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 121, in import_default_modules
tuple(maybe_list(self.app.conf.CELERY_INCLUDE)) File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 103, in import_task_module
return self.import_from_cwd(module) File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 112, in import_from_cwd
package=package, File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package) File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback) File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 64, in cwd_in_path
yield cwd File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package) File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 106, in import_module
return importlib.import_module(module, package=package) File "/usr/lib/python2.6/site-packages/importlib/__init__.py", line 37, in import_module
__import__(name) File "/usr/lib/celery/phim_onsite/operate.py", line 14, in <module>
from phim_onsite.transmit import tx_data, tx_pcm_discovery, tx_deployment_status File "/usr/lib/celery/phim_onsite/transmit.py", line 19, in <module>
from scanline.trinity import scanline_endpoints, scanline_scanner File "/usr/lib/python2.6/site-packages/scanline/trinity.py", line 15, in <module>
from scanline.product.isp import ISPProductScanner File "/usr/lib/python2.6/site-packages/scanline/product/isp.py", line 17, in <module>
from scanline.host.isp import ISPHostScanner File "/usr/lib/python2.6/site-packages/scanline/host/isp.py", line 6, in <module>
from scanline.utilities.win_rm import extract_credentials File "/usr/lib/python2.6/site-packages/scanline/utilities/win_rm.py", line 2, in <module>
import winrm ImportError: No module named winrm
Restarting node worker1#man11idm01.stman00.isyntax.net: * Child terminated with errorcode 255
FAILED
+ exit 0

Error when using transform method from Latent Dirichlet Allocation after unpickling

I've trained a Latent Dirichlet Allocation model using sklearn. When I unpickle it, I then use countVectorizer to transform the document and then transform this instance using LDA in order to get the topic distribution but I'm getting the following error:
AttributeError: module '__main__' has no attribute 'tokenize'
Here is my code:
lda = joblib.load('lda_good.pkl')
#LDA trained model
tf_vect = joblib.load('tf_vectorizer_.pkl')
#vectorizer
texts = readContent('doc_name.pdf')
new_doc = tf_vect.transform(texts)
print(new_doc)
print(lda.transform(new_doc))
The thing is that the countVectorizer object unipickled is working fine and I can use .transform but when I try to then .transform using LDA's attribute it seems to refer to the tokenize function from the countvectorizer...
The function tokenize is defined ahead of the code, but I can't understant what does tokenize has to do with the transform method of Latent dirichlet Allocation.
A weird thing is that all this code is working fine in jupyter notebook but not when i run it as a script..
All the code is in a single file. The model was trained using jupyter notebook and now I was trying to use the model within a script.
Here is the traceback:
Traceback (most recent call last):
File "<string>", line 1, in <module>
Traceback (most recent call last):
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 106, in spawn_main
File "<string>", line 1, in <module>
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 106, in spawn_main
exitcode = _main(fd)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 115, in _main
exitcode = _main(fd)
prepare(preparation_data)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 115, in _main
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 226, in prepare
prepare(preparation_data)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 226, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path
Traceback (most recent call last):
Traceback (most recent call last):
_fixup_main_from_path(data['init_main_from_path'])
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
run_name="__mp_main__")
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 254, in run_path
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 106, in spawn_main
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 106, in spawn_main
run_name="__mp_main__")
pkg_name=pkg_name, script_name=fname)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 254, in run_path
exitcode = _main(fd)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 96, in _run_module_code
exitcode = _main(fd)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 115, in _main
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 115, in _main
pkg_name=pkg_name, script_name=fname)
prepare(preparation_data)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 226, in prepare
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
_fixup_main_from_path(data['init_main_from_path'])
prepare(preparation_data)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 85, in _run_code
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 226, in prepare
exec(code, run_globals)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 85, in _run_code
File "C:\Users\eduard.bermejo\Documents\Machine learning\gestió documental\POC\program_POC.py", line 160, in <module>
run_name="__mp_main__")
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 254, in run_path
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path
exec(code, run_globals)
tf_vect = joblib.load('tf_vectorizer_.pkl')
pkg_name=pkg_name, script_name=fname)
File "C:\Users\eduard.bermejo\Documents\Machine learning\gestió documental\POC\program_POC.py", line 160, in <module>
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\site- packages\sklearn\externals\joblib\numpy_pickle.py", line 459, in load
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 96, in _run_module_code
run_name="__mp_main__")
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 254, in run_path
tf_vect = joblib.load('tf_vectorizer_.pkl')
obj = unpickler.load()
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\site-packages\sklearn\externals\joblib\numpy_pickle.py", line 459, in load
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1039, in load
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 85, in _run_code
pkg_name=pkg_name, script_name=fname)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 96, in _run_module_code
exec(code, run_globals)
File "C:\Users\eduard.bermejo\Documents\Machine learning\gestió documental\POC\program_POC.py", line 160, in <module>
obj = unpickler.load()
mod_name, mod_spec, pkg_name, script_name)
dispatch[key[0]](self)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1039, in load
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\runpy.py", line 85, in _run_code
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1334, in load_global
tf_vect = joblib.load('tf_vectorizer_.pkl')
exec(code, run_globals)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\site- packages\sklearn\externals\joblib\numpy_pickle.py", line 459, in load
File "C:\Users\eduard.bermejo\Documents\Machine learning\gestió documental\POC\program_POC.py", line 160, in <module>
dispatch[key[0]](self)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1334, in load_global
tf_vect = joblib.load('tf_vectorizer_.pkl')
obj = unpickler.load()
klass = self.find_class(module, name)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\site-packages\sklearn\externals\joblib\numpy_pickle.py", line 459, in load
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1039, in load
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1388, in find_class
klass = self.find_class(module, name)
obj = unpickler.load()
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1388, in find_class
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1039, in load
dispatch[key[0]](self)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1334, in load_global
return getattr(sys.modules[module], name)
AttributeError: module '__main__' has no attribute 'tokenize'
dispatch[key[0]](self)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1334, in load_global
klass = self.find_class(module, name)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1388, in find_class
return getattr(sys.modules[module], name)
AttributeError: module '__main__' has no attribute 'tokenize'
klass = self.find_class(module, name)
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\pickle.py", line 1388, in find_class
return getattr(sys.modules[module], name)
AttributeError: module '__main__' has no attribute 'tokenize'
return getattr(sys.modules[module], name)
AttributeError: module '__main__' has no attribute 'tokenize'
Traceback (most recent call last):
File "<string>", line 1, in <module>
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 106, in spawn_main
File "C:\Users\eduard.bermejo\AppData\Local\Continuum\Anaconda3\lib\multiprocessing\spawn.py", line 106, in spawn_main
exitcode = _main(fd)
exitcode = _main(fd)
It actually continues but I guess this will be enough because it starts some kind of loop.
Let me know if further information is needed.
Thanks in advance
Looking through similar questions on SO it shows there are pickling and unpickling issues. The code that you use to do joblib.dump is in a different directory from what I assume. Instead could you put that in the same directory as this program and re-run the pickler and unpickler again? __main__ is stored for the pickled directory and the unpickler tries to search for it when it runs.

Categories

Resources