Related
I'm having an error when installing/updating any pip module in python3. Purging and reinstalling pip and every package I can thing of hasn't helped. Here's the error that I get in response to running python -m pip install --upgrade pip specifically (but the error is the same for attempting to install or update any pip module):
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
vendored("cachecontrol")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/adapter.py", line 5, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl/requests/__init__.py", line 95, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/patrick/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/home/patrick/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3268, in <module>
_lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 32, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 12, in <module>
import os, glob, subprocess, os.path, time, pwd, sys, requests_unixsocket
File "/usr/lib/python3/dist-packages/requests_unixsocket/__init__.py", line 1, in <module>
import requests
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl/requests/__init__.py", line 95, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/patrick/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/home/patrick/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3268, in <module>
_lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
vendored("cachecontrol")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl/cachecontrol/adapter.py", line 5, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl/requests/__init__.py", line 95, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/patrick/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/home/patrick/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3268, in <module>
_lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
I'm running Ubuntu 20.04 in WSL. Python openssl is already installed.
sudo apt install python3-openssl
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-openssl is already the newest version (19.0.0-1build1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
My assumption is that I need to re-install some stuff, but I'm not sure what. I've tried the obvious stuff like python3-openssl, libssl-dev, libffi-dev, and python3-pip itself and python3 alltogether.
As version 39.0.0 presented this bug, downgrading the cryptography package solves this, without purging or touching your OS.
pip install cryptography==38.0.4 to downgrade from 39.0.0 which presented this error
EDIT per #thomas
The error is a result of incompatibility between cryptography and pyopenssl, so if possible, also upgrading to openssl>22.1.0 should work
I figured it out. What I needed to do was to purge the apps, and delete ~/.local/lib/python3.8. This was the step that I'd been missing.
So in the end, the fix was:
sudo apt purge python3 python3-pip python3-openssl
rm -rf ~/.local/lib/python3.8
sudo apt install libssl-dev libffi-dev python3 python3-pip python3-openssl
Then, I could run python -m pip install --upgrade pip without error.
This solution is only suitable for Ubuntu in WSL.
It's what I run, but follow up for other users has confirmed that it can completely break any installed desktop environments.
I am currently following a book(Trading Evolved) for learning the algorithmic trading but got **stuck on ingesting quandal what should I do now. I have tried to find the answer but can not get any solution for the same. PLEASE HELP
'''(zip35) C:\Users\jayan>zipline ingest -b quandl
Traceback (most recent call last):
File "C:\Users\jayan\anaconda3\envs\zip35\Scripts\zipline-script.py", line 33, in <module>
sys.exit(load_entry_point('zipline==1.4.1', 'console_scripts', 'zipline')())
File "C:\Users\jayan\anaconda3\envs\zip35\Scripts\zipline-script.py", line 25, in
importlib_load_entry_point
return next(matches).load()
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\importlib_metadata\__init__.py", line
100, in load
module = import_module(match.group('module'))
File "C:\Users\jayan\anaconda3\envs\zip35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\__init__.py", line 29, in
<module>
from .utils.run_algo import run_algorithm
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\utils\run_algo.py", line 20, in
<module>
from zipline.data import bundles
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\bundles\__init__.py", line
2, in <module>
from . import quandl # noqa
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\bundles\quandl.py", line
16, in <module>
from . import core as bundles
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\bundles\core.py", line 15,
in <module>
from ..minute_bars import (
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\zipline\data\minute_bars.py", line 30, in
<module>
import tables
File "C:\Users\jayan\anaconda3\envs\zip35\lib\site-packages\tables\__init__.py", line 99, in <module>
from .utilsextension import (
ImportError: DLL load failed: The specified module could not be found.'''
Thank you to whoever replies to this.
Typically when there is a missing DLL in a Python package it's due to the absence of the C++ redistributable:
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
I'm having trouble using the pandas package on Spyder 4.2.1.
Currently using:
MacOS Big Sur ver. 11.2
Python 3.9
Spyder 4.2.1
Anaconda 2020.11
this is the code I'm trying to run:
import pandas as pd
This results in ModuleNotFoundError: No module named 'pandas._libs.tslibs.base' - along with a bunch of other errors.
Full error message:
File "<frozen zipimport>", line 259, in load_module
File "pandas/_libs/tslibs/conversion.pyc", line 14, in <module>
File "pandas/_libs/tslibs/conversion.pyc", line 10, in __load
File "imp.pyc", line 342, in load_dynamic
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1116, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "pandas/_libs/tslibs/conversion.pyx", line 1, in init pandas._libs.tslibs.conversion
ModuleNotFoundError: No module named 'pandas._libs.tslibs.base'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 259, in load_module
File "pandas/_libs/missing.pyc", line 14, in <module>
File "pandas/_libs/missing.pyc", line 10, in __load
File "imp.pyc", line 342, in load_dynamic
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1116, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "pandas/_libs/missing.pyx", line 1, in init pandas._libs.missing
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "pandas/_libs/tslibs/__init__.pyc", line 30, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 261, in load_module
KeyError: 'pandas._libs.tslibs.conversion'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 259, in load_module
File "pandas/_libs/hashtable.pyc", line 14, in <module>
File "pandas/_libs/hashtable.pyc", line 10, in __load
File "imp.pyc", line 342, in load_dynamic
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1116, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "pandas/_libs/hashtable.pyx", line 1, in init pandas._libs.hashtable
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 261, in load_module
KeyError: 'pandas._libs.missing'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 259, in load_module
File "pandas/_libs/interval.pyc", line 14, in <module>
File "pandas/_libs/interval.pyc", line 10, in __load
File "imp.pyc", line 342, in load_dynamic
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1116, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 261, in load_module
KeyError: 'pandas._libs.hashtable'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jack/Downloads/Introduction lab.py", line 78, in <module>
import pandas._libs.tslibs.base
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "pandas/__init__.pyc", line 30, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "pandas/_libs/__init__.pyc", line 13, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 261, in load_module
KeyError: 'pandas._libs.interval'
What I've tried so far:
Uninstalling / reinstalling Anaconda (I think I did it correctly?) so
it's on my actual hard disk
Uninstalling/reinstalling the actual pandas module through the terminal
Restarting my Mac
Updating Python to 3.9
Updating Mac to Big Sur
Using import pandas._libs.tslibs.base in my code
Trying to just use import pandaswithoutas pd`
Going to the actual Anaconda files to try to find the error
Using pip uninstall and pip install to try to reinstall the package
Installing miniconda
Using conda install to install the package
FACTORY RESETTING my Mac
None of the above works. Considering literally factory resetting my Mac at this point (just did it, didn't work) because I need this to work for a class I'm taking and even the professor doesn't know how to fix this. For some reason nobody in my class seems to have this issue.
Thank you!
You should not use pip with Anaconda Python. You should use conda instead. So to install something use
conda install name_of_package
Try this and see if it works.
To check that conda is installed, which it should be, type conda -V
Then run conda update conda. You should be ready to go.
When I installed Miniconda and manually imported Pandas, then reinstalled the conda kernel, it suddenly worked. I don't know exactly what I did to trigger it; if someone is more experienced they may be able to explain.
I am currently trying to put a Python app, which uses Sklearn modules, in a stand-alone .exe file.
My current cx_freeze setup.py looks like this:
import os
from cx_Freeze import setup, Executable
base = "Win32GUI"
os.environ['TCL_LIBRARY'] = r'C:\Users\...\AppData\Local\Continuum\anaconda3\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\...\AppData\Local\Continuum\anaconda3\tcl\tk8.6'
executables = [Executable("gui_handler.py", base=base)]
packages = ["idna", "numpy", "sklearn", "nltk", "stop_words", "scipy", "scipy.sparse.csgraph._validation",
"scipy.spatial.ckdtree", "PyQt5", "imblearn.under_sampling", "imblearn.over_sampling",
"sklearn.tree._criterion"]
options = {
'build_exe': {
"packages": packages,
"excludes": ["scipy.spatial.cKDTree"],
"zip_include_packages": ["sklearn", "nltk", "idna"] # PyQt5 zippen verschlechtert die Optik
},
}
setup(
name="<any name>",
options=options,
version="1.0",
description='<any description>',
executables=executables
)
It worked fine before but the latest version of my application uses the module imblearn. I think it causes this problem (appears a few seconds after double-clicking the .exe file):
Traceback (most recent call last):
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "gui_handler.py", line 8, in <module>
File "C:\Users\...\Documents\PycharmProjects\MachineLearning\build\exe.win-amd64-3.6\TextClassification\init_predict.py", line 16, in <module>
from imblearn.under_sampling import RandomUnderSampler
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\imblearn\under_sampling\__init__.py", line 6, in <module>
from .prototype_generation import ClusterCentroids
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\imblearn\under_sampling\prototype_generation\__init__.py", line 6, in <module>
from .cluster_centroids import ClusterCentroids
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\imblearn\under_sampling\prototype_generation\cluster_centroids.py", line 14, in <module>
from sklearn.cluster import KMeans
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\cluster\__init__.py", line 6, in <module>
from .spectral import spectral_clustering, SpectralClustering
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\cluster\spectral.py", line 17, in <module>
from ..manifold import spectral_embedding
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\manifold\__init__.py", line 9, in <module>
from .t_sne import TSNE
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\manifold\t_sne.py", line 25, in <module>
from . import _barnes_hut_tsne
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "ExtensionLoader_sklearn_manifold__barnes_hut_tsne.py", line 23, in <module>
File "ExtensionLoader_sklearn_manifold__barnes_hut_tsne.py", line 15, in __bootstrap__
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
File "sklearn\neighbors\quad_tree.pxd", line 54, in init sklearn.manifold._barnes_hut_tsne
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "ExtensionLoader_sklearn_neighbors_quad_tree.py", line 23, in <module>
File "ExtensionLoader_sklearn_neighbors_quad_tree.py", line 15, in __bootstrap__
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
File "sklearn\tree\_criterion.pxd", line 21, in init sklearn.neighbors.quad_tree
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\tree\__init__.py", line 6, in <module>
from .tree import DecisionTreeClassifier
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\tree\tree.py", line 40, in <module>
from ._criterion import Criterion
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "ExtensionLoader_sklearn_tree__criterion.py", line 23, in <module>
File "ExtensionLoader_sklearn_tree__criterion.py", line 15, in __bootstrap__
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
File "sklearn\tree\_splitter.pxd", line 34, in init sklearn.tree._criterion
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "ExtensionLoader_sklearn_tree__splitter.py", line 23, in <module>
File "ExtensionLoader_sklearn_tree__splitter.py", line 15, in __bootstrap__
File "C:\Users\...\AppData\Local\Continuum\anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
File "sklearn\tree\_criterion.pxd", line 21, in init sklearn.tree._splitter
AttributeError: module 'sklearn.tree._criterion' has no attribute 'Criterion'
I took a look in the sklearn\tree\tree.py file and there is indeed this import statement:
from ._criterion import Criterion
The same folder contains the files:
_criterion.cp36-win_amd64.pyd
_splitter.cp36-win_amd64.pyd
_tree.cp36-win_amd64.pyd
_utils.cp36-win_amd64.pyd
which are python module files as far as I know.
The application runs perfectly fine if I execute it from the PyCharm IDE so I would either assume that my program doesn't even need the Criterion module (and cx_freeze just loads it because it loads everything) and therefore I don't get the error message at runtime. Or that the module is actually missing.
Any ideas what could fix this problem?
Okay, I fixed the problem myself.
I just removed the line
zip_include_packages": ["sklearn", "nltk", "idna"]
from my cx_freeze_setup.py.
I'm trying to classify my own images in tensorflow.
I have entered the following command to train my model:
python3 train.py --logstderr --train_dir=training/ --
pipeline_config_path=training/ssd_mobilenet_v1_pets.config
From tutorial https://youtu.be/JR8CmWyh2E8?t=757 time 12:38
and I get the following error:
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection.builders import model_builder
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/model_builder.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/anchor_generator_builder.py", line 20, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/protos/anchor_generator_pb2.py", line 27, in <module>
File "/usr/local/lib/python3.5/dist-packages/google/protobuf/descriptor.py", line 829, in _new_
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "object_detection/protos/anchor_generator.proto":
object_detection/protos/anchor_generator.proto: Import "object_detection/protos/grid_anchor_generator.proto" has not been loaded.
object_detection/protos/anchor_generator.proto: Import "object_detection/protos/ssd_anchor_generator.proto" has not been loaded.
object_detection.protos.AnchorGenerator.grid_anchor_generator: "object_detection.protos.GridAnchorGenerator" seems to be defined in "protos/grid_anchor_generator.proto", which is not imported by "object_detection/protos/anchor_generator.proto". To use it here, please add the necessary import.
object_detection.protos.AnchorGenerator.ssd_anchor_generator: "object_detection.protos.SsdAnchorGenerator" seems to be defined in "protos/ssd_anchor_generator.proto", which is not imported by "object_detection/protos/anchor_generator.proto". To use it here, please add the necessary import.
What have I done wrong? Thanks in advance.
Update:
I now get this error:
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection.builders import model_builder
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/model_builder.py", line 17, in <module>
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/anchor_generator_builder.py", line 20, in <module>
ImportError: cannot import name 'anchor_generator_pb2'