ImportError loading spacy in jupyter notebook(ubuntu) - python

I got a problem I can't seem to figure out. The first time I imported Spacy into a Jupyter notebook I had no problems. It just imported it as I expected.
import spacy
nlp = spacy.load('en_core_web_sm')
i tried
import sys
print(sys.executable)
and i got this error
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-21-e4c801bd61f2> in <module>
----> 1 import spacy
2 nlp = spacy.load('en_core_web_sm')
~/Downloads/PREFIX=/home/khbe0387/anaconda3/lib/python3.8/site-packages/spacy/__init__.py in <module>
9
10 # These are imported as part of the API
---> 11 from thinc.api import prefer_gpu, require_gpu, require_cpu # noqa: F401
12 from thinc.api import Config
13
ImportError: cannot import name 'prefer_gpu' from 'thinc.api' (/home/khbe0387/Downloads/PREFIX=/home/khbe0387/anaconda3/lib/python3.8/site-packages/thinc/api.py)

Related

from simpletransformers.language_modeling import LanguageModelingModel NOT WORKING

I have installed simpletransformers with success. Why is it not working? A big thank you in advance.
from simpletransformers.language_modeling import LanguageModelingModel
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-9-eb4f4fd6459f> in <module>
----> 1 from simpletransformers.language_modeling import LanguageModelingModel
~\anaconda3\lib\site-packages\simpletransformers\language_modeling\__init__.py in <module>
----> 1 from simpletransformers.config.model_args import LanguageModelingArgs
2 from simpletransformers.language_modeling.language_modeling_model import LanguageModelingModel
~\anaconda3\lib\site-packages\simpletransformers\config\model_args.py in <module>
6 import warnings
7
----> 8 from torch.utils.data import Dataset
9
10
ModuleNotFoundError: No module named 'torch'
I answered my own question with "pip install torch" and updated the Microsoft C++ reading software. :)))

Folium Problem: "No module named 'folium.map'; 'folium' is not a package"

A few days ago Folium was working perfectly, but now it's not working. The problem:
import folium
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-10-173c1173bf1c> in <module>
----> 1 import folium
~\folium.py in <module>
13 from branca.element import CssLink, Element, Figure, JavascriptLink, MacroElement
14
---> 15 from folium.map import FitBounds
16 from folium.raster_layers import TileLayer
17 from folium.utilities import _parse_size, _tmp_html, _validate_location
ModuleNotFoundError: No module named 'folium.map'; 'folium' is not a package
Even installing by pip and conda doesn't matter library.

ModuleNotFoundError: No module named 'support_functions'

I am trying to import following in jupyter notebook.
How do I import module Support_funcions?
from support_functions import calculate_accuracy, plot_confusion_matrix
Populating the interactive namespace from numpy and matplotlib
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-d809bed20d2c> in <module>
20
21 # Support functions import
---> 22 from support_functions import calculate_accuracy, plot_confusion_matrix
ModuleNotFoundError: No module named 'support_functions'
Make sure setup is correct for Python. Add the file for support_functions (support_functions.py question) to the systems python._pth file.

Error while importing gensim package in colab

ImportError: cannot import name 'mean_absolute_difference'
Tried uninstalling and installing again.
import gensim
ImportError Traceback (most recent call last)
<ipython-input-28-e70e92d32c6e> in <module>()
----> 1 import gensim
2 frames
/usr/local/lib/python3.6/dist-packages/gensim/models/hdpmodel.py in
<module>()
61
62 from gensim import interfaces, utils, matutils
---> 63 from gensim.matutils import dirichlet_expectation,
mean_absolute_difference
64 from gensim.models import basemodel, ldamodel
65
ImportError: cannot import name 'mean_absolute_difference'
I tried installing gensim on my linux using !pip install gensim and after that i imported as you did it worked fine. Like shown below.
>>> !pip install gensim
>>> import gensim
>>> from gensim import interfaces, utils, matutils
>>> from gensim.matutils import dirichlet_expectation, mean_absolute_difference
>>>

ImportError: No module named src.utils tensorflow

I am trying to load tensorflow within jupyter notebook and receive the following error:
ImportError Traceback (most recent call last) <ipython-input-1-28a19874e1dd> in <module>()
5 import tensorflow as tf
6 from tensorflow.python.framework import ops
----> 7 from tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict
8
9 get_ipython().magic(u'matplotlib inline')
/Pathway/tf_utils.py in <module>()
17 import sys
18 import tensorflow as tf
---> 19 import src.utils as utils
20 import logging
21 from tensorflow.contrib import slim
ImportError: No module named src.utils
I have the latest tensorflow installed and have also added models to the PYTHONPATH via:
export PYTHONPATH="$PYTHONPATH:/Pathway/tfmodels-1.9.0"
Do you know how I can resolve this import error?
To resolve this import error I manually imported the missing functions from the following github repo > https://github.com/andersy005/deep-learning-specialization-coursera/blob/master/02-Improving-Deep-Neural-Networks/week3/Programming-Assignments/tf_utils.py

Categories

Resources