spacy.load('en_core_web_sm')
from pyresparser import ResumeParser
data = ResumeParser('Resume.pdf').get_extracted_data()
OSError: [E053] Could not read config.cfg from C:\Users\Kumaran\anaconda3\envs\nlp\lib\site-packages\pyresparser\config.cfg
OSError Traceback (most recent call last)
<ipython-input-3-941548297df0> in <module>
1 from pyresparser import ResumeParser
----> 2 data = ResumeParser('Resume.pdf').get_extracted_data()
~\anaconda3\envs\nlp\lib\site-packages\pyresparser\resume_parser.py in __init__(self, resume, skills_file, custom_regex)
19 ):
20 nlp = spacy.load('en_core_web_sm')
---> 21 custom_nlp = spacy.load(os.path.dirname(os.path.abspath(__file__)))
22 self.__skills_file = skills_file
23 self.__custom_regex = custom_regex
~\anaconda3\envs\nlp\lib\site-packages\spacy\__init__.py in load(name, disable, exclude, config)
45 RETURNS (Language): The loaded nlp object.
46 """
---> 47 return util.load_model(name, disable=disable, exclude=exclude, config=config)
48
49
To solve the issues, install these versions:
pip install nltk
pip install spacy==2.3.5
pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz
pip install pyresparser
Just to explain what caused the E053 error: the installed models were not compatible with the installed spacy version. You can use python -m spacy validate to see your version and if you have any models for it, then install matching versions as in the above answer. Source: https://github.com/explosion/spaCy/issues/7453
Related
I am trying to import shapely but getting error.
--------------------------------------------------------------------------- OSError Traceback (most recent call last) <ipython-input-9-62e74f53568a> in <module>
----> 1 import shapely.geometry
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geometry/__init__.py in <module>
2 """
3
----> 4 from .base import CAP_STYLE, JOIN_STYLE
5 from .geo import box, shape, asShape, mapping
6 from .point import Point, asPoint
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geometry/base.py in <module>
16
17 from shapely.affinity import affine_transform
---> 18 from shapely.coords import CoordinateSequence
19 from shapely.errors import WKBReadingError, WKTReadingError
20 from shapely.geos import WKBWriter, WKTWriter
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/coords.py in <module>
6 from ctypes import byref, c_double, c_uint
7
----> 8 from shapely.geos import lgeos
9 from shapely.topology import Validating
10
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geos.py in <module>
136 _lgeos = load_dll('geos_c', fallbacks=alt_paths)
137
--> 138 free = load_dll('c').free
139 free.argtypes = [c_void_p]
140 free.restype = None
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geos.py in load_dll(libname, fallbacks, mode)
60 raise OSError(
61 "Could not find lib {} or load any of its variants {}.".format(
---> 62 libname, fallbacks or []))
63
64 _lgeos = None
OSError: Could not find lib c or load any of its variants [].
I tried conda install -c conda-forge geos=3.7.1 but its not helping.
Can someone please help how can i repair Shapely. Shapely version I m using is 1.8.2.
I also tried conda install -c conda-forge geos=3.7.1 but it did not work.
I guess you are using an anaconda environment. So after you activate your environment in terminal;
conda activate <your_environment_name>
Using
pip install Shapely
in terminal, while my environment is active, I was able to use the package. Version is the 1.8.2, just like you wanted it.
For the possibility that you'd like to have a reminder on conda environments, here is a wonderful link.
While importing ktrain, I am getting the following error:
AttributeError: module 'tensorflow_core.keras.activations' has no attribute 'swish'
Can anyone please help and tell how to get it going?
The same works fine on google colab.
Full Error:
AttributeError Traceback (most recent call last)
<ipython-input-3-d851226d5f91> in <module>
----> 1 import ktrain
2 from ktrain import text
~/opt/anaconda3/envs/Anmol/lib/python3.7/site-packages/ktrain/__init__.py in <module>
1 from .version import __version__
----> 2 from . import imports as I
3 from .core import ArrayLearner, GenLearner, get_predictor, load_predictor, release_gpu_memory
4 from .vision.learner import ImageClassLearner
5 from .text.learner import BERTTextClassLearner, TransformerTextClassLearner
~/opt/anaconda3/envs/Anmol/lib/python3.7/site-packages/ktrain/imports.py in <module>
227 logging.getLogger("transformers").setLevel(logging.ERROR)
228 try:
--> 229 import transformers
230 except ImportError:
231 warnings.warn("transformers not installed - needed by various models in 'text' module")
~/opt/anaconda3/envs/Anmol/lib/python3.7/site-packages/transformers/__init__.py in <module>
133
134 # Pipelines
--> 135 from .pipelines import (
136 Conversation,
137 ConversationalPipeline,
~/opt/anaconda3/envs/Anmol/lib/python3.7/site-packages/transformers/pipelines.py in <module>
46 import tensorflow as tf
47
---> 48 from .modeling_tf_auto import (
49 TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
50 TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
~/opt/anaconda3/envs/Anmol/lib/python3.7/site-packages/transformers/modeling_tf_auto.py in <module>
49 from .configuration_utils import PretrainedConfig
50 from .file_utils import add_start_docstrings
---> 51 from .modeling_tf_albert import (
52 TFAlbertForMaskedLM,
53 TFAlbertForMultipleChoice,
~/opt/anaconda3/envs/Anmol/lib/python3.7/site-packages/transformers/modeling_tf_albert.py in <module>
22 import tensorflow as tf
23
---> 24 from .activations_tf import get_tf_activation
25 from .configuration_albert import AlbertConfig
26 from .file_utils import (
~/opt/anaconda3/envs/Anmol/lib/python3.7/site-packages/transformers/activations_tf.py in <module>
52 "gelu": tf.keras.layers.Activation(gelu),
53 "relu": tf.keras.activations.relu,
---> 54 "swish": tf.keras.activations.swish,
55 "silu": tf.keras.activations.swish,
56 "gelu_new": tf.keras.layers.Activation(gelu_new),
AttributeError: module 'tensorflow_core.keras.activations' has no attribute 'swish' ```
Okay so there is some issue with Macs with M1.
Followed the following to resolve the issue:
(https://github.com/apple/tensorflow_macos/issues/48)
Anaconda start a new environment Uninstall tensorflow & tensorboard
if exists
Rename all the files inside the x86_64 folder from 11_0 to 10_16.
Example: tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl
In Conda console run below with 'username' replaced with your username:
pip install pip wheel setuptools cached-property six
pip install
"/Users/username/Downloads/tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_10_16_x86_64.whl"
pip install
"/Users/username/Downloads/tensorflow_macos/x86_64/h5py-2.10.0-cp38-cp38-macosx_10_16_x86_64.whl"
pip install
"/Users/username/Downloads/tensorflow_macos/x86_64/numpy-1.18.5-cp38-cp38-macosx_10_16_x86_64.whl"
pip install
"/Users/username/Downloads/tensorflow_macos/x86_64/scipy-1.5.4-cp38-cp38-macosx_10_16_x86_64.whl"
pip install
"/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_10_16_x86_64.whl"
pip install absl-py astunparse flatbuffers gast google_pasta
keras_preprocessing opt_einsum protobuf tensorflow_estimator
termcolor typing_extensions wrapt wheel tensorboard typeguard
pip install
"/Users/username/Downloads/tensorflow_macos/x86_64/tensorflow_macos-0.1a0-cp38-cp38-macosx_10_16_x86_64.whl"
Check the versions that you are using for Tensorflow (and transformers). You can check this issue in GitHub:
https://github.com/amaiya/ktrain/issues/255
I use ktrain==0.25.4 and tensorflow==2.4.1 and everything worked.
I am currently working on my first program with Jupyter. When I run a cell I receive the following
<ipython-input-6-7a7db0de4539> in <module>
1 try:
----> 2 from sklearn.datasets import fetch_openml
3 mnist = fetch_openml('mnist_784', version=1, cache=True)
c:\users\james\appdata\local\programs\python\python37\lib\site-packages\sklearn\__init__.py in <module>
63 from . import __check_build
---> 64 from .base import clone
65 from .utils._show_versions import show_versions
c:\users\james\appdata\local\programs\python\python37\lib\site-packages\sklearn\base.py in <module>
12 from .externals import six
---> 13 from .utils.fixes import signature
14 from . import __version__
c:\users\james\appdata\local\programs\python\python37\lib\site-packages\sklearn\utils\__init__.py in <module>
15 from ..exceptions import DataConversionWarning
---> 16 from .fixes import _Sequence as Sequence
17 from .deprecation import deprecated
c:\users\james\appdata\local\programs\python\python37\lib\site-packages\sklearn\utils\fixes.py in <module>
84 else:
---> 85 from scipy.special import boxcox # noqa
86
c:\users\james\appdata\local\programs\python\python37\lib\site-packages\scipy\special\__init__.py in <module>
640
--> 641 from ._ufuncs import *
642
ImportError: DLL load failed: The specified module could not be found.
I used pip install to get sklearn and when doing pip list in the cmd it is there. However when I even try import sklearn I get an error.
I have checked import sys then sys.path which gave me:
'C:\\Users\\James\\Documents\\Machine Learning Comp Vision\\Project 1',
'C:\\Users\\James\\Documents\\Machine Learning Comp Vision\\Project 1',
'c:\\users\\james\\appdata\\local\\programs\\python\\python37\\python37.zip',
'c:\\users\\james\\appdata\\local\\programs\\python\\python37\\DLLs',
'c:\\users\\james\\appdata\\local\\programs\\python\\python37\\lib',
'c:\\users\\james\\appdata\\local\\programs\\python\\python37',
'',
'c:\\users\\james\\appdata\\local\\programs\\python\\python37\\lib\\site-packages',
'c:\\users\\james\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\James\\.ipython']
All of my modules are located in C:\Users\James\AppData\Local\Programs\Python\Python37\lib\site-packages
Would the capital letters in my file url be the cause of this or is it something to do with the path itself?
If you already have a working installation of numpy and scipy, then do this:
pip install -U scikit-learn
otherwise:
conda install scikit-learn
finally check for updates:
conda update pip
Use pip from inside your Jupyter notebook
!{sys.executable} -m pip install -U scikit-learn
This will use the sys.executable to run the right pip for your current kernel, instead of for some other Python install.
I installed moviepy package using pip. Whenever I import moviepy, the following error appears:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-1-3137d113b348> in <module>()
6 import os
7 import math
----> 8 from moviepy.editor import VideoFileClip
9 from IPython.display import HTML
10 get_ipython().magic('matplotlib inline')
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\editor.py in <module>()
20 # Clips
21
---> 22 from .video.io.VideoFileClip import VideoFileClip
23 from .video.io.ImageSequenceClip import ImageSequenceClip
24 from .video.VideoClip import VideoClip, ImageClip, ColorClip, TextClip
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\video\io\VideoFileClip.py in <module>()
1 import os
2
----> 3 from moviepy.video.VideoClip import VideoClip
4 from moviepy.audio.io.AudioFileClip import AudioFileClip
5 from moviepy.Clip import Clip
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\video\VideoClip.py in <module>()
19
20 import moviepy.audio.io as aio
---> 21 from .io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video
22 from .io.ffmpeg_reader import ffmpeg_read_image
23 from .io.ffmpeg_tools import ffmpeg_merge_video_audio
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\video\io\ffmpeg_writer.py in <module>()
17 from tqdm import tqdm
18
---> 19 from moviepy.conf import FFMPEG_BINARY
20 from moviepy.tools import verbose_print
21
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\conf.py in <module>()
59 FFMPEG_BINARY = 'ffmpeg.exe'
60 else:
---> 61 raise IOError("FFMPEG binary not found. Try installing MoviePy"
62 " manually and specify the path to the binary in"
63 " the file conf.py")
OSError: FFMPEG binary not found. Try installing MoviePy manually and specify the path to the binary in the file conf.py
I downloaded the FFMPEG file but I don't know to specify the path in conf.py.
Any help ?
I encountered this issue when trying to use PythonVideoConverter
The steps I took to finally resolve this were:
pip install ffmpeg
Then you have to go download the ffmpeg executables separately. Source code can be found here:
http://ffmpeg.org/
I actually used the pre-built binaries for windows available here:
https://github.com/BtbN/FFmpeg-Builds/releases
The lines to use PythonVideoConverter are:
from converter import Converter
conv = Converter()
Add the absolute path to the executables as input parameters to Converter(), ie:
ffmpegPath = r"c:\...\ffmpeg.exe"
ffprobePath = r"c:\...\ffprobe.exe"
from converter import Converter
conv = Converter(ffmpegPath, ffprobePath)
edit: This was on Windows 10 using Python 3.7.4. I used the win64-gpl build of ffmpeg.
I had this same problem, but in ubuntu. It got solved by simply installing ffmpeg using apt-get:
sudo apt-get install ffmpeg
I don't have anaconda , but as per error dump
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\conf.py in <module>()
59 FFMPEG_BINARY = 'ffmpeg.exe'
60 else:
---> 61 raise IOError("FFMPEG binary not found. Try installing
Here are steps that I can think of,
Find out absolute path for ffmpeg.exe on your system.
Copy that path.
Edit C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\conf.py
change line 59 to
FFMPEG_BINARY = 'c:\your_path_to_ffmpeg.exeutable\ffmpeg.exe'
save the conf.py
Hope this helps.
So I am trying to get hmmlearn working in Jupyter, and I have come across an error while installing Hmmlearn using pip. I have tried this solution, but it didn't work.
It seems to me that pip does install the _hmmc file, but it does so incorrect. instead it has the name
_hmmc.cp35-win_amd64
and the file extesion is .PYD, instead of .c
When I run the code to import it, I get this error :
ImportError Traceback (most recent call last)
<ipython-input-1-dee84c3d5ff9> in <module>()
7 import os
8 from pyAudioAnalysis import audioBasicIO as aB
----> 9 from pyAudioAnalysis import audioAnalysis as aA
C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioAnalysis.py in <module>()
15 import audioFeatureExtraction as aF
16 import audioTrainTest as aT
---> 17 import audioSegmentation as aS
18 import audioVisualization as aV
19 import audioBasicIO
C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioSegmentation.py in <module>()
16 import sklearn
17 import sklearn.cluster
---> 18 import hmmlearn.hmm
19 import cPickle
20 import glob
C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\hmm.py in <module>()
19 from sklearn.utils import check_random_state
20
---> 21 from .base import _BaseHMM
22 from .utils import iter_from_X_lengths, normalize
23
C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\base.py in <module>()
11 from sklearn.utils.validation import check_is_fitted
12
---> 13 from . import _hmmc
14 from .utils import normalize, log_normalize, iter_from_X_lengths
15
ImportError: cannot import name _hmmc
I don't know why pip just doesn't install it correctly, even when I tried to use --no-cache-dir
Edit: So i figured out what the problem was. my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version.
I had to change my active python enviroment: using activate <my_enviroment name>
after that i could just use pip to install it again and it worked this time.
Looking at your error message I guess that you have downloaded the hmmlearn package from GIT. Have you tried using a wheel (*.whl) file instead? You can download one from here. Check out which version fits your python installation.
Then use:
pip install <the_wheel_that_corresponds_to_your_python_version>.whl
Hope it helps.
So i figured out what the problem was. my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version. I had to change my active python enviroment: using activate <my_enviroment_name> after that i could just use pip to install it again and it worked this time.
not sure if it could be helpful to anyone but I installed hmmlearn as follows in my Jupyter Lab:
import sys
!{sys.executable} -m pip install hmmlearn