Error in Compiling the CPU Module for Python - python

System information
Have I written custom code: No
OS Platform and Distribution: Windows 10 64bit
TensorFlow installed from: Latest master source
TensorFlow version: commit dfcec82
Python version: 3.6.5
CMake version: 3.12.0-rc2
MS C+_+ Compiler version: 19.00.24234.1
CPU model and memory: i5-4460 with 16GB of RAM
Exact command to reproduce:
Opening Developer Command Line as admin
Choosing the 64bit compiler
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\vsdevcmd\ext\vcvars.bat" amd64
cd D:\opencv\tensorflow\tensorflow\contrib\cmake\build
4.
cmake .. -A x64 -T host=x64 -DCMAKE_BUILD_TYPE=Release -DSWIG_EXECUTABLE=D:/opencv/swigwin-3.0.12/swig.exe -DPYTHON_EXECUTABLE="C:/Users/FiFo/AppData/Local/Programs/Python/Python36/python.exe" -DPYTHON_LIBRARIES="C:/Users/FiFo/AppData/Local/Programs/Python/Python36/libs/python36.lib" -Dtensorflow_WIN_CPU_SIMD_OPTIONS=/arch:AVX2 -Dtensorflow_BUILD_CC_TESTS=OFF -Dtensorflow_BUILD_PYTHON_TESTS=OFF -Dtensorflow_BUILD_MORE_PYTHON_TESTS=OFF -Dtensorflow_BUILD_CC_EXAMPLE=ON -Dtensorflow_BUILD_PYTHON_BINDINGS=ON -Dtensorflow_BUILD_CC_TESTS=OFF -Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=ON -Dtensorflow_ENABLE_MKL_SUPPORT=ON -Dtensorflow_ENABLE_MKLDNN_SUPPORT=ON -Dtensorflow_VERBOSE=ON -Dtensorflow_BUILD_SHARED_LIB=ON
MSBuild /p:Configuration=Release ALL_BUILD.vcxproj
SUCCESS
MSBuild /p:Configuration=Release INSTALL.vcxproj
SUCCESS
MSBuild /p:Configuration=Release tf_python_build_pip_package.vcxproj
Fails with:
Generating init.py files for Python API.
Traceback (most recent call last):
File "D:\opencv\tensorflow\tensorflow\contrib\cmake\build\tf_python\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\FiFo\AppData\Local\Programs\Python\Python36\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 658, in _load_unlocked
File "", line 571, in module_from_spec
File "", line 922, in create_module
File "", line 219, in _call_with_frames_removed
ImportError: DLL load failed: NÒo foi possÝvel encontrar o m¾dulo especificado.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\opencv\tensorflow\tensorflow\contrib\cmake\build\tf_python\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\opencv\tensorflow\tensorflow\contrib\cmake\build\tf_python\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\opencv\tensorflow\tensorflow\contrib\cmake\build\tf_python\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal')
File "C:\Users\FiFo\AppData\Local\Programs\Python\Python36\lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
It used to work before with version 1.8
I don't want to install the PIP version
Compilation works without any problem on Ubuntu 16.04

CMake is not officially supported anymore. Bazel is the only option that works on all configurations.

Related

Tensorflow Installation M1 Mac fails due to termcolor build not working

I have tried to install tensorflow on my M1 Silicon (macOS 12.4) by setting up a new anaconda environment and forcing it to use arm64 builds:
CONDA_SUBDIR=osx-arm64 conda create -n=NAME python=3.9 -c conda-forge --override-channels
and have then followed the developer instructions to use the M1 GPU:
conda install -c apple tensorflow-deps
pip3 install tensorflow-macos
But then I get an error for termcolor:
Building wheel for termcolor (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [34 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/4n/3tkzf7k15n91rlbqlkh8_3t40000gn/T/pip-install-vihezj4s/termcolor_36abf77c455d4254a5130d8246e91754/setup.py", line 37, in <module>
setup(name='termcolor',
File "/Users/.../opt/anaconda3/envs/c.../lib/python3.9/site-packages/setuptools/_distutils/core.py", line 135, in setup
ok = dist.parse_command_line()
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 484, in parse_command_line
args = self._parse_command_opts(parser, args)
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/setuptools/dist.py", line 1104, in _parse_command_opts
nargs = _Distribution._parse_command_opts(self, parser, args)
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 540, in _parse_command_opts
cmd_class = self.get_command_class(command)
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/setuptools/dist.py", line 951, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load
module = import_module(match.group('module'))
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
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 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/wheel/bdist_wheel.py", line 26, in <module>
from .macosx_libfile import calculate_macosx_platform_tag
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/wheel/macosx_libfile.py", line 41, in <module>
import ctypes
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/nils/opt/anaconda3/envs/care-reconstruction/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so, 0x0002): Library not loaded: #rpath/libffi.7.dylib
Referenced from: /Users/.../opt/anaconda3/envs/.../lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so
Reason: tried: '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/python3.9/lib-dynload/../../libffi.7.dylib' (no such file), '/Users/nils/opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/python3.9/lib-dynload/../../libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../bin/../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../bin/../lib/libffi.7.dylib' (no such file), '/usr/local/lib/libffi.7.dylib' (no such file), '/usr/lib/libffi.7.dylib' (no such file)
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for termcolor
Running setup.py clean for termcolor
Failed to build termcolor
Finishing the installation by adding pip3 install tensorflow-metal and then loading the module tensorflow in the python3 shell produces the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/tensorflow/__init__.py", line 37, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/Users/.../opt/anaconda3/envs/.../lib/python3.9/site-packages/tensorflow/python/__init__.py", line 24, in <module>
import ctypes
File "/Users/.../opt/anaconda3/envs/care-reconstruction/lib/python3.9/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/.../opt/anaconda3/envs/.../lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so, 0x0002): Library not loaded: #rpath/libffi.7.dylib
Referenced from: /Users/.../opt/anaconda3/envs/.../lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so
Reason: tried: '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/python3.9/lib-dynload/../../libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/python3.9/lib-dynload/.../libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/care-reconstruction/bin/../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../lib/libffi.7.dylib' (no such file), '/Users/.../opt/anaconda3/envs/.../bin/../lib/libffi.7.dylib' (no such file), '/usr/local/lib/libffi.7.dylib' (no such file), '/usr/lib/libffi.7.dylib' (no such file)
Running pip3 uninstall termcolor and pip3 install termcolor produces the same installation error.
Am I just lost here and there is no functioning M1 Silicon built for termcolor at the moment? Or did I mess up somewhere?
Ok got it. Somehow the issue was with pip:
conda uninstall termcolor
conda install termcolor
solved all issues and tensorflow appears to be working (finger's crossed!)
Note that tensorflow-macos can only be installed via pip at the moment, so I first need to let the pip built of termcolor fail, remove it with conda and then re-install it.

Azure DevOps AzureFunctionApp#1 not installing python dependencies

Using the Azure Devops task with current setup :
task: AzureFunctionApp#1
displayName: Deploy Lab
inputs:
azureSubscription: 'serviceConnection'
appType: 'functionAppLinux'
appName: 'myAwesomeApp'
package: '.'
runtimeStack: 'PYTHON|3.8'
Also, in the root directory (ie . in the ado task), I have a requirements.txt file that contains numpy
The deployment runs successfully but when I test the app, I have the following error:
Failure Exception: ModuleNotFoundError: No module named 'numpy'
Which simply means that the requirements.txt file is not considered or pip install -r requirements.txt didn't run successfully in the remote compute, what am I doing wrong ?
EDIT: Added a step to install the packages locally did work, but as numpy is a C built library it's dependent on the host machine and that doesn't work in the remote function app :lol:
The step that I added is this one:
- bash: pip install -r requirements.txt --target="./.python_packages/lib/site-packages"
displayName: 'Install dependencies'
And the error:
Result: Failure Exception: ImportError: IMPORTANT: PLEASE READ THIS
FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy
C-extensions failed. This error can happen for many reasons, often due
to issues with your setup or how NumPy was installed. We have compiled
some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html Please
note and check the following: * The Python version is: Python3.9 from
"/usr/local/bin/python" * The NumPy version is: "1.22.3" and make sure
that they are the versions you expect. Please carefully study the
documentation linked above for further help. Original error was: No
module named 'numpy.core._multiarray_umath' . Troubleshooting Guide:
https://aka.ms/functions-modulenotfound Stack: File
"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py",
line 305, in _handle__function_load_request func =
loader.load_function( File
"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py",
line 42, in call raise extend_exception_message(e, message) File
"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/utils/wrappers.py",
line 40, in call return func(*args, **kwargs) File
"/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/loader.py",
line 85, in load_function mod = importlib.import_module(fullmodname)
File "/usr/local/lib/python3.9/importlib/init.py", line 127, in
import_module return _bootstrap._gcd_import(name[level:], package,
level) File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in
_find_and_load_unlocked File "", line 680, in _load_unlocked File "",
line 850, in exec_module File "", line
228, in _call_with_frames_removed File
"/home/site/wwwroot/bilans/main.py", line 24, in from .
import bilan File "/home/site/wwwroot/bilans/bilan.py", line 16, in
import numpy as np File
"/home/site/wwwroot/.python_packages/lib/site-packages/numpy/init.py",
line 144, in from . import core File
"/home/site/wwwroot/.python_packages/lib/site-packages/numpy/core/init.py",
line 49, in raise ImportError(msg)
Maybe you will have to use python 3.9 and the latest ubuntu agent in the pipeline
https://github.com/Azure/azure-functions-python-worker/issues/904

How to solve "No package espeak available." error when trying to install speak on AWS ec2 linux?

The same code is working on my local machine(Windows) but when running the same on AWS Linux after installing Pyttsx3, it is not working.
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
this is the sample code.
I am new to AWS and LINUX.
And this is the error:
Traceback (most recent call last):
File "/home/ec2-user/st_env/env/lib64/python3.6/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/usr/lib64/python3.6/weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ec2-user/st_env/env/lib64/python3.6/site-packages/pyttsx3/__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "/home/ec2-user/st_env/env/lib64/python3.6/site-packages/pyttsx3/engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/home/ec2-user/st_env/env/lib64/python3.6/site-packages/pyttsx3/driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "/usr/lib64/python3.6/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 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 "/home/ec2-user/st_env/env/lib64/python3.6/site-packages/pyttsx3/drivers/espeak.py", line 9, in <module>
from . import _espeak, toUtf8, fromUtf8
File "/home/ec2-user/st_env/env/lib64/python3.6/site-packages/pyttsx3/drivers/_espeak.py", line 18, in <module>
dll = cdll.LoadLibrary('libespeak.so.1')
File "/usr/lib64/python3.6/ctypes/__init__.py", line 421, in LoadLibrary
return self._dlltype(name)
File "/usr/lib64/python3.6/ctypes/__init__.py", line 343, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libespeak.so.1: cannot open shared object file: No such file or directory
EDIT: this OSError: libespeak.so.1: error is there because the espeak engine is not installed on the machine(as suggested by other Stackoverflow post),
is there any way to install espeak than sudo yum install espeak ?
I have tested the below commands on the amazon ec2 instance with host os Amazon Linux 2 and also tested your sample python code which runs successfully.
If your host system is Amazon Linux 2 then you can install espeak using the below commands :
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
[ec2-user#aws ~]$ rpm -E %{rhel}
7 --> as you can see here its based on RHEL 7
[ec2-user#aws ~]$ yum list espeak
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Available Packages
espeak.i686 1.47.11-4.amzn2.0.2 amzn2-core
espeak.x86_64 1.47.11-4.amzn2.0.2 amzn2-core
Here you can see the espeak package is available on Amazon Linux.
So you need to install it using the below command :
ec2-user#aws ~]$ sudo yum -y install espeak
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package espeak.x86_64 0:1.47.11-4.amzn2.0.2 will be installed
--> Processing Dependency: libpulse.so.0(PULSE_0)(64bit) for package: espeak-1.47.11-4.amzn2.0.2.x86_64
--> Processing Dependency: libpulse.so.0()(64bit) for package: espeak-1.47.11-4.amzn2.0.2.x86_64
--> Running transaction check
---> Package pulseaudio-libs.x86_64 0:10.0-3.amzn2.0.3 will be installed
--> Processing Dependency: libsndfile.so.1(libsndfile.so.1.0)(64bit) for package: pulseaudio-libs-10.0-3.amzn2.0.3.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: pulseaudio-libs-10.0-3.amzn2.0.3.x86_64
--> Processing Dependency: libsndfile.so.1()(64bit) for package: pulseaudio-libs-10.0-3.amzn2.0.3.x86_64
--> Processing Dependency: libasyncns.so.0()(64bit) for package: pulseaudio-libs-10.0-3.amzn2.0.3.x86_64
--> Processing Dependency: libXtst.so.6()(64bit) for package: pulseaudio-libs-10.0-3.amzn2.0.3.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: pulseaudio-libs-10.0-3.amzn2.0.3.x86_64
--> Processing Dependency: libX11-xcb.so.1()(64bit) for package: pulseaudio-libs-10.0-3.amzn2.0.3.x86_64
...
OR
yum localinstall http://mirror.centos.org/centos/7/os/x86_64/Packages/espeak-1.47.11-4.el7.x86_64.rpm
And it will install the package espeak.

Cannot load German BERT model in spaCy

Here is my problem: I am working on the German text classification project. I use spacy for that and decided to fine-tune its pretrained BERT model to get better results. However, when I try to load it to the code, it shows me errors.
Here is what I've done:
Installed spacy-transformers: pip install spacy-transformers
Downloaded German BERT model: python -m spacy download de_trf_bertbasecased_lg. It was downloaded successfully and showed me: ✔ Download and installation successful
You can now load the model via spacy.load('de_trf_bertbasecased_lg')
Wrote the following code:
import spacy
nlp = spacy.load('de_trf_bertbasecased_lg')
And the output was:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
nlp = spacy.load('de_trf_bertbasecased_lg')
File "C:\Python\Python37\lib\site-packages\spacy\__init__.py", line 30, in load
return util.load_model(name, **overrides)
File "C:\Python\Python37\lib\site-packages\spacy\util.py", line 164, in load_model
return load_model_from_package(name, **overrides)
File "C:\Python\Python37\lib\site-packages\spacy\util.py", line 185, in load_model_from_package
return cls.load(**overrides)
File "C:\Python\Python37\lib\site-packages\de_trf_bertbasecased_lg\__init__.py", line 12, in load
return load_model_from_init_py(__file__, **overrides)
File "C:\Python\Python37\lib\site-packages\spacy\util.py", line 228, in load_model_from_init_py
return load_model_from_path(data_path, meta, **overrides)
File "C:\Python\Python37\lib\site-packages\spacy\util.py", line 196, in load_model_from_path
cls = get_lang_class(lang)
File "C:\Python\Python37\lib\site-packages\spacy\util.py", line 70, in get_lang_class
if lang in registry.languages:
File "C:\Python\Python37\lib\site-packages\catalogue.py", line 56, in __contains__
has_entry_point = self.entry_points and self.get_entry_point(name)
File "C:\Python\Python37\lib\site-packages\catalogue.py", line 140, in get_entry_point
return entry_point.load()
File "C:\Python\Python37\lib\site-packages\importlib_metadata\__init__.py", line 94, in load
module = import_module(match.group('module'))
File "C:\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Python\Python37\lib\site-packages\spacy_transformers\__init__.py", line 1, in <module>
from .language import TransformersLanguage
File "C:\Python\Python37\lib\site-packages\spacy_transformers\language.py", line 5, in <module>
from .util import is_special_token, pkg_meta, ATTRS, PIPES, LANG_FACTORY
File "C:\Python\Python37\lib\site-packages\spacy_transformers\util.py", line 2, in <module>
import transformers
File "C:\Python\Python37\lib\site-packages\transformers\__init__.py", line 20, in <module>
from .file_utils import (TRANSFORMERS_CACHE, PYTORCH_TRANSFORMERS_CACHE, PYTORCH_PRETRAINED_BERT_CACHE,
File "C:\Python\Python37\lib\site-packages\transformers\file_utils.py", line 37, in <module>
import torch
File "C:\Python\Python37\lib\site-packages\torch\__init__.py", line 81, in <module>
ctypes.CDLL(dll)
File "C:\Python\Python37\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
If I run the same code in PyCharm, it also shows me these two lines before all of those above:
2020-05-19 18:00:55.132721: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not
load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-05-19 18:00:55.132990: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart
dlerror if you do not have a GPU set up on your machine.
If I got it right, these two lines complain that I don't have a GPU. However, according to the docs, I should be able to use BERT even without GPU.
So I am really stuck right now and looking for your help.
I should also mention, that I used de_core_news_sm model before and it worked fine.
I have also already tried several solutions, but none of them worked. I tried:
this and this. I have also tried to uninstall all spacy-related libraries and installed them again. Didn't help either.
I am working with:
Windows 10 Home
Python: 3.7.2
Spacy: 2.2.4
Spacy-transformers: 0.5.1
Would appreciate any help or advice!
It's probably a problem with your installation of torch. Start in a clean virtual environment and install torch using the instructions here with CUDA as None: https://pytorch.org/get-started/locally/. Then install spacy-transformers with pip.
Try:
python -m spacy download de_trf_bertbasecased_lg
python -m spacy download de_trf_bertbasecased_lg-2.2.0
python -m spacy link de_trf_bertbasecased_lg
python -m spacy link de_trf_bertbasecased_lg-2.2.0
Or:
python -m spacy download de
python -m spacy.de.download all
Or download directly from:
https://deepset.ai/german-bert
Then load:
nlp = spacy.load(r'Path_To_File\de_trf_bertbasecased_lg-2.2.0')

Spyder not launching from one of the Anaconda environments

I'm new to this. I have begun learning OpenCV with Python and following the course directions I've successfully created an Anaconda environment from which I can easily import CV2 and carry out my course. So far, I have experienced no problems in working with this environment.
Now, I would like to begin using Spyder which launches well from the default/base environment but does not launch from the "opencv-course" environment which I created. By contrast, Jupyter Labs and Notebooks launch well on either environment.
I've attempted to uninstall/reinstall Spyder using Administrator privileges when launching Anaconda, but to no avail.
Could anyone forward a suggestion?
Many thanks!
MD
The following error message is displayed:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\opencv-course\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\app\start.py", line 205, in main
mainwindow.main()
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\app\mainwindow.py", line 3734, in main
mainwindow = run_spyder(app, options, args)
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\app\mainwindow.py", line 3590, in run_spyder
main.setup()
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\app\mainwindow.py", line 977, in setup
'spyder.plugins.{}'.format(plugin_name))
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\plugins\pylint\__init__.py", line 14, in
from .plugin import Pylint as PLUGIN_CLASS
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\plugins\pylint\plugin.py", line 29, in
from spyder.plugins.pylint.confpage import PylintConfigPage
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\plugins\pylint\confpage.py", line 16, in
from spyder.plugins.pylint.widgets.pylintgui import PylintWidget
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\plugins\pylint\widgets\pylintgui.py", line 37, in
from spyder.plugins.pylint.utils import get_pylintrc_path
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\spyder\plugins\pylint\utils.py", line 16, in
import pylint.config
File "C:\ProgramData\Anaconda3\envs\opencv-course\lib\site-packages\pylint\config.py", line 54, in
import toml
ModuleNotFoundError: No module named 'toml'
After checking out this answer here:
Spyder failed to launch in Anaconda after update (4.1.2)
I've solved the problem by downgrading the version of Pylint from 2.5 to 2.4.4. It now works fine.
Many thanks!
MD

Categories

Resources