Can't import ToTensorV2 in Colab - pytorch

from albumentations.pytorch.transforms import ToTensorV2
I used the above code, and it doesn't work.

Just add a code block with the line
! pip install albumentations==0.4.6
above the block where you do the import. I tried installing it without the specific version and it failed.
When i did not specify the version number in pip install, version 0.1.12 was installed which does not contain ToTensorV2.

Ensure that you have the latest version
!pip install --upgrade --force-reinstall --no-deps albumentations

Get albumentations from Github.
Usage on Colab Example
!pip install -U git+https://github.com/albu/albumentations > /dev/null

Related

Having issues to import imblearn python package on Jupyter notebook on Anaconda

I wanted to install imbalanced-learn using pip install imbalanced-learn. Then I have tried import
from imblearn.ensemble import EasyEnsembleClassifier
This import gave me the following error. I did try with uninstall imbalanced-learn and re-install imbalanced-learn, but it didn't help.
ImportError: cannot import name '_joblib_parallel_args' from 'sklearn.utils.fixes' (C:\Users\Jishan\anaconda3\envs\summerprojects\lib\site-packages\sklearn\utils\fixes.py)
I also tried
pip: pip install -U imbalanced-learn
anaconda: conda install -c glemaitre imbalanced-learn
They were not helpful as well. I was using Anaconda virtual environment. I appreciate your suggestions. Thanks!
you can try this :
conda install -c conda-forge imbalanced-learn to update documentation
sudo pip3 install imblearn to install imblearn
on command prompt : pip3 install imblearn
on anaconda !pip3 install imblearn

Can't install PymuPDF although python Libary have PymuPDF

I tried to install PyMuPDF on Python 3.9 when first I installed by pip install PymuPDF and re-checked by pip list like this"
But when I imported PyMuPDF:
ModuleNotFoundError: No module named 'PyMuPDF'
Next, I tried to install PymuPDF from doc, it said I need install MuPDF first, and install with Wheel, I tried both:
pip install C:\Users\Admin\Desktop/PyMuPDF-1.19.6-cp310-cp310-win_amd64.whl and pip install PyMuPDF-1.19.6-cp310-cp310-win_amd64.whl but reviced error:
yMuPDF-1.19.6-cp310-cp310-win_amd64.whl is not a supported wheel on this platform.
What should i do to install PyMuPDF, thank you all.
PyMuPDF is available with a wheel under all Windows versions - you should have no problem at all.
But please follow this procedure:
Make sure your pip is the current one. This ensures that any changes in supported platform tags are known to pip.
Then install PyMuPDF.
So overall
py -3.10 -m pip install -U pip
py -3.10 -m pip install -U pymupdf
This should simply work!
In your script however you must do import fitz - this is the top-level name of the package.

sklearn cannot be imported in jupyter

I have installed anaconda. I can import panda, matplotlib but cannot import sklearn. I have installed sklearn and it also shows that it is installed,but cannot import it in jupyter. here is what it says
Try installing with the --upgrade flag.
-U, --upgrade Upgrade all specified packages to the newest available version. The handling of
dependencies depends on the upgrade-strategy used.
Use this:
!pip install -U scikit-learn

ImportError:'save_weights' requires h5py

When I save weights during training my CNN model using keras, it says ImportError:'save_weights' requires h5py, but I have already installed h5py.
I would greatly appreciate if someone could explain how to fix this issue.
Just install necessary packages
sudo apt-get install libhdf5-dev
pip install h5py
If you are using windows and python IDE, open cmd and input following commands:
pip install h5py
pip install cython
I hope it helps.
I was getting the same error as you.
I installed all the requirements listed here: https://github.com/fchollet/keras/issues/3426
Finally just needed to reboot and it started working.
As suggested by others:
pip install h5py
Note that this may not immediately resolve the issue in your active session and you may need to reload keras.models either through the following commands or by just creating a new session/re-opening your jupyter notebook.
In Python3:
from importlib import reload
reload(keras.models)
In Python2:
use importlib.import_module instead. See docs for a reference.
These additional steps may be necessary because of the try/except ImportError in keras sourcecode that assigns h5py = None when it's unable to locate it the first time it's executed.
In my case, re-installing did the trick:
pip uninstall -y cython h5py
pip install cython h5py
(Windows 10, Conda, Keras 2.4.3)
I think you may miss this
from keras.applications import imagenet_utils
I got the same problem even though I have imported the h5py.
It is the load error with the keras. It has to be reloaded.
import keras
from importlib import reload
reload(keras.models)
It has worked for me.
h5py==2.10.0 works well with TF >= 2.1 so try 'pip install h5py==2.10.0'
Have you tried directly installing h5py? http://docs.h5py.org/en/latest/build.html
Try running:
pip install h5py
or
sudo apt-get install libhdf5

Error installing urllib3

I am using the command pip install urllib3, the error trace I am getting is as below.
Which pip version do you use?
Try first to run the command pip install --upgrade pip
After that, when your pip version is up-to-date try to install the urllib3.
EDIT:
Alternatively, you can grab the latest source code from GitHub:
git clone git://github.com/shazow/urllib3.git
python setup.py install
Without seeing the full traceback, this looks like your computer cannot resolve the addresses for pypi.python.org or pypi.org (I dont' know what version of pip you're using).
This could be because of a proxy issue or some other internet connectivity issue. There is literally no way for someone to help you debug this without more information.
Finally
pip install urllib3 version=2.4.0
Does not do what you think. What you told pip to do was install urllib3 and install a package named version. If you want a specific version you need to write
pip install urllib3===1.4.0
Or whatever version you need.

Resources