How to Install module name pb? - python

When I am Running code but it is showing error message because it is showing no module name, how to install pb name module in Collaboratory and anaconda?
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-65b14fed549b> in <module>()
6 import seaborn as sns
7
----> 8 from pb import log_progress
ModuleNotFoundError: No module named 'pb'
%matplotlib inline
from matplotlib import pylab as plt
import matplotlib.dates as mdates
plt.rcParams['figure.figsize'] = (15.0, 8.0)
import pandas as pd
import seaborn as sns
from pb import log_progress

A quick google brought me here: https://progressbar-2.readthedocs.io/en/latest/#
logically this would be easily fixed by running the commands pip install progressbar2 or pip3 install progressbar2.

Related

Jupyter Notebook Import Error: cannot import name 'np_version_under1p17' from 'pandas.compat.numpy'

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.dates as md
import datetime as dt
import time
from zipfile import ZipFile
from matplotlib.pyplot import xticks
%matplotlib inline
--------------------------------------------------------------------------- ImportError Traceback (most recent call
last) in
1 import numpy as np
----> 2 import pandas as pd
3 import matplotlib.pyplot as plt
4 import seaborn as sns
5 import matplotlib.dates as md
~\anaconda3\lib\site-packages\pandas_init_.py in
20
21 # numpy compat
---> 22 from pandas.compat.numpy import (
23 np_version_under1p17 as _np_version_under1p17,
24 np_version_under1p18 as _np_version_under1p18,
ImportError: cannot import name 'np_version_under1p17' from
'pandas.compat.numpy' (C:\Users\XX\anaconda3\lib\site-packages\pandas\compat\numpy_init_.py)
I have upgraded all conda libraries, uninstalled/installed pandas again, but its still stuck
I encountered the same problem and I think that there is no "one-step" solution.
For me, I recently installed python 64-bit version as I was using the 32-bit version till then. But due to some reason the new version was installed in a different location.
My problem was actually with the notebook. So I deleted all the files(the folder in which the old 32-bit python was installed) in the old path and reinstalled the notebook using pip install notebook and everything worked fine.
Before that try upgrading the current pandas version using pip3 --upgrade pandas. For me the problem was messed up installation.

Error when importing matplotlib in Python

I am new to python and am just getting started. I have a Jupyter Notebook from my university and have to plot something using matplotlib. All I find on the web is this:
import numpy as np
import matplotlib.pyplot as plt
but when I try that, it tells me
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-12-e0e1492b7973> in <module>
1 import numpy as np
----> 2 import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
Any help and further tips are very welcome.
matplotlib has to be installed
pip3 install matplotlib
since you have the jupyter tag, installing it with the Anaconda Prompt is an option
conda install matplotlib

No module named cv2 in only one jupyter notebook

Before someone says that this is a repeated question and I should just install it, hear my case:
I am running a jupyter notebook from a conda environment in which opencv is already installed
I have had no problem using opencv so far in this environment.
I have downloaded a jupyter notebook, I have also created my own.
In my own newly created notebook I put
import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
#%matplotlib qt
%matplotlib inline
it runs without problems.
Then I open the other notebook (which is situated in the same directory as the previous one)
and I do
import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
%matplotlib qt
and I get
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-b35e53327fbb> in <module>
1 import numpy as np
----> 2 import cv2
3 import glob
4 import matplotlib.pyplot as plt
5 get_ipython().run_line_magic('matplotlib', 'qt')
ModuleNotFoundError: No module named 'cv2'
Why? It was running in the other notebook!
See if both notebooks are running in the same virtual environment.
You can type conda activate <env_name> before running the notebook with jupyter notebook command.

How do I import face_recognition in Google Colaboratory?

I'm working in Google Colab and have already imported dlib
!pip install dlib
import dlib
and installed face_recognition module.
!pip install face_recognition
But, I'm getting error for this line:
import face_recognition
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib.patches import Circle
import numpy as np
import cv2
%matplotlib inline
The error is as follows:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-159-91aca6eea0d3> in <module>()
----> 1 import face_recognition
2 import matplotlib.pyplot as plt
3 from matplotlib.patches import Rectangle
4 from matplotlib.patches import Circle
5 import numpy as np
1 frames
/usr/local/lib/python3.6/dist-packages/face_recognition/api.py in <module>()
24
25 cnn_face_detection_model = face_recognition_models.cnn_face_detector_model_location()
---> 26 cnn_face_detector = dlib.cnn_face_detection_model_v1(cnn_face_detection_model)
27
28 face_recognition_model = face_recognition_models.face_recognition_model_location()
RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /tmp/pip-wheel-66glv9rf/dlib/dlib/cuda/gpu_data.cpp:201. code: 100, reason: no CUDA-capable device is detected
What can be done?
From the error I can see you (probably) have not enabled GPU acceleration.
Go to Runtime -> Change Runtime -> Select GPU
Then Run the code !pip install face_recognition
This should install the library (and dependencies) without issue. Besides you don't need to install dlib separately. Let face_recognition build it alongside it.

Jupyter Notebook: ModuleNotFoundError: No module named 'matplotlib.pylot'

I've just received the following error message from inside Jupyter Notebooks.
*---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-e12bc46e5dd0> in <module>
----> 1 import matplotlib.pylot as plt
ModuleNotFoundError: No module named 'matplotlib.pylot'*
But FYI I've already installed matplotlib and I get the following message when I type "pip3 install matplotlib" into Terminal:
*Requirement already satisfied: matplotlib in /Users/mattbrown/miniconda3/lib/python3.7/site-packages (3.0.3)*
You just misspelled the lib name, it’s pyplot, not pylot ;)
Typo, use
import matplotlib.pyplot as plt
instead of
import matplotlib.pylot as plt
I'm so embarrassed! That did the trick. Fixed the typo and went with:
import matplotlib.pyplot as plt

Categories