Fastai on google colab - path

Two days back I ran my model using fastai 0.7.0 on google colab.
And for two days I got busy and now if I am trying to run it , its throwing me an error, on the execution of the line
*"from fastai.transforms import ’ .
the error is AttributeError: module ‘torch’ has no attribute ‘float32’.

The following should get you up and running with the 0.7.0 version of fast.ai (used by v2 of the course) on Google Colab:
!pip install -q "fastai==0.7.0" Pillow==4.1.1 torchtext==0.2.3
!apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag())
# !apt update -q
!apt install -y libsm6 libxext6
from os import path
accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu'
torch_whl = f"http://download.pytorch.org/whl/{accelerator}/torch-0.3.0.post4-{platform}-linux_x86_64.whl"
!pip install -q {torch_whl} torchvision image

At-last found what was wrong, there was a compatibility issue.
The pytorch version was 0.3.1 but torchtext version was not compatible with it, has to be “torchtext==0.2.3.”

add below code. i dont really know which dependency call this. but it worked
!pip install -q pandas==0.23.4
!pip install -q joblib==0.12.5
!pip install -q plotly==3.0.0

Related

How to import cv2 in Deepnote?

I'm trying to run cv2 in Deepnote, but when I do it I get the following error:
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
I have proved the following:
!pip install ffmpeg libsm6 libxext6
!pip install libgl1-mesa-dev
But when I run it, I have this error:
Could not find a version that satisfies the requirement...
No matching distribution found for...
Does anyone know how to import cv2 in Deepnote, can you help me!
Thanks!
It is because ffmpeg libsm6 libxext6 libgl1-mesa-dev are linux packages and you are trying to install them as if they were python packages. You need to install them to your operating system instead of python environment.
you can install them by using
!apt install ffmpeg libsm6 libxext6 libgl1-mesa-dev
instead.
Here you can see an example of how to do it.

Module seaborn has no attribute lineplot

I don't know why it's showing this although I installed all packages. I uninstalled and reinstalled python and also did 'pip install seaborn' but it's showing the same problem as mentioned below
Module seaborn has no attribute lineplot
Install seaborn version 0.9.0
For conda
conda install -c anaconda seaborn=0.9.0
For pip
pip install seaborn==0.9.0

ModuleNotFoundError: No module named 'cv2' in google coral mendel 4.0

https://coral.withgoogle.com/news/updates-11-2019/
As per above google coral November updates new Mendel 4.0 has the support of OpenCV but when I installed Mendel 4.0 it is unable to import cv2. Please let me know do I've to follow any further steps to install OpenCV in Mendel 4.0
Following steps have to be done:
If you have a fresh image make sure you update your system packages
sudo apt-get update
sudo apt-get dist-upgrade
Install OpenCV
sudo apt install python3-opencv
Test installation
python3 -c 'import cv2; print(cv2.__version__)'
I can confirm, that openCV can be installed using sudo apt install python3-opencv. If it does not work, check if your board is connected to the internet (see coral documentation here).
you can install it with
$ sudo apt-get install python3-opencv

Can't locate 'hdf5.h' during test

I tried to install the HDF5 library. I followed this guide Install_HDF5. In particular, I used:
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-mpich-dev
sudo apt-get install libhdf5-openmpi-dev
Up to this moment all the installations were successful. I tried to test it (make test) still following the guide, but I get:
fatal error hdf5.h no such file or directory
Could it concern a problem with my ~/.bashrc, i.e. with some missing path to hdf5?
P.S. I tested the Python module of HDF5 and it is working. I only received a warning message that I got rid of by using:
sudo python2.7 -m pip install git+https:://github.com/h5py/h5py.git --upgrade

Problems installing scikit-image in ubuntu 14.04

When I try to install scikit-image with pip2 there is show error. I have tried to find this problem solution.
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/scikit-image
Storing debug log for failure in /home/nshakib/.pip/pip.log
My guess is that you might have missing dependencies. I don't think Ubuntu 14.04 comes out of the box with any of the SciPy stack.
To answer your question try,
sudo apt-get install python-matplotlib python-numpy python-pil python-scipy
Then
sudo apt-get install build-essential cython
Finally
sudo apt-get install python-skimage
If that still doesn't work, you could try using the Anaconda Distribution for Python 2.7 from Continuum Analytics.
It comes with many of the major packages built-in and has a great package manager that manages dependencies.
https://docs.continuum.io/anaconda/install#anaconda-install
The conda package would be installed with conda install scikit-image

Resources